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 ADDIUR2_FM_MM16 {
91 let Inst{15-10} = 0x1b;
98 class ADDIUS5_FM_MM16 {
104 let Inst{15-10} = 0x13;
110 class ADDIUSP_FM_MM16 {
115 let Inst{15-10} = 0x13;
120 class MOVE_FM_MM16<bits<6> funct> {
126 let Inst{15-10} = funct;
137 let Inst{15-10} = 0x3b;
142 class JALR_FM_MM16<bits<5> op> {
147 let Inst{15-10} = 0x11;
152 class MFHILO_FM_MM16<bits<5> funct> {
157 let Inst{15-10} = 0x11;
158 let Inst{9-5} = funct;
162 class JRADDIUSP_FM_MM16<bits<5> op> {
168 let Inst{15-10} = 0x11;
173 class ADDIUR1SP_FM_MM16 {
179 let Inst{15-10} = 0x1b;
185 //===----------------------------------------------------------------------===//
186 // MicroMIPS 32-bit Instruction Formats
187 //===----------------------------------------------------------------------===//
190 string Arch = "micromips";
191 list<dag> Pattern = [];
194 class ADD_FM_MM<bits<6> op, bits<10> funct> : MMArch {
201 let Inst{31-26} = op;
202 let Inst{25-21} = rt;
203 let Inst{20-16} = rs;
204 let Inst{15-11} = rd;
206 let Inst{9-0} = funct;
209 class ADDI_FM_MM<bits<6> op> : MMArch {
216 let Inst{31-26} = op;
217 let Inst{25-21} = rt;
218 let Inst{20-16} = rs;
219 let Inst{15-0} = imm16;
222 class SLTI_FM_MM<bits<6> op> : MMArch {
229 let Inst{31-26} = op;
230 let Inst{25-21} = rt;
231 let Inst{20-16} = rs;
232 let Inst{15-0} = imm16;
235 class LUI_FM_MM : MMArch {
241 let Inst{31-26} = 0x10;
242 let Inst{25-21} = 0xd;
243 let Inst{20-16} = rt;
244 let Inst{15-0} = imm16;
247 class MULT_FM_MM<bits<10> funct> : MMArch {
253 let Inst{31-26} = 0x00;
254 let Inst{25-21} = rt;
255 let Inst{20-16} = rs;
256 let Inst{15-6} = funct;
257 let Inst{5-0} = 0x3c;
260 class SRA_FM_MM<bits<10> funct, bit rotate> : MMArch {
268 let Inst{25-21} = rd;
269 let Inst{20-16} = rt;
270 let Inst{15-11} = shamt;
271 let Inst{10} = rotate;
272 let Inst{9-0} = funct;
275 class SRLV_FM_MM<bits<10> funct, bit rotate> : MMArch {
283 let Inst{25-21} = rt;
284 let Inst{20-16} = rs;
285 let Inst{15-11} = rd;
286 let Inst{10} = rotate;
287 let Inst{9-0} = funct;
290 class LW_FM_MM<bits<6> op> : MMArch {
296 let Inst{31-26} = op;
297 let Inst{25-21} = rt;
298 let Inst{20-16} = addr{20-16};
299 let Inst{15-0} = addr{15-0};
302 class LWL_FM_MM<bits<4> funct> {
308 let Inst{31-26} = 0x18;
309 let Inst{25-21} = rt;
310 let Inst{20-16} = addr{20-16};
311 let Inst{15-12} = funct;
312 let Inst{11-0} = addr{11-0};
315 class CMov_F_I_FM_MM<bits<7> func> : MMArch {
322 let Inst{31-26} = 0x15;
323 let Inst{25-21} = rd;
324 let Inst{20-16} = rs;
325 let Inst{15-13} = fcc;
326 let Inst{12-6} = func;
327 let Inst{5-0} = 0x3b;
330 class MTLO_FM_MM<bits<10> funct> : MMArch {
335 let Inst{31-26} = 0x00;
336 let Inst{25-21} = 0x00;
337 let Inst{20-16} = rs;
338 let Inst{15-6} = funct;
339 let Inst{5-0} = 0x3c;
342 class MFLO_FM_MM<bits<10> funct> : MMArch {
347 let Inst{31-26} = 0x00;
348 let Inst{25-21} = 0x00;
349 let Inst{20-16} = rd;
350 let Inst{15-6} = funct;
351 let Inst{5-0} = 0x3c;
354 class CLO_FM_MM<bits<10> funct> : MMArch {
360 let Inst{31-26} = 0x00;
361 let Inst{25-21} = rd;
362 let Inst{20-16} = rs;
363 let Inst{15-6} = funct;
364 let Inst{5-0} = 0x3c;
367 class SEB_FM_MM<bits<10> funct> : MMArch {
373 let Inst{31-26} = 0x00;
374 let Inst{25-21} = rd;
375 let Inst{20-16} = rt;
376 let Inst{15-6} = funct;
377 let Inst{5-0} = 0x3c;
380 class EXT_FM_MM<bits<6> funct> : MMArch {
388 let Inst{31-26} = 0x00;
389 let Inst{25-21} = rt;
390 let Inst{20-16} = rs;
391 let Inst{15-11} = size;
392 let Inst{10-6} = pos;
393 let Inst{5-0} = funct;
396 class J_FM_MM<bits<6> op> : MMArch {
401 let Inst{31-26} = op;
402 let Inst{25-0} = target;
405 class JR_FM_MM<bits<8> funct> : MMArch {
410 let Inst{31-21} = 0x00;
411 let Inst{20-16} = rs;
412 let Inst{15-14} = 0x0;
413 let Inst{13-6} = funct;
414 let Inst{5-0} = 0x3c;
417 class JALR_FM_MM<bits<10> funct> {
423 let Inst{31-26} = 0x00;
424 let Inst{25-21} = rd;
425 let Inst{20-16} = rs;
426 let Inst{15-6} = funct;
427 let Inst{5-0} = 0x3c;
430 class BEQ_FM_MM<bits<6> op> : MMArch {
437 let Inst{31-26} = op;
438 let Inst{25-21} = rt;
439 let Inst{20-16} = rs;
440 let Inst{15-0} = offset;
443 class BGEZ_FM_MM<bits<5> funct> : MMArch {
449 let Inst{31-26} = 0x10;
450 let Inst{25-21} = funct;
451 let Inst{20-16} = rs;
452 let Inst{15-0} = offset;
455 class BGEZAL_FM_MM<bits<5> funct> : MMArch {
461 let Inst{31-26} = 0x10;
462 let Inst{25-21} = funct;
463 let Inst{20-16} = rs;
464 let Inst{15-0} = offset;
467 class SYNC_FM_MM : MMArch {
472 let Inst{31-26} = 0x00;
473 let Inst{25-21} = 0x0;
474 let Inst{20-16} = stype;
475 let Inst{15-6} = 0x1ad;
476 let Inst{5-0} = 0x3c;
479 class BRK_FM_MM : MMArch {
483 let Inst{31-26} = 0x0;
484 let Inst{25-16} = code_1;
485 let Inst{15-6} = code_2;
486 let Inst{5-0} = 0x07;
489 class SYS_FM_MM : MMArch {
492 let Inst{31-26} = 0x0;
493 let Inst{25-16} = code_;
494 let Inst{15-6} = 0x22d;
495 let Inst{5-0} = 0x3c;
502 let Inst{31-26} = 0x00;
503 let Inst{25-16} = code_;
504 let Inst{15-6} = 0x24d;
505 let Inst{5-0} = 0x3c;
508 class ER_FM_MM<bits<10> funct> : MMArch {
511 let Inst{31-26} = 0x00;
512 let Inst{25-16} = 0x00;
513 let Inst{15-6} = funct;
514 let Inst{5-0} = 0x3c;
517 class EI_FM_MM<bits<10> funct> : MMArch {
521 let Inst{31-26} = 0x00;
522 let Inst{25-21} = 0x00;
523 let Inst{20-16} = rt;
524 let Inst{15-6} = funct;
525 let Inst{5-0} = 0x3c;
528 class TEQ_FM_MM<bits<6> funct> : MMArch {
535 let Inst{31-26} = 0x00;
536 let Inst{25-21} = rt;
537 let Inst{20-16} = rs;
538 let Inst{15-12} = code_;
539 let Inst{11-6} = funct;
540 let Inst{5-0} = 0x3c;
543 class TEQI_FM_MM<bits<5> funct> : MMArch {
549 let Inst{31-26} = 0x10;
550 let Inst{25-21} = funct;
551 let Inst{20-16} = rs;
552 let Inst{15-0} = imm16;
555 class LL_FM_MM<bits<4> funct> {
561 let Inst{31-26} = 0x18;
562 let Inst{25-21} = rt;
563 let Inst{20-16} = addr{20-16};
564 let Inst{15-12} = funct;
565 let Inst{11-0} = addr{11-0};
568 class ADDS_FM_MM<bits<2> fmt, bits<8> funct> : MMArch {
575 let Inst{31-26} = 0x15;
576 let Inst{25-21} = ft;
577 let Inst{20-16} = fs;
578 let Inst{15-11} = fd;
581 let Inst{7-0} = funct;
583 list<dag> Pattern = [];
586 class LWXC1_FM_MM<bits<9> funct> : MMArch {
593 let Inst{31-26} = 0x15;
594 let Inst{25-21} = index;
595 let Inst{20-16} = base;
596 let Inst{15-11} = fd;
597 let Inst{10-9} = 0x0;
598 let Inst{8-0} = funct;
601 class SWXC1_FM_MM<bits<9> funct> : MMArch {
608 let Inst{31-26} = 0x15;
609 let Inst{25-21} = index;
610 let Inst{20-16} = base;
611 let Inst{15-11} = fs;
612 let Inst{10-9} = 0x0;
613 let Inst{8-0} = funct;
616 class CEQS_FM_MM<bits<2> fmt> : MMArch {
623 let Inst{31-26} = 0x15;
624 let Inst{25-21} = ft;
625 let Inst{20-16} = fs;
626 let Inst{15-13} = 0x0; // cc
628 let Inst{11-10} = fmt;
629 let Inst{9-6} = cond;
630 let Inst{5-0} = 0x3c;
633 class BC1F_FM_MM<bits<5> tf> : MMArch {
638 let Inst{31-26} = 0x10;
639 let Inst{25-21} = tf;
640 let Inst{20-18} = 0x0; // cc
641 let Inst{17-16} = 0x0;
642 let Inst{15-0} = offset;
645 class ROUND_W_FM_MM<bits<1> fmt, bits<8> funct> : MMArch {
651 let Inst{31-26} = 0x15;
652 let Inst{25-21} = fd;
653 let Inst{20-16} = fs;
656 let Inst{13-6} = funct;
657 let Inst{5-0} = 0x3b;
660 class ABS_FM_MM<bits<2> fmt, bits<7> funct> : MMArch {
666 let Inst{31-26} = 0x15;
667 let Inst{25-21} = fd;
668 let Inst{20-16} = fs;
670 let Inst{14-13} = fmt;
671 let Inst{12-6} = funct;
672 let Inst{5-0} = 0x3b;
675 class CMov_F_F_FM_MM<bits<9> func, bits<2> fmt> : MMArch {
681 let Inst{31-26} = 0x15;
682 let Inst{25-21} = fd;
683 let Inst{20-16} = fs;
684 let Inst{15-13} = 0x0; //cc
685 let Inst{12-11} = 0x0;
686 let Inst{10-9} = fmt;
687 let Inst{8-0} = func;
690 class CMov_I_F_FM_MM<bits<8> funct, bits<2> fmt> : MMArch {
697 let Inst{31-26} = 0x15;
698 let Inst{25-21} = rt;
699 let Inst{20-16} = fs;
700 let Inst{15-11} = fd;
702 let Inst{7-0} = funct;
705 class MFC1_FM_MM<bits<8> funct> : MMArch {
711 let Inst{31-26} = 0x15;
712 let Inst{25-21} = rt;
713 let Inst{20-16} = fs;
714 let Inst{15-14} = 0x0;
715 let Inst{13-6} = funct;
716 let Inst{5-0} = 0x3b;
719 class MADDS_FM_MM<bits<6> funct>: MMArch {
727 let Inst{31-26} = 0x15;
728 let Inst{25-21} = ft;
729 let Inst{20-16} = fs;
730 let Inst{15-11} = fd;
732 let Inst{5-0} = funct;
735 class COMPACT_BRANCH_FM_MM<bits<5> funct> {
741 let Inst{31-26} = 0x10;
742 let Inst{25-21} = funct;
743 let Inst{20-16} = rs;
744 let Inst{15-0} = offset;
747 class COP0_TLB_FM_MM<bits<10> op> : MMArch {
750 let Inst{31-26} = 0x0;
751 let Inst{25-16} = 0x0;
753 let Inst{5-0} = 0x3c;