1 //=- MicroMips32r6InstrFormats.td - Mips32r6 Instruction Formats -*- tablegen -*-==//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file describes microMIPS32r6 instruction formats.
12 //===----------------------------------------------------------------------===//
14 class MMR6Arch<string opstr> {
15 string Arch = "micromipsr6";
16 string BaseOpcode = opstr;
17 string DecoderNamespace = "MicroMipsR6";
20 //===----------------------------------------------------------------------===//
24 //===----------------------------------------------------------------------===//
26 // Some encodings are ambiguous except by comparing field values.
28 class MMDecodeDisambiguatedBy<string Name> : DecodeDisambiguates<Name> {
29 string DecoderNamespace = "MicroMipsR6_Ambiguous";
32 //===----------------------------------------------------------------------===//
36 //===----------------------------------------------------------------------===//
38 class BC16_FM_MM16R6 {
43 let Inst{15-10} = 0x33;
44 let Inst{9-0} = offset;
47 class BEQZC_BNEZC_FM_MM16R6<bits<6> op> {
55 let Inst{6-0} = offset;
58 class POOL16C_JALRC_FM_MM16R6<bits<5> op> {
63 let Inst{15-10} = 0x11;
68 class POP35_BOVC_FM_MMR6<string instr_asm> : MipsR6Inst, MMR6Arch<instr_asm> {
75 let Inst{31-26} = 0b011101;
78 let Inst{15-0} = offset;
81 class POP37_BNVC_FM_MMR6<string instr_asm> : MipsR6Inst, MMR6Arch<instr_asm> {
88 let Inst{31-26} = 0b011111;
91 let Inst{15-0} = offset;
94 class POOL16C_JRCADDIUSP_FM_MM16R6<bits<5> op> {
99 let Inst{15-10} = 0x11;
104 class POOL16C_LWM_SWM_FM_MM16R6<bits<4> funct> {
110 let Inst{15-10} = 0x11;
112 let Inst{7-4} = addr;
113 let Inst{3-0} = funct;
116 class POOL32A_BITSWAP_FM_MMR6<bits<6> funct> : MipsR6Inst {
122 let Inst{31-26} = 0b000000;
123 let Inst{25-21} = rt;
124 let Inst{20-16} = rd;
125 let Inst{15-12} = 0b0000;
126 let Inst{11-6} = funct;
127 let Inst{5-0} = 0b111100;
130 class CACHE_PREF_FM_MMR6<bits<6> opgroup, bits<4> funct> : MipsR6Inst {
136 let Inst{31-26} = opgroup;
137 let Inst{25-21} = hint;
138 let Inst{20-16} = addr{20-16};
139 let Inst{15-12} = funct;
140 let Inst{11-0} = addr{11-0};
143 class ARITH_FM_MMR6<string instr_asm, bits<10> funct> : MMR6Arch<instr_asm> {
151 let Inst{25-21} = rt;
152 let Inst{20-16} = rs;
153 let Inst{15-11} = rd;
155 let Inst{9-0} = funct;
158 class ADDI_FM_MMR6<string instr_asm, bits<6> op> : MMR6Arch<instr_asm> {
165 let Inst{31-26} = op;
166 let Inst{25-21} = rt;
167 let Inst{20-16} = rs;
168 let Inst{15-0} = imm16;
171 class LB32_FM_MMR6 : MipsR6Inst {
174 bits<5> base = addr{20-16};
175 bits<16> offset = addr{15-0};
179 let Inst{31-26} = 0b000111;
180 let Inst{25-21} = rt;
181 let Inst{20-16} = base;
182 let Inst{15-0} = offset;
185 class LBU32_FM_MMR6 : MipsR6Inst {
188 bits<5> base = addr{20-16};
189 bits<16> offset = addr{15-0};
193 let Inst{31-26} = 0b000101;
194 let Inst{25-21} = rt;
195 let Inst{20-16} = base;
196 let Inst{15-0} = offset;
199 class PCREL19_FM_MMR6<bits<2> funct> : MipsR6Inst {
205 let Inst{31-26} = 0b011110;
206 let Inst{25-21} = rt;
207 let Inst{20-19} = funct;
208 let Inst{18-0} = imm;
211 class PCREL16_FM_MMR6<bits<5> funct> : MipsR6Inst {
217 let Inst{31-26} = 0b011110;
218 let Inst{25-21} = rt;
219 let Inst{20-16} = funct;
220 let Inst{15-0} = imm;
223 class POOL32A_FM_MMR6<bits<10> funct> : MipsR6Inst {
230 let Inst{31-26} = 0b000000;
231 let Inst{25-21} = rt;
232 let Inst{20-16} = rs;
233 let Inst{15-11} = rd;
235 let Inst{9-0} = funct;
238 class POOL32A_PAUSE_FM_MMR6<string instr_asm, bits<5> op> : MMR6Arch<instr_asm> {
244 let Inst{15-11} = op;
249 class POOL32A_RDPGPR_FM_MMR6<bits<10> funct> {
255 let Inst{25-21} = rt;
256 let Inst{20-16} = rd;
257 let Inst{15-6} = funct;
258 let Inst{5-0} = 0b111100;
261 class POOL32A_RDHWR_FM_MMR6 {
268 let Inst{25-21} = rt;
269 let Inst{20-16} = rs;
271 let Inst{13-11} = sel;
273 let Inst{9-0} = 0b0111000000;
276 class POOL32A_SYNC_FM_MMR6 {
283 let Inst{20-16} = stype;
284 let Inst{15-6} = 0b0110101101;
285 let Inst{5-0} = 0b111100;
288 class POOL32I_SYNCI_FM_MMR6 {
290 bits<5> base = addr{20-16};
291 bits<16> immediate = addr{15-0};
295 let Inst{31-26} = 0b010000;
296 let Inst{25-21} = 0b01100;
297 let Inst{20-16} = base;
298 let Inst{15-0} = immediate;
301 class POOL32A_2R_FM_MMR6<bits<10> funct> : MipsR6Inst {
307 let Inst{31-26} = 0b000000;
308 let Inst{25-21} = rt;
309 let Inst{20-16} = rs;
310 let Inst{15-6} = funct;
311 let Inst{5-0} = 0b111100;
314 class SPECIAL_2R_FM_MMR6<bits<6> funct> : MipsR6Inst {
320 let Inst{31-26} = 0b000000;
321 let Inst{25-21} = rs;
322 let Inst{20-16} = 0b00000;
323 let Inst{15-11} = rt;
324 let Inst{10-6} = 0b00001;
325 let Inst{5-0} = funct;
328 class POOL32A_ALIGN_FM_MMR6<bits<6> funct> : MipsR6Inst {
336 let Inst{31-26} = 0b000000;
337 let Inst{25-21} = rs;
338 let Inst{20-16} = rt;
339 let Inst{15-11} = rd;
341 let Inst{8-6} = 0b000;
342 let Inst{5-0} = funct;
345 class AUI_FM_MMR6 : MipsR6Inst {
352 let Inst{31-26} = 0b000100;
353 let Inst{25-21} = rt;
354 let Inst{20-16} = rs;
355 let Inst{15-0} = imm;
358 class POOL32A_LSA_FM<bits<6> funct> : MipsR6Inst {
366 let Inst{31-26} = 0b000000;
367 let Inst{25-21} = rt;
368 let Inst{20-16} = rs;
369 let Inst{15-11} = rd;
370 let Inst{10-9} = imm2;
371 let Inst{8-6} = 0b000;
372 let Inst{5-0} = funct;
375 class SB32_SH32_STORE_FM_MMR6<bits<6> op> {
378 bits<5> base = addr{20-16};
379 bits<16> offset = addr{15-0};
383 let Inst{31-26} = op;
384 let Inst{25-21} = rt;
385 let Inst{20-16} = base;
386 let Inst{15-0} = offset;
389 class LOAD_WORD_FM_MMR6 {
392 bits<5> base = addr{20-16};
393 bits<16> offset = addr{15-0};
397 let Inst{31-26} = 0b111111;
398 let Inst{25-21} = rt;
399 let Inst{20-16} = base;
400 let Inst{15-0} = offset;
403 class LOAD_UPPER_IMM_FM_MMR6 {
409 let Inst{31-26} = 0b000100;
410 let Inst{25-21} = rt;
412 let Inst{15-0} = imm16;
415 class CMP_BRANCH_1R_RT_OFF16_FM_MMR6<string instr_asm, bits<6> funct>
416 : MMR6Arch<instr_asm>, MipsR6Inst {
422 let Inst{31-26} = funct;
423 let Inst{25-21} = rt;
424 let Inst{20-16} = 0b00000;
425 let Inst{15-0} = offset;
428 class CMP_BRANCH_1R_BOTH_OFF16_FM_MMR6<string instr_asm, bits<6> funct>
429 : MMR6Arch<instr_asm>, MipsR6Inst {
435 let Inst{31-26} = funct;
436 let Inst{25-21} = rt;
437 let Inst{20-16} = rt;
438 let Inst{15-0} = offset;
441 class POOL32A_JALRC_FM_MMR6<string instr_asm, bits<10> funct>
442 : MipsR6Inst, MMR6Arch<instr_asm> {
449 let Inst{25-21} = rt;
450 let Inst{20-16} = rs;
451 let Inst{15-6} = funct;
452 let Inst{5-0} = 0b111100;
455 class POOL32A_EXT_INS_FM_MMR6<string instr_asm, bits<6> funct>
456 : MMR6Arch<instr_asm>, MipsR6Inst {
465 let Inst{25-21} = rt;
466 let Inst{20-16} = rs;
467 let Inst{15-11} = size;
468 let Inst{10-6} = pos;
469 let Inst{5-0} = funct;
472 class POOL32A_ERET_FM_MMR6<string instr_asm, bits<10> funct>
473 : MMR6Arch<instr_asm> {
476 let Inst{31-26} = 0x00;
477 let Inst{25-16} = 0x00;
478 let Inst{15-6} = funct;
479 let Inst{5-0} = 0x3c;
482 class ERETNC_FM_MMR6<string instr_asm> : MMR6Arch<instr_asm> {
485 let Inst{31-26} = 0x00;
486 let Inst{25-17} = 0x00;
487 let Inst{16-16} = 0x01;
488 let Inst{15-6} = 0x3cd;
489 let Inst{5-0} = 0x3c;
492 class BREAK_MMR6_ENC<string instr_asm> : MMR6Arch<instr_asm> {
496 let Inst{31-26} = 0x0;
497 let Inst{25-16} = code_1;
498 let Inst{15-6} = code_2;
499 let Inst{5-0} = 0x07;
502 class BARRIER_MMR6_ENC<string instr_asm, bits<5> op> : MMR6Arch<instr_asm> {
505 let Inst{31-26} = 0x0;
506 let Inst{25-21} = 0x0;
507 let Inst{20-16} = 0x0;
508 let Inst{15-11} = op;
509 let Inst{10-6} = 0x0;
513 class POOL32A_EIDI_MMR6_ENC<string instr_asm, bits<10> funct>
514 : MMR6Arch<instr_asm> {
516 bits<5> rt; // Actually rs but we're sharing code with the standard encodings which call it rt
518 let Inst{31-26} = 0x00;
519 let Inst{25-21} = 0x00;
520 let Inst{20-16} = rt;
521 let Inst{15-6} = funct;
522 let Inst{5-0} = 0x3c;
525 class SHIFT_MMR6_ENC<string instr_asm, bits<10> funct, bit rotate> : MMR6Arch<instr_asm> {
533 let Inst{25-21} = rd;
534 let Inst{20-16} = rt;
535 let Inst{15-11} = shamt;
536 let Inst{10} = rotate;
537 let Inst{9-0} = funct;
540 class SW32_FM_MMR6<string instr_asm, bits<6> op> : MMR6Arch<instr_asm> {
546 let Inst{31-26} = op;
547 let Inst{25-21} = rt;
548 let Inst{20-16} = addr{20-16};
549 let Inst{15-0} = addr{15-0};
552 class POOL32F_ARITH_FM_MMR6<string instr_asm, bits<2> fmt, bits<8> funct>
553 : MMR6Arch<instr_asm>, MipsR6Inst {
560 let Inst{31-26} = 0b010101;
561 let Inst{25-21} = ft;
562 let Inst{20-16} = fs;
563 let Inst{15-11} = fd;
566 let Inst{7-0} = funct;
569 class POOL32F_ARITHF_FM_MMR6<string instr_asm, bits<2> fmt, bits<9> funct>
570 : MMR6Arch<instr_asm>, MipsR6Inst {
577 let Inst{31-26} = 0b010101;
578 let Inst{25-21} = ft;
579 let Inst{20-16} = fs;
580 let Inst{15-11} = fd;
581 let Inst{10-9} = fmt;
582 let Inst{8-0} = funct;
585 class POOL32F_MOV_NEG_FM_MMR6<string instr_asm, bits<2> fmt, bits<7> funct>
586 : MMR6Arch<instr_asm>, MipsR6Inst {
592 let Inst{31-26} = 0b010101;
593 let Inst{25-21} = ft;
594 let Inst{20-16} = fs;
596 let Inst{14-13} = fmt;
597 let Inst{12-6} = funct;
598 let Inst{5-0} = 0b111011;
601 class POOL32F_MINMAX_FM<string instr_asm, bits<2> fmt, bits<9> funct>
602 : MMR6Arch<instr_asm>, MipsR6Inst {
609 let Inst{31-26} = 0b010101;
610 let Inst{25-21} = ft;
611 let Inst{20-16} = fs;
612 let Inst{15-11} = fd;
613 let Inst{10-9} = fmt;
614 let Inst{8-0} = funct;
617 class POOL32F_CMP_FM<string instr_asm, bits<6> format, FIELD_CMP_COND Cond>
618 : MMR6Arch<instr_asm>, MipsR6Inst {
625 let Inst{31-26} = 0b010101;
626 let Inst{25-21} = ft;
627 let Inst{20-16} = fs;
628 let Inst{15-11} = fd;
629 let Inst{10-6} = Cond.Value;
630 let Inst{5-0} = format;
633 class POOL32F_CVT_LW_FM<string instr_asm, bit fmt, bits<8> funct>
634 : MMR6Arch<instr_asm>, MipsR6Inst {
639 let Inst{31-26} = 0b010101;
640 let Inst{25-21} = ft;
641 let Inst{20-16} = fs;
644 let Inst{13-6} = funct;
645 let Inst{5-0} = 0b111011;
648 class POOL32F_CVT_DS_FM<string instr_asm, bits<2> fmt, bits<7> funct>
649 : MMR6Arch<instr_asm>, MipsR6Inst {
654 let Inst{31-26} = 0b010101;
655 let Inst{25-21} = ft;
656 let Inst{20-16} = fs;
658 let Inst{14-13} = fmt;
659 let Inst{12-6} = funct;
660 let Inst{5-0} = 0b111011;
663 class POOL32F_ABS_FM_MMR6<string instr_asm, bits<2> fmt, bits<7> funct>
664 : MMR6Arch<instr_asm>, MipsR6Inst {
670 let Inst{31-26} = 0b010101;
671 let Inst{25-21} = ft;
672 let Inst{20-16} = fs;
674 let Inst{14-13} = fmt;
675 let Inst{12-6} = funct;
676 let Inst{5-0} = 0b111011;
679 class POOL32F_MATH_FM_MMR6<string instr_asm, bits<1> fmt, bits<8> funct>
680 : MMR6Arch<instr_asm>, MipsR6Inst {
686 let Inst{31-26} = 0b010101;
687 let Inst{25-21} = ft;
688 let Inst{20-16} = fs;
691 let Inst{13-6} = funct;
692 let Inst{5-0} = 0b111011;
695 class POOL16A_ADDU16_FM_MMR6 {
702 let Inst{15-10} = 0b000001;
709 class POOL16C_AND16_FM_MMR6 {
715 let Inst{15-10} = 0b010001;
718 let Inst{3-0} = 0b0001;
721 class POOL16C_NOT16_FM_MMR6 {
727 let Inst{15-10} = 0x11;
730 let Inst{3-0} = 0b0000;
733 class POOL16C_MOVEP16_FM_MMR6 {
740 let Inst{15-10} = 0b010001;
741 let Inst{9-7} = dst_regs;
745 let Inst{1-0} = rs{1-0};
748 class POOL16C_OR16_XOR16_FM_MMR6<bits<4> op> {
754 let Inst{15-10} = 0b010001;
760 class POOL16C_BREAKPOINT_FM_MMR6<bits<6> op> {
764 let Inst{15-10} = 0b010001;
765 let Inst{9-6} = code_;
769 class POOL16A_SUBU16_FM_MMR6 {
776 let Inst{15-10} = 0b000001;
783 class POOL32A_WRPGPR_WSBH_FM_MMR6<string instr_asm, bits<10> funct>
784 : MMR6Arch<instr_asm>, MipsR6Inst {
790 let Inst{31-26} = 0x00;
791 let Inst{25-21} = rt;
792 let Inst{20-16} = rs;
793 let Inst{15-6} = funct;
794 let Inst{5-0} = 0x3c;
797 class POOL32F_RECIP_ROUND_FM_MMR6<string instr_asm, bits<1> fmt, bits<8> funct>
798 : MMR6Arch<instr_asm>, MipsR6Inst {
804 let Inst{31-26} = 0b010101;
805 let Inst{25-21} = ft;
806 let Inst{20-16} = fs;
809 let Inst{13-6} = funct;
810 let Inst{5-0} = 0b111011;
813 class POOL32F_RINT_FM_MMR6<string instr_asm, bits<2> fmt>
814 : MMR6Arch<instr_asm>, MipsR6Inst {
820 let Inst{31-26} = 0b010101;
821 let Inst{25-21} = fs;
822 let Inst{20-16} = fd;
824 let Inst{10-9} = fmt;
825 let Inst{8-0} = 0b000100000;
828 class POOL32F_SEL_FM_MMR6<string instr_asm, bits<2> fmt, bits<9> funct>
829 : MMR6Arch<instr_asm>, MipsR6Inst {
836 let Inst{31-26} = 0b010101;
837 let Inst{25-21} = ft;
838 let Inst{20-16} = fs;
839 let Inst{15-11} = fd;
840 let Inst{10-9} = fmt;
841 let Inst{8-0} = funct;
844 class POOL32F_CLASS_FM_MMR6<string instr_asm, bits<2> fmt, bits<9> funct>
845 : MMR6Arch<instr_asm>, MipsR6Inst {
851 let Inst{31-26} = 0b010101;
852 let Inst{25-21} = fs;
853 let Inst{20-16} = fd;
854 let Inst{15-11} = 0b00000;
855 let Inst{10-9} = fmt;
856 let Inst{8-0} = funct;
859 class POOL32A_TLBINV_FM_MMR6<string instr_asm, bits<10> funct>
860 : MMR6Arch<instr_asm>, MipsR6Inst {
863 let Inst{31-26} = 0x0;
864 let Inst{25-16} = 0x0;
865 let Inst{15-6} = funct;
866 let Inst{5-0} = 0b111100;
869 class POOL32A_MFTC0_FM_MMR6<string instr_asm, bits<5> funct, bits<6> opcode>
870 : MMR6Arch<instr_asm>, MipsR6Inst {
877 let Inst{31-26} = 0b000000;
878 let Inst{25-21} = rt;
879 let Inst{20-16} = rs;
881 let Inst{13-11} = sel;
882 let Inst{10-6} = funct;
883 let Inst{5-0} = opcode;
886 class POOL32A_GINV_FM_MMR6<string instr_asm, bits<2> ginv>
887 : MMR6Arch<instr_asm>, MipsR6Inst {
893 let Inst{31-26} = 0x0;
894 let Inst{25-21} = 0x0;
895 let Inst{20-16} = rs;
896 let Inst{15-13} = 0b011;
897 let Inst{12-11} = ginv;
898 let Inst{10-9} = type;
899 let Inst{8-6} = 0b101;
900 let Inst{5-0} = 0b111100;
903 class POOL32F_MFTC1_FM_MMR6<string instr_asm, bits<8> funct>
904 : MMR6Arch<instr_asm> {
910 let Inst{31-26} = 0b010101;
911 let Inst{25-21} = rt;
912 let Inst{20-16} = fs;
914 let Inst{13-6} = funct;
915 let Inst{5-0} = 0b111011;
918 class POOL32A_MFTC2_FM_MMR6<string instr_asm, bits<10> funct>
919 : MMR6Arch<instr_asm>, MipsR6Inst {
925 let Inst{31-26} = 0b000000;
926 let Inst{25-21} = rt;
927 let Inst{20-16} = impl;
928 let Inst{15-6} = funct;
929 let Inst{5-0} = 0b111100;
932 class CMP_BRANCH_2R_OFF16_FM_MMR6<string opstr, bits<6> funct>
933 : MipsR6Inst, MMR6Arch<opstr> {
940 let Inst{31-26} = funct;
941 let Inst{25-21} = rt;
942 let Inst{20-16} = rs;
943 let Inst{15-0} = offset;
946 class POOL32A_DVPEVP_FM_MMR6<string instr_asm, bits<10> funct>
947 : MMR6Arch<instr_asm>, MipsR6Inst {
952 let Inst{31-26} = 0b000000;
953 let Inst{25-21} = 0b00000;
954 let Inst{20-16} = rs;
955 let Inst{15-6} = funct;
956 let Inst{5-0} = 0b111100;
959 class CMP_BRANCH_OFF21_FM_MMR6<string opstr, bits<6> funct> : MipsR6Inst {
965 let Inst{31-26} = funct;
966 let Inst{25-21} = rs;
967 let Inst{20-0} = offset;
970 class POOL32I_BRANCH_COP_1_2_FM_MMR6<string instr_asm, bits<5> funct>
971 : MMR6Arch<instr_asm> {
977 let Inst{31-26} = 0b010000;
978 let Inst{25-21} = funct;
979 let Inst{20-16} = rt;
980 let Inst{15-0} = offset;
983 class LDWC1_SDWC1_FM_MMR6<string instr_asm, bits<6> funct>
984 : MMR6Arch<instr_asm> {
987 bits<5> base = addr{20-16};
988 bits<16> offset = addr{15-0};
992 let Inst{31-26} = funct;
993 let Inst{25-21} = ft;
994 let Inst{20-16} = base;
995 let Inst{15-0} = offset;
998 class POOL32B_LDWC2_SDWC2_FM_MMR6<string instr_asm, bits<4> funct>
999 : MMR6Arch<instr_asm>, MipsR6Inst {
1002 bits<5> base = addr{20-16};
1003 bits<11> offset = addr{10-0};
1007 let Inst{31-26} = 0b001000;
1008 let Inst{25-21} = rt;
1009 let Inst{20-16} = base;
1010 let Inst{15-12} = funct;
1012 let Inst{10-0} = offset;
1015 class POOL32C_LL_E_SC_E_FM_MMR6<string instr_asm, bits<4> majorFunc,
1017 : MMR6Arch<instr_asm>, MipsR6Inst {
1020 bits<5> base = addr{20-16};
1021 bits<9> offset = addr{8-0};
1025 let Inst{31-26} = 0b011000;
1026 let Inst{25-21} = rt;
1027 let Inst{20-16} = base;
1028 let Inst{15-12} = majorFunc;
1029 let Inst{11-9} = minorFunc;
1030 let Inst{8-0} = offset;