1 //===----------------------------------------------------------------------===//
2 // MicroMIPS Base Classes
3 //===----------------------------------------------------------------------===//
6 // Base class for MicroMips instructions.
7 // This class does not depend on the instruction size.
9 class MicroMipsInstBase<dag outs, dag ins, string asmstr, list<dag> pattern,
10 InstrItinClass itin, Format f> : Instruction
12 let Namespace = "Mips";
13 let DecoderNamespace = "MicroMips";
15 let OutOperandList = outs;
16 let InOperandList = ins;
18 let AsmString = asmstr;
19 let Pattern = pattern;
22 let Predicates = [InMicroMips];
28 // Base class for MicroMIPS 16-bit instructions.
30 class MicroMipsInst16<dag outs, dag ins, string asmstr, list<dag> pattern,
31 InstrItinClass itin, Format f> :
32 MicroMipsInstBase<outs, ins, asmstr, pattern, itin, f>
36 field bits<16> SoftFail = 0;
40 //===----------------------------------------------------------------------===//
41 // MicroMIPS 16-bit Instruction Formats
42 //===----------------------------------------------------------------------===//
44 class ARITH_FM_MM16<bit funct> {
51 let Inst{15-10} = 0x01;
58 class LOGIC_FM_MM16<bits<4> funct> {
64 let Inst{15-10} = 0x11;
65 let Inst{9-6} = funct;
70 class SHIFT_FM_MM16<bits<1> funct> {
77 let Inst{15-10} = 0x09;
80 let Inst{3-1} = shamt;
84 class ADDIUS5_FM_MM16 {
90 let Inst{15-10} = 0x13;
96 class ADDIUSP_FM_MM16 {
101 let Inst{15-10} = 0x13;
106 class MOVE_FM_MM16<bits<6> funct> {
112 let Inst{15-10} = funct;
117 class JALR_FM_MM16<bits<5> op> {
122 let Inst{15-10} = 0x11;
127 class MFHILO_FM_MM16<bits<5> funct> {
132 let Inst{15-10} = 0x11;
133 let Inst{9-5} = funct;
137 class JRADDIUSP_FM_MM16<bits<5> op> {
143 let Inst{15-10} = 0x11;
148 //===----------------------------------------------------------------------===//
149 // MicroMIPS 32-bit Instruction Formats
150 //===----------------------------------------------------------------------===//
153 string Arch = "micromips";
154 list<dag> Pattern = [];
157 class ADD_FM_MM<bits<6> op, bits<10> funct> : MMArch {
164 let Inst{31-26} = op;
165 let Inst{25-21} = rt;
166 let Inst{20-16} = rs;
167 let Inst{15-11} = rd;
169 let Inst{9-0} = funct;
172 class ADDI_FM_MM<bits<6> op> : MMArch {
179 let Inst{31-26} = op;
180 let Inst{25-21} = rt;
181 let Inst{20-16} = rs;
182 let Inst{15-0} = imm16;
185 class SLTI_FM_MM<bits<6> op> : MMArch {
192 let Inst{31-26} = op;
193 let Inst{25-21} = rt;
194 let Inst{20-16} = rs;
195 let Inst{15-0} = imm16;
198 class LUI_FM_MM : MMArch {
204 let Inst{31-26} = 0x10;
205 let Inst{25-21} = 0xd;
206 let Inst{20-16} = rt;
207 let Inst{15-0} = imm16;
210 class MULT_FM_MM<bits<10> funct> : MMArch {
216 let Inst{31-26} = 0x00;
217 let Inst{25-21} = rt;
218 let Inst{20-16} = rs;
219 let Inst{15-6} = funct;
220 let Inst{5-0} = 0x3c;
223 class SRA_FM_MM<bits<10> funct, bit rotate> : MMArch {
231 let Inst{25-21} = rd;
232 let Inst{20-16} = rt;
233 let Inst{15-11} = shamt;
234 let Inst{10} = rotate;
235 let Inst{9-0} = funct;
238 class SRLV_FM_MM<bits<10> funct, bit rotate> : MMArch {
246 let Inst{25-21} = rt;
247 let Inst{20-16} = rs;
248 let Inst{15-11} = rd;
249 let Inst{10} = rotate;
250 let Inst{9-0} = funct;
253 class LW_FM_MM<bits<6> op> : MMArch {
259 let Inst{31-26} = op;
260 let Inst{25-21} = rt;
261 let Inst{20-16} = addr{20-16};
262 let Inst{15-0} = addr{15-0};
265 class LWL_FM_MM<bits<4> funct> {
271 let Inst{31-26} = 0x18;
272 let Inst{25-21} = rt;
273 let Inst{20-16} = addr{20-16};
274 let Inst{15-12} = funct;
275 let Inst{11-0} = addr{11-0};
278 class CMov_F_I_FM_MM<bits<7> func> : MMArch {
285 let Inst{31-26} = 0x15;
286 let Inst{25-21} = rd;
287 let Inst{20-16} = rs;
288 let Inst{15-13} = fcc;
289 let Inst{12-6} = func;
290 let Inst{5-0} = 0x3b;
293 class MTLO_FM_MM<bits<10> funct> : MMArch {
298 let Inst{31-26} = 0x00;
299 let Inst{25-21} = 0x00;
300 let Inst{20-16} = rs;
301 let Inst{15-6} = funct;
302 let Inst{5-0} = 0x3c;
305 class MFLO_FM_MM<bits<10> funct> : MMArch {
310 let Inst{31-26} = 0x00;
311 let Inst{25-21} = 0x00;
312 let Inst{20-16} = rd;
313 let Inst{15-6} = funct;
314 let Inst{5-0} = 0x3c;
317 class CLO_FM_MM<bits<10> funct> : MMArch {
323 let Inst{31-26} = 0x00;
324 let Inst{25-21} = rd;
325 let Inst{20-16} = rs;
326 let Inst{15-6} = funct;
327 let Inst{5-0} = 0x3c;
330 class SEB_FM_MM<bits<10> funct> : MMArch {
336 let Inst{31-26} = 0x00;
337 let Inst{25-21} = rd;
338 let Inst{20-16} = rt;
339 let Inst{15-6} = funct;
340 let Inst{5-0} = 0x3c;
343 class EXT_FM_MM<bits<6> funct> : MMArch {
351 let Inst{31-26} = 0x00;
352 let Inst{25-21} = rt;
353 let Inst{20-16} = rs;
354 let Inst{15-11} = size;
355 let Inst{10-6} = pos;
356 let Inst{5-0} = funct;
359 class J_FM_MM<bits<6> op> : MMArch {
364 let Inst{31-26} = op;
365 let Inst{25-0} = target;
368 class JR_FM_MM<bits<8> funct> : MMArch {
373 let Inst{31-21} = 0x00;
374 let Inst{20-16} = rs;
375 let Inst{15-14} = 0x0;
376 let Inst{13-6} = funct;
377 let Inst{5-0} = 0x3c;
380 class JALR_FM_MM<bits<10> funct> {
386 let Inst{31-26} = 0x00;
387 let Inst{25-21} = rd;
388 let Inst{20-16} = rs;
389 let Inst{15-6} = funct;
390 let Inst{5-0} = 0x3c;
393 class BEQ_FM_MM<bits<6> op> : MMArch {
400 let Inst{31-26} = op;
401 let Inst{25-21} = rt;
402 let Inst{20-16} = rs;
403 let Inst{15-0} = offset;
406 class BGEZ_FM_MM<bits<5> funct> : MMArch {
412 let Inst{31-26} = 0x10;
413 let Inst{25-21} = funct;
414 let Inst{20-16} = rs;
415 let Inst{15-0} = offset;
418 class BGEZAL_FM_MM<bits<5> funct> : MMArch {
424 let Inst{31-26} = 0x10;
425 let Inst{25-21} = funct;
426 let Inst{20-16} = rs;
427 let Inst{15-0} = offset;
430 class SYNC_FM_MM : MMArch {
435 let Inst{31-26} = 0x00;
436 let Inst{25-21} = 0x0;
437 let Inst{20-16} = stype;
438 let Inst{15-6} = 0x1ad;
439 let Inst{5-0} = 0x3c;
442 class BRK_FM_MM : MMArch {
446 let Inst{31-26} = 0x0;
447 let Inst{25-16} = code_1;
448 let Inst{15-6} = code_2;
449 let Inst{5-0} = 0x07;
452 class SYS_FM_MM : MMArch {
455 let Inst{31-26} = 0x0;
456 let Inst{25-16} = code_;
457 let Inst{15-6} = 0x22d;
458 let Inst{5-0} = 0x3c;
465 let Inst{31-26} = 0x00;
466 let Inst{25-16} = code_;
467 let Inst{15-6} = 0x24d;
468 let Inst{5-0} = 0x3c;
471 class ER_FM_MM<bits<10> funct> : MMArch {
474 let Inst{31-26} = 0x00;
475 let Inst{25-16} = 0x00;
476 let Inst{15-6} = funct;
477 let Inst{5-0} = 0x3c;
480 class EI_FM_MM<bits<10> funct> : MMArch {
484 let Inst{31-26} = 0x00;
485 let Inst{25-21} = 0x00;
486 let Inst{20-16} = rt;
487 let Inst{15-6} = funct;
488 let Inst{5-0} = 0x3c;
491 class TEQ_FM_MM<bits<6> funct> : MMArch {
498 let Inst{31-26} = 0x00;
499 let Inst{25-21} = rt;
500 let Inst{20-16} = rs;
501 let Inst{15-12} = code_;
502 let Inst{11-6} = funct;
503 let Inst{5-0} = 0x3c;
506 class TEQI_FM_MM<bits<5> funct> : MMArch {
512 let Inst{31-26} = 0x10;
513 let Inst{25-21} = funct;
514 let Inst{20-16} = rs;
515 let Inst{15-0} = imm16;
518 class LL_FM_MM<bits<4> funct> {
524 let Inst{31-26} = 0x18;
525 let Inst{25-21} = rt;
526 let Inst{20-16} = addr{20-16};
527 let Inst{15-12} = funct;
528 let Inst{11-0} = addr{11-0};
531 class ADDS_FM_MM<bits<2> fmt, bits<8> funct> : MMArch {
538 let Inst{31-26} = 0x15;
539 let Inst{25-21} = ft;
540 let Inst{20-16} = fs;
541 let Inst{15-11} = fd;
544 let Inst{7-0} = funct;
546 list<dag> Pattern = [];
549 class LWXC1_FM_MM<bits<9> funct> : MMArch {
556 let Inst{31-26} = 0x15;
557 let Inst{25-21} = index;
558 let Inst{20-16} = base;
559 let Inst{15-11} = fd;
560 let Inst{10-9} = 0x0;
561 let Inst{8-0} = funct;
564 class SWXC1_FM_MM<bits<9> funct> : MMArch {
571 let Inst{31-26} = 0x15;
572 let Inst{25-21} = index;
573 let Inst{20-16} = base;
574 let Inst{15-11} = fs;
575 let Inst{10-9} = 0x0;
576 let Inst{8-0} = funct;
579 class CEQS_FM_MM<bits<2> fmt> : MMArch {
586 let Inst{31-26} = 0x15;
587 let Inst{25-21} = ft;
588 let Inst{20-16} = fs;
589 let Inst{15-13} = 0x0; // cc
591 let Inst{11-10} = fmt;
592 let Inst{9-6} = cond;
593 let Inst{5-0} = 0x3c;
596 class BC1F_FM_MM<bits<5> tf> : MMArch {
601 let Inst{31-26} = 0x10;
602 let Inst{25-21} = tf;
603 let Inst{20-18} = 0x0; // cc
604 let Inst{17-16} = 0x0;
605 let Inst{15-0} = offset;
608 class ROUND_W_FM_MM<bits<1> fmt, bits<8> funct> : MMArch {
614 let Inst{31-26} = 0x15;
615 let Inst{25-21} = fd;
616 let Inst{20-16} = fs;
619 let Inst{13-6} = funct;
620 let Inst{5-0} = 0x3b;
623 class ABS_FM_MM<bits<2> fmt, bits<7> funct> : MMArch {
629 let Inst{31-26} = 0x15;
630 let Inst{25-21} = fd;
631 let Inst{20-16} = fs;
633 let Inst{14-13} = fmt;
634 let Inst{12-6} = funct;
635 let Inst{5-0} = 0x3b;
638 class CMov_F_F_FM_MM<bits<9> func, bits<2> fmt> : MMArch {
644 let Inst{31-26} = 0x15;
645 let Inst{25-21} = fd;
646 let Inst{20-16} = fs;
647 let Inst{15-13} = 0x0; //cc
648 let Inst{12-11} = 0x0;
649 let Inst{10-9} = fmt;
650 let Inst{8-0} = func;
653 class CMov_I_F_FM_MM<bits<8> funct, bits<2> fmt> : MMArch {
660 let Inst{31-26} = 0x15;
661 let Inst{25-21} = rt;
662 let Inst{20-16} = fs;
663 let Inst{15-11} = fd;
665 let Inst{7-0} = funct;
668 class MFC1_FM_MM<bits<8> funct> : MMArch {
674 let Inst{31-26} = 0x15;
675 let Inst{25-21} = rt;
676 let Inst{20-16} = fs;
677 let Inst{15-14} = 0x0;
678 let Inst{13-6} = funct;
679 let Inst{5-0} = 0x3b;
682 class MADDS_FM_MM<bits<6> funct>: MMArch {
690 let Inst{31-26} = 0x15;
691 let Inst{25-21} = ft;
692 let Inst{20-16} = fs;
693 let Inst{15-11} = fd;
695 let Inst{5-0} = funct;
698 class COMPACT_BRANCH_FM_MM<bits<5> funct> {
704 let Inst{31-26} = 0x10;
705 let Inst{25-21} = funct;
706 let Inst{20-16} = rs;
707 let Inst{15-0} = offset;
710 class COP0_TLB_FM_MM<bits<10> op> : MMArch {
713 let Inst{31-26} = 0x0;
714 let Inst{25-16} = 0x0;
716 let Inst{5-0} = 0x3c;