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 ANDI_FM_MM16<bits<6> funct> {
65 let Inst{15-10} = funct;
71 class LOGIC_FM_MM16<bits<4> funct> {
77 let Inst{15-10} = 0x11;
78 let Inst{9-6} = funct;
83 class SHIFT_FM_MM16<bits<1> funct> {
90 let Inst{15-10} = 0x09;
93 let Inst{3-1} = shamt;
97 class ADDIUR2_FM_MM16 {
104 let Inst{15-10} = 0x1b;
111 class LOAD_STORE_FM_MM16<bits<6> op> {
117 let Inst{15-10} = op;
119 let Inst{6-4} = addr{6-4};
120 let Inst{3-0} = addr{3-0};
123 class ADDIUS5_FM_MM16 {
129 let Inst{15-10} = 0x13;
135 class ADDIUSP_FM_MM16 {
140 let Inst{15-10} = 0x13;
145 class MOVE_FM_MM16<bits<6> funct> {
151 let Inst{15-10} = funct;
162 let Inst{15-10} = 0x3b;
167 class JALR_FM_MM16<bits<5> op> {
172 let Inst{15-10} = 0x11;
177 class MFHILO_FM_MM16<bits<5> funct> {
182 let Inst{15-10} = 0x11;
183 let Inst{9-5} = funct;
187 class JRADDIUSP_FM_MM16<bits<5> op> {
193 let Inst{15-10} = 0x11;
198 class ADDIUR1SP_FM_MM16 {
204 let Inst{15-10} = 0x1b;
210 //===----------------------------------------------------------------------===//
211 // MicroMIPS 32-bit Instruction Formats
212 //===----------------------------------------------------------------------===//
215 string Arch = "micromips";
216 list<dag> Pattern = [];
219 class ADD_FM_MM<bits<6> op, bits<10> funct> : MMArch {
226 let Inst{31-26} = op;
227 let Inst{25-21} = rt;
228 let Inst{20-16} = rs;
229 let Inst{15-11} = rd;
231 let Inst{9-0} = funct;
234 class ADDI_FM_MM<bits<6> op> : MMArch {
241 let Inst{31-26} = op;
242 let Inst{25-21} = rt;
243 let Inst{20-16} = rs;
244 let Inst{15-0} = imm16;
247 class SLTI_FM_MM<bits<6> op> : MMArch {
254 let Inst{31-26} = op;
255 let Inst{25-21} = rt;
256 let Inst{20-16} = rs;
257 let Inst{15-0} = imm16;
260 class LUI_FM_MM : MMArch {
266 let Inst{31-26} = 0x10;
267 let Inst{25-21} = 0xd;
268 let Inst{20-16} = rt;
269 let Inst{15-0} = imm16;
272 class MULT_FM_MM<bits<10> funct> : MMArch {
278 let Inst{31-26} = 0x00;
279 let Inst{25-21} = rt;
280 let Inst{20-16} = rs;
281 let Inst{15-6} = funct;
282 let Inst{5-0} = 0x3c;
285 class SRA_FM_MM<bits<10> funct, bit rotate> : MMArch {
293 let Inst{25-21} = rd;
294 let Inst{20-16} = rt;
295 let Inst{15-11} = shamt;
296 let Inst{10} = rotate;
297 let Inst{9-0} = funct;
300 class SRLV_FM_MM<bits<10> funct, bit rotate> : MMArch {
308 let Inst{25-21} = rt;
309 let Inst{20-16} = rs;
310 let Inst{15-11} = rd;
311 let Inst{10} = rotate;
312 let Inst{9-0} = funct;
315 class LW_FM_MM<bits<6> op> : MMArch {
321 let Inst{31-26} = op;
322 let Inst{25-21} = rt;
323 let Inst{20-16} = addr{20-16};
324 let Inst{15-0} = addr{15-0};
327 class LWL_FM_MM<bits<4> funct> {
333 let Inst{31-26} = 0x18;
334 let Inst{25-21} = rt;
335 let Inst{20-16} = addr{20-16};
336 let Inst{15-12} = funct;
337 let Inst{11-0} = addr{11-0};
340 class CMov_F_I_FM_MM<bits<7> func> : MMArch {
347 let Inst{31-26} = 0x15;
348 let Inst{25-21} = rd;
349 let Inst{20-16} = rs;
350 let Inst{15-13} = fcc;
351 let Inst{12-6} = func;
352 let Inst{5-0} = 0x3b;
355 class MTLO_FM_MM<bits<10> funct> : MMArch {
360 let Inst{31-26} = 0x00;
361 let Inst{25-21} = 0x00;
362 let Inst{20-16} = rs;
363 let Inst{15-6} = funct;
364 let Inst{5-0} = 0x3c;
367 class MFLO_FM_MM<bits<10> funct> : MMArch {
372 let Inst{31-26} = 0x00;
373 let Inst{25-21} = 0x00;
374 let Inst{20-16} = rd;
375 let Inst{15-6} = funct;
376 let Inst{5-0} = 0x3c;
379 class CLO_FM_MM<bits<10> funct> : MMArch {
385 let Inst{31-26} = 0x00;
386 let Inst{25-21} = rd;
387 let Inst{20-16} = rs;
388 let Inst{15-6} = funct;
389 let Inst{5-0} = 0x3c;
392 class SEB_FM_MM<bits<10> funct> : MMArch {
398 let Inst{31-26} = 0x00;
399 let Inst{25-21} = rd;
400 let Inst{20-16} = rt;
401 let Inst{15-6} = funct;
402 let Inst{5-0} = 0x3c;
405 class EXT_FM_MM<bits<6> funct> : MMArch {
413 let Inst{31-26} = 0x00;
414 let Inst{25-21} = rt;
415 let Inst{20-16} = rs;
416 let Inst{15-11} = size;
417 let Inst{10-6} = pos;
418 let Inst{5-0} = funct;
421 class J_FM_MM<bits<6> op> : MMArch {
426 let Inst{31-26} = op;
427 let Inst{25-0} = target;
430 class JR_FM_MM<bits<8> funct> : MMArch {
435 let Inst{31-21} = 0x00;
436 let Inst{20-16} = rs;
437 let Inst{15-14} = 0x0;
438 let Inst{13-6} = funct;
439 let Inst{5-0} = 0x3c;
442 class JALR_FM_MM<bits<10> funct> {
448 let Inst{31-26} = 0x00;
449 let Inst{25-21} = rd;
450 let Inst{20-16} = rs;
451 let Inst{15-6} = funct;
452 let Inst{5-0} = 0x3c;
455 class BEQ_FM_MM<bits<6> op> : MMArch {
462 let Inst{31-26} = op;
463 let Inst{25-21} = rt;
464 let Inst{20-16} = rs;
465 let Inst{15-0} = offset;
468 class BGEZ_FM_MM<bits<5> funct> : MMArch {
474 let Inst{31-26} = 0x10;
475 let Inst{25-21} = funct;
476 let Inst{20-16} = rs;
477 let Inst{15-0} = offset;
480 class BGEZAL_FM_MM<bits<5> funct> : MMArch {
486 let Inst{31-26} = 0x10;
487 let Inst{25-21} = funct;
488 let Inst{20-16} = rs;
489 let Inst{15-0} = offset;
492 class SYNC_FM_MM : MMArch {
497 let Inst{31-26} = 0x00;
498 let Inst{25-21} = 0x0;
499 let Inst{20-16} = stype;
500 let Inst{15-6} = 0x1ad;
501 let Inst{5-0} = 0x3c;
504 class BRK_FM_MM : MMArch {
508 let Inst{31-26} = 0x0;
509 let Inst{25-16} = code_1;
510 let Inst{15-6} = code_2;
511 let Inst{5-0} = 0x07;
514 class SYS_FM_MM : MMArch {
517 let Inst{31-26} = 0x0;
518 let Inst{25-16} = code_;
519 let Inst{15-6} = 0x22d;
520 let Inst{5-0} = 0x3c;
527 let Inst{31-26} = 0x00;
528 let Inst{25-16} = code_;
529 let Inst{15-6} = 0x24d;
530 let Inst{5-0} = 0x3c;
533 class ER_FM_MM<bits<10> funct> : MMArch {
536 let Inst{31-26} = 0x00;
537 let Inst{25-16} = 0x00;
538 let Inst{15-6} = funct;
539 let Inst{5-0} = 0x3c;
542 class EI_FM_MM<bits<10> funct> : MMArch {
546 let Inst{31-26} = 0x00;
547 let Inst{25-21} = 0x00;
548 let Inst{20-16} = rt;
549 let Inst{15-6} = funct;
550 let Inst{5-0} = 0x3c;
553 class TEQ_FM_MM<bits<6> funct> : MMArch {
560 let Inst{31-26} = 0x00;
561 let Inst{25-21} = rt;
562 let Inst{20-16} = rs;
563 let Inst{15-12} = code_;
564 let Inst{11-6} = funct;
565 let Inst{5-0} = 0x3c;
568 class TEQI_FM_MM<bits<5> funct> : MMArch {
574 let Inst{31-26} = 0x10;
575 let Inst{25-21} = funct;
576 let Inst{20-16} = rs;
577 let Inst{15-0} = imm16;
580 class LL_FM_MM<bits<4> funct> {
586 let Inst{31-26} = 0x18;
587 let Inst{25-21} = rt;
588 let Inst{20-16} = addr{20-16};
589 let Inst{15-12} = funct;
590 let Inst{11-0} = addr{11-0};
593 class ADDS_FM_MM<bits<2> fmt, bits<8> funct> : MMArch {
600 let Inst{31-26} = 0x15;
601 let Inst{25-21} = ft;
602 let Inst{20-16} = fs;
603 let Inst{15-11} = fd;
606 let Inst{7-0} = funct;
608 list<dag> Pattern = [];
611 class LWXC1_FM_MM<bits<9> funct> : MMArch {
618 let Inst{31-26} = 0x15;
619 let Inst{25-21} = index;
620 let Inst{20-16} = base;
621 let Inst{15-11} = fd;
622 let Inst{10-9} = 0x0;
623 let Inst{8-0} = funct;
626 class SWXC1_FM_MM<bits<9> funct> : MMArch {
633 let Inst{31-26} = 0x15;
634 let Inst{25-21} = index;
635 let Inst{20-16} = base;
636 let Inst{15-11} = fs;
637 let Inst{10-9} = 0x0;
638 let Inst{8-0} = funct;
641 class CEQS_FM_MM<bits<2> fmt> : MMArch {
648 let Inst{31-26} = 0x15;
649 let Inst{25-21} = ft;
650 let Inst{20-16} = fs;
651 let Inst{15-13} = 0x0; // cc
653 let Inst{11-10} = fmt;
654 let Inst{9-6} = cond;
655 let Inst{5-0} = 0x3c;
658 class BC1F_FM_MM<bits<5> tf> : MMArch {
663 let Inst{31-26} = 0x10;
664 let Inst{25-21} = tf;
665 let Inst{20-18} = 0x0; // cc
666 let Inst{17-16} = 0x0;
667 let Inst{15-0} = offset;
670 class ROUND_W_FM_MM<bits<1> fmt, bits<8> funct> : MMArch {
676 let Inst{31-26} = 0x15;
677 let Inst{25-21} = fd;
678 let Inst{20-16} = fs;
681 let Inst{13-6} = funct;
682 let Inst{5-0} = 0x3b;
685 class ABS_FM_MM<bits<2> fmt, bits<7> funct> : MMArch {
691 let Inst{31-26} = 0x15;
692 let Inst{25-21} = fd;
693 let Inst{20-16} = fs;
695 let Inst{14-13} = fmt;
696 let Inst{12-6} = funct;
697 let Inst{5-0} = 0x3b;
700 class CMov_F_F_FM_MM<bits<9> func, bits<2> fmt> : MMArch {
706 let Inst{31-26} = 0x15;
707 let Inst{25-21} = fd;
708 let Inst{20-16} = fs;
709 let Inst{15-13} = 0x0; //cc
710 let Inst{12-11} = 0x0;
711 let Inst{10-9} = fmt;
712 let Inst{8-0} = func;
715 class CMov_I_F_FM_MM<bits<8> funct, bits<2> fmt> : MMArch {
722 let Inst{31-26} = 0x15;
723 let Inst{25-21} = rt;
724 let Inst{20-16} = fs;
725 let Inst{15-11} = fd;
727 let Inst{7-0} = funct;
730 class MFC1_FM_MM<bits<8> funct> : MMArch {
736 let Inst{31-26} = 0x15;
737 let Inst{25-21} = rt;
738 let Inst{20-16} = fs;
739 let Inst{15-14} = 0x0;
740 let Inst{13-6} = funct;
741 let Inst{5-0} = 0x3b;
744 class MADDS_FM_MM<bits<6> funct>: MMArch {
752 let Inst{31-26} = 0x15;
753 let Inst{25-21} = ft;
754 let Inst{20-16} = fs;
755 let Inst{15-11} = fd;
757 let Inst{5-0} = funct;
760 class COMPACT_BRANCH_FM_MM<bits<5> funct> {
766 let Inst{31-26} = 0x10;
767 let Inst{25-21} = funct;
768 let Inst{20-16} = rs;
769 let Inst{15-0} = offset;
772 class COP0_TLB_FM_MM<bits<10> op> : MMArch {
775 let Inst{31-26} = 0x0;
776 let Inst{25-16} = 0x0;
778 let Inst{5-0} = 0x3c;
781 class SDBBP_FM_MM : MMArch {
786 let Inst{31-26} = 0x0;
787 let Inst{25-16} = code_;
788 let Inst{15-6} = 0x36d;
789 let Inst{5-0} = 0x3c;
792 class RDHWR_FM_MM : MMArch {
798 let Inst{31-26} = 0x0;
799 let Inst{25-21} = rt;
800 let Inst{20-16} = rd;
801 let Inst{15-6} = 0x1ac;
802 let Inst{5-0} = 0x3c;
805 class LWXS_FM_MM<bits<10> funct> {
812 let Inst{31-26} = 0x0;
813 let Inst{25-21} = index;
814 let Inst{20-16} = base;
815 let Inst{15-11} = rd;
817 let Inst{9-0} = funct;
820 class LWM_FM_MM<bits<4> funct> : MMArch {
826 let Inst{31-26} = 0x8;
827 let Inst{25-21} = rt;
828 let Inst{20-16} = addr{20-16};
829 let Inst{15-12} = funct;
830 let Inst{11-0} = addr{11-0};