]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Target/Mips/MicroMips32r6InstrInfo.td
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / Target / Mips / MicroMips32r6InstrInfo.td
1 //=- MicroMips32r6InstrInfo.td - MicroMips r6 Instruction Information -*- tablegen -*-=//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file describes microMIPSr6 instructions.
11 //
12 //===----------------------------------------------------------------------===//
13
14 def brtarget21_mm : Operand<OtherVT> {
15   let EncoderMethod = "getBranchTarget21OpValueMM";
16   let OperandType = "OPERAND_PCREL";
17   let DecoderMethod = "DecodeBranchTarget21MM";
18   let ParserMatchClass = MipsJumpTargetAsmOperand;
19 }
20
21 def brtarget26_mm : Operand<OtherVT> {
22   let EncoderMethod = "getBranchTarget26OpValueMM";
23   let OperandType = "OPERAND_PCREL";
24   let DecoderMethod = "DecodeBranchTarget26MM";
25   let ParserMatchClass = MipsJumpTargetAsmOperand;
26 }
27
28 def brtargetr6 : Operand<OtherVT> {
29   let EncoderMethod = "getBranchTargetOpValueMMR6";
30   let OperandType = "OPERAND_PCREL";
31   let DecoderMethod = "DecodeBranchTargetMM";
32   let ParserMatchClass = MipsJumpTargetAsmOperand;
33 }
34
35 def brtarget_lsl2_mm : Operand<OtherVT> {
36   let EncoderMethod = "getBranchTargetOpValueLsl2MMR6";
37   let OperandType = "OPERAND_PCREL";
38   // Instructions that use this operand have their decoder method
39   // set with DecodeDisambiguates
40   let DecoderMethod = "";
41   let ParserMatchClass = MipsJumpTargetAsmOperand;
42 }
43
44 //===----------------------------------------------------------------------===//
45 //
46 // Instruction Encodings
47 //
48 //===----------------------------------------------------------------------===//
49 class ADD_MMR6_ENC : ARITH_FM_MMR6<"add", 0x110>;
50 class ADDIU_MMR6_ENC : ADDI_FM_MMR6<"addiu", 0xc>;
51 class ADDU_MMR6_ENC : ARITH_FM_MMR6<"addu", 0x150>;
52 class ADDIUPC_MMR6_ENC : PCREL19_FM_MMR6<0b00>;
53 class ALUIPC_MMR6_ENC : PCREL16_FM_MMR6<0b11111>;
54 class AND_MMR6_ENC : ARITH_FM_MMR6<"and", 0x250>;
55 class ANDI_MMR6_ENC : ADDI_FM_MMR6<"andi", 0x34>;
56 class AUIPC_MMR6_ENC  : PCREL16_FM_MMR6<0b11110>;
57 class ALIGN_MMR6_ENC : POOL32A_ALIGN_FM_MMR6<0b011111>;
58 class AUI_MMR6_ENC : AUI_FM_MMR6;
59 class BALC_MMR6_ENC  : BRANCH_OFF26_FM<0b101101>;
60 class BC_MMR6_ENC : BRANCH_OFF26_FM<0b100101>;
61 class BC16_MMR6_ENC : BC16_FM_MM16R6;
62 class BEQZC16_MMR6_ENC : BEQZC_BNEZC_FM_MM16R6<0x23>;
63 class BNEZC16_MMR6_ENC : BEQZC_BNEZC_FM_MM16R6<0x2b>;
64 class BITSWAP_MMR6_ENC : POOL32A_BITSWAP_FM_MMR6<0b101100>;
65 class BRK_MMR6_ENC : BREAK_MMR6_ENC<"break">;
66 class BEQZC_MMR6_ENC : CMP_BRANCH_OFF21_FM_MMR6<"beqzc", 0b100000>;
67 class BNEZC_MMR6_ENC : CMP_BRANCH_OFF21_FM_MMR6<"bnezc", 0b101000>;
68 class BGEC_MMR6_ENC : CMP_BRANCH_2R_OFF16_FM_MMR6<"bgec", 0b111101>,
69                       DecodeDisambiguates<"POP75GroupBranchMMR6">;
70 class BGEUC_MMR6_ENC : CMP_BRANCH_2R_OFF16_FM_MMR6<"bgeuc", 0b110000>,
71                        DecodeDisambiguates<"BlezGroupBranchMMR6">;
72 class BLTC_MMR6_ENC : CMP_BRANCH_2R_OFF16_FM_MMR6<"bltc", 0b110101>,
73                       DecodeDisambiguates<"POP65GroupBranchMMR6">;
74 class BLTUC_MMR6_ENC : CMP_BRANCH_2R_OFF16_FM_MMR6<"bltuc", 0b111000>,
75                        DecodeDisambiguates<"BgtzGroupBranchMMR6">;
76 class BEQC_MMR6_ENC : CMP_BRANCH_2R_OFF16_FM_MMR6<"beqc", 0b011101>;
77 class BNEC_MMR6_ENC : CMP_BRANCH_2R_OFF16_FM_MMR6<"bnec", 0b011111>;
78 class BLTZC_MMR6_ENC : CMP_BRANCH_1R_BOTH_OFF16_FM_MMR6<"bltzc", 0b110101>,
79                        DecodeDisambiguates<"POP65GroupBranchMMR6">;
80 class BLEZC_MMR6_ENC : CMP_BRANCH_1R_RT_OFF16_FM_MMR6<"blezc", 0b111101>,
81                        DecodeDisambiguates<"POP75GroupBranchMMR6">;
82 class BGEZC_MMR6_ENC : CMP_BRANCH_1R_BOTH_OFF16_FM_MMR6<"bgezc", 0b111101>,
83                        DecodeDisambiguates<"POP75GroupBranchMMR6">;
84 class BGTZC_MMR6_ENC : CMP_BRANCH_1R_RT_OFF16_FM_MMR6<"bgtzc", 0b110101>,
85                        DecodeDisambiguates<"POP65GroupBranchMMR6">;
86 class BEQZALC_MMR6_ENC : CMP_BRANCH_1R_RT_OFF16_FM_MMR6<"beqzalc", 0b011101>,
87                          DecodeDisambiguates<"POP35GroupBranchMMR6">;
88 class BNEZALC_MMR6_ENC : CMP_BRANCH_1R_RT_OFF16_FM_MMR6<"bnezalc", 0b011111>,
89                          DecodeDisambiguates<"POP37GroupBranchMMR6">;
90 class BGTZALC_MMR6_ENC : CMP_BRANCH_1R_RT_OFF16_FM_MMR6<"bgtzalc", 0b111000>,
91                          MMDecodeDisambiguatedBy<"BgtzGroupBranchMMR6">;
92 class BLTZALC_MMR6_ENC : CMP_BRANCH_1R_BOTH_OFF16_FM_MMR6<"bltzalc", 0b111000>,
93                          MMDecodeDisambiguatedBy<"BgtzGroupBranchMMR6">;
94 class BGEZALC_MMR6_ENC : CMP_BRANCH_1R_BOTH_OFF16_FM_MMR6<"bgezalc", 0b110000>,
95                          MMDecodeDisambiguatedBy<"BlezGroupBranchMMR6">;
96 class BLEZALC_MMR6_ENC : CMP_BRANCH_1R_RT_OFF16_FM_MMR6<"blezalc", 0b110000>,
97                          MMDecodeDisambiguatedBy<"BlezGroupBranchMMR6">;
98 class CACHE_MMR6_ENC : CACHE_PREF_FM_MMR6<0b001000, 0b0110>;
99 class CLO_MMR6_ENC : POOL32A_2R_FM_MMR6<0b0100101100>;
100 class CLZ_MMR6_ENC : SPECIAL_2R_FM_MMR6<0b010000>;
101 class DIV_MMR6_ENC : ARITH_FM_MMR6<"div", 0x118>;
102 class DIVU_MMR6_ENC : ARITH_FM_MMR6<"divu", 0x198>;
103 class EHB_MMR6_ENC : BARRIER_MMR6_ENC<"ehb", 0x3>;
104 class EI_MMR6_ENC : POOL32A_EIDI_MMR6_ENC<"ei", 0x15d>;
105 class DI_MMR6_ENC : POOL32A_EIDI_MMR6_ENC<"di", 0b0100011101>;
106 class ERET_MMR6_ENC : POOL32A_ERET_FM_MMR6<"eret", 0x3cd>;
107 class DERET_MMR6_ENC : POOL32A_ERET_FM_MMR6<"eret", 0b1110001101>;
108 class ERETNC_MMR6_ENC : ERETNC_FM_MMR6<"eretnc">;
109 class GINVI_MMR6_ENC : POOL32A_GINV_FM_MMR6<"ginvi", 0b00>;
110 class GINVT_MMR6_ENC : POOL32A_GINV_FM_MMR6<"ginvt", 0b10>;
111 class JALRC16_MMR6_ENC : POOL16C_JALRC_FM_MM16R6<0xb>;
112 class JIALC_MMR6_ENC : JMP_IDX_COMPACT_FM<0b100000>;
113 class JIC_MMR6_ENC   : JMP_IDX_COMPACT_FM<0b101000>;
114 class JRC16_MMR6_ENC: POOL16C_JALRC_FM_MM16R6<0x3>;
115 class JRCADDIUSP_MMR6_ENC : POOL16C_JRCADDIUSP_FM_MM16R6<0x13>;
116 class LSA_MMR6_ENC : POOL32A_LSA_FM<0b001111>;
117 class LWPC_MMR6_ENC  : PCREL19_FM_MMR6<0b01>;
118 class LWM16_MMR6_ENC : POOL16C_LWM_SWM_FM_MM16R6<0x2>;
119 class MFC0_MMR6_ENC : POOL32A_MFTC0_FM_MMR6<"mfc0", 0b00011, 0b111100>;
120 class MFC1_MMR6_ENC : POOL32F_MFTC1_FM_MMR6<"mfc1", 0b10000000>;
121 class MFC2_MMR6_ENC : POOL32A_MFTC2_FM_MMR6<"mfc2", 0b0100110100>;
122 class MFHC0_MMR6_ENC : POOL32A_MFTC0_FM_MMR6<"mfhc0", 0b00011, 0b110100>;
123 class MFHC2_MMR6_ENC : POOL32A_MFTC2_FM_MMR6<"mfhc2", 0b1000110100>;
124 class MOD_MMR6_ENC : ARITH_FM_MMR6<"mod", 0x158>;
125 class MODU_MMR6_ENC : ARITH_FM_MMR6<"modu", 0x1d8>;
126 class MUL_MMR6_ENC : ARITH_FM_MMR6<"mul", 0x18>;
127 class MUH_MMR6_ENC : ARITH_FM_MMR6<"muh", 0x58>;
128 class MULU_MMR6_ENC : ARITH_FM_MMR6<"mulu", 0x98>;
129 class MUHU_MMR6_ENC : ARITH_FM_MMR6<"muhu", 0xd8>;
130 class MTC0_MMR6_ENC : POOL32A_MFTC0_FM_MMR6<"mtc0", 0b01011, 0b111100>;
131 class MTC1_MMR6_ENC : POOL32F_MFTC1_FM_MMR6<"mtc1", 0b10100000>;
132 class MTC2_MMR6_ENC : POOL32A_MFTC2_FM_MMR6<"mtc2", 0b0101110100>;
133 class MTHC0_MMR6_ENC : POOL32A_MFTC0_FM_MMR6<"mthc0", 0b01011, 0b110100>;
134 class MTHC2_MMR6_ENC : POOL32A_MFTC2_FM_MMR6<"mthc2", 0b1001110100>;
135 class NOR_MMR6_ENC : ARITH_FM_MMR6<"nor", 0x2d0>;
136 class OR_MMR6_ENC : ARITH_FM_MMR6<"or", 0x290>;
137 class ORI_MMR6_ENC : ADDI_FM_MMR6<"ori", 0x14>;
138 class PREF_MMR6_ENC : CACHE_PREF_FM_MMR6<0b011000, 0b0010>;
139 class SB16_MMR6_ENC : LOAD_STORE_FM_MM16<0x22>;
140 class SELEQZ_MMR6_ENC : POOL32A_FM_MMR6<0b0101000000>;
141 class SELNEZ_MMR6_ENC : POOL32A_FM_MMR6<0b0110000000>;
142 class SH16_MMR6_ENC : LOAD_STORE_FM_MM16<0x2a>;
143 class SLL_MMR6_ENC : SHIFT_MMR6_ENC<"sll", 0x00, 0b0>;
144 class SUB_MMR6_ENC : ARITH_FM_MMR6<"sub", 0x190>;
145 class SUBU_MMR6_ENC : ARITH_FM_MMR6<"subu", 0x1d0>;
146 class SW_MMR6_ENC : SW32_FM_MMR6<"sw", 0x3e>;
147 class SW16_MMR6_ENC : LOAD_STORE_FM_MM16<0x3a>;
148 class SWM16_MMR6_ENC : POOL16C_LWM_SWM_FM_MM16R6<0xa>;
149 class SWSP_MMR6_ENC : LOAD_STORE_SP_FM_MM16<0x32>;
150 class WRPGPR_MMR6_ENC : POOL32A_WRPGPR_WSBH_FM_MMR6<"wrpgpr", 0x3c5>;
151 class WSBH_MMR6_ENC : POOL32A_WRPGPR_WSBH_FM_MMR6<"wsbh", 0x1ec>;
152 class LB_MMR6_ENC : LB32_FM_MMR6;
153 class LBU_MMR6_ENC : LBU32_FM_MMR6;
154 class PAUSE_MMR6_ENC : POOL32A_PAUSE_FM_MMR6<"pause", 0b00101>;
155 class RDHWR_MMR6_ENC : POOL32A_RDHWR_FM_MMR6;
156 class WAIT_MMR6_ENC : WAIT_FM_MM, MMR6Arch<"wait">;
157 class SSNOP_MMR6_ENC : BARRIER_FM_MM<0x1>, MMR6Arch<"ssnop">;
158 class SYNC_MMR6_ENC : POOL32A_SYNC_FM_MMR6;
159 class SYNCI_MMR6_ENC : POOL32I_SYNCI_FM_MMR6, MMR6Arch<"synci">;
160 class RDPGPR_MMR6_ENC : POOL32A_RDPGPR_FM_MMR6<0b1110000101>;
161 class SDBBP_MMR6_ENC : SDBBP_FM_MM, MMR6Arch<"sdbbp">;
162 class SIGRIE_MMR6_ENC : SIGRIE_FM_MM, MMR6Arch<"sigrie">;
163 class XOR_MMR6_ENC : ARITH_FM_MMR6<"xor", 0x310>;
164 class XORI_MMR6_ENC : ADDI_FM_MMR6<"xori", 0x1c>;
165 class ABS_S_MMR6_ENC : POOL32F_ABS_FM_MMR6<"abs.s", 0, 0b0001101>;
166 class ABS_D_MMR6_ENC : POOL32F_ABS_FM_MMR6<"abs.d", 1, 0b0001101>;
167 class FLOOR_L_S_MMR6_ENC : POOL32F_MATH_FM_MMR6<"floor.l.s", 0, 0b00001100>;
168 class FLOOR_L_D_MMR6_ENC : POOL32F_MATH_FM_MMR6<"floor.l.d", 1, 0b00001100>;
169 class FLOOR_W_S_MMR6_ENC : POOL32F_MATH_FM_MMR6<"floor.w.s", 0, 0b00101100>;
170 class FLOOR_W_D_MMR6_ENC : POOL32F_MATH_FM_MMR6<"floor.w.d", 1, 0b00101100>;
171 class CEIL_L_S_MMR6_ENC : POOL32F_MATH_FM_MMR6<"ceil.l.s", 0, 0b01001100>;
172 class CEIL_L_D_MMR6_ENC : POOL32F_MATH_FM_MMR6<"ceil.l.d", 1, 0b01001100>;
173 class CEIL_W_S_MMR6_ENC : POOL32F_MATH_FM_MMR6<"ceil.w.s", 0, 0b01101100>;
174 class CEIL_W_D_MMR6_ENC : POOL32F_MATH_FM_MMR6<"ceil.w.d", 1, 0b01101100>;
175 class TRUNC_L_S_MMR6_ENC : POOL32F_MATH_FM_MMR6<"trunc.l.s", 0, 0b10001100>;
176 class TRUNC_L_D_MMR6_ENC : POOL32F_MATH_FM_MMR6<"trunc.l.d", 1, 0b10001100>;
177 class TRUNC_W_S_MMR6_ENC : POOL32F_MATH_FM_MMR6<"trunc.w.s", 0, 0b10101100>;
178 class TRUNC_W_D_MMR6_ENC : POOL32F_MATH_FM_MMR6<"trunc.w.d", 1, 0b10101100>;
179 class SB_MMR6_ENC : SB32_SH32_STORE_FM_MMR6<0b000110>;
180 class SH_MMR6_ENC : SB32_SH32_STORE_FM_MMR6<0b001110>;
181 class LW_MMR6_ENC : LOAD_WORD_FM_MMR6;
182 class LUI_MMR6_ENC : LOAD_UPPER_IMM_FM_MMR6;
183 class JALRC_HB_MMR6_ENC : POOL32A_JALRC_FM_MMR6<"jalrc.hb", 0b0001111100>;
184 class RINT_S_MMR6_ENC : POOL32F_RINT_FM_MMR6<"rint.s", 0>;
185 class RINT_D_MMR6_ENC : POOL32F_RINT_FM_MMR6<"rint.d", 1>;
186 class ROUND_L_S_MMR6_ENC : POOL32F_RECIP_ROUND_FM_MMR6<"round.l.s", 0,
187                                                        0b11001100>;
188 class ROUND_L_D_MMR6_ENC : POOL32F_RECIP_ROUND_FM_MMR6<"round.l.d", 1,
189                                                        0b11001100>;
190 class ROUND_W_S_MMR6_ENC : POOL32F_RECIP_ROUND_FM_MMR6<"round.w.s", 0,
191                                                        0b11101100>;
192 class ROUND_W_D_MMR6_ENC : POOL32F_RECIP_ROUND_FM_MMR6<"round.w.d", 1,
193                                                        0b11101100>;
194 class SEL_S_MMR6_ENC : POOL32F_SEL_FM_MMR6<"sel.s", 0, 0b010111000>;
195 class SEL_D_MMR6_ENC : POOL32F_SEL_FM_MMR6<"sel.d", 1, 0b010111000>;
196 class SELEQZ_S_MMR6_ENC : POOL32F_SEL_FM_MMR6<"seleqz.s", 0, 0b000111000>;
197 class SELEQZ_D_MMR6_ENC : POOL32F_SEL_FM_MMR6<"seleqz.d", 1, 0b000111000>;
198 class SELNEZ_S_MMR6_ENC : POOL32F_SEL_FM_MMR6<"selnez.s", 0, 0b001111000>;
199 class SELNEZ_D_MMR6_ENC : POOL32F_SEL_FM_MMR6<"selnez.d", 1, 0b001111000>;
200 class CLASS_S_MMR6_ENC : POOL32F_CLASS_FM_MMR6<"class.s", 0, 0b001100000>;
201 class CLASS_D_MMR6_ENC : POOL32F_CLASS_FM_MMR6<"class.d", 1, 0b001100000>;
202 class EXT_MMR6_ENC : POOL32A_EXT_INS_FM_MMR6<"ext", 0b101100>;
203 class INS_MMR6_ENC : POOL32A_EXT_INS_FM_MMR6<"ins", 0b001100>;
204 class JALRC_MMR6_ENC : POOL32A_JALRC_FM_MMR6<"jalrc", 0b0000111100>;
205 class BOVC_MMR6_ENC : POP35_BOVC_FM_MMR6<"bovc">;
206 class BNVC_MMR6_ENC : POP37_BNVC_FM_MMR6<"bnvc">;
207 class ADDU16_MMR6_ENC : POOL16A_ADDU16_FM_MMR6;
208 class AND16_MMR6_ENC : POOL16C_AND16_FM_MMR6;
209 class ANDI16_MMR6_ENC : ANDI_FM_MM16<0b001011>;
210 class NOT16_MMR6_ENC : POOL16C_NOT16_FM_MMR6;
211 class OR16_MMR6_ENC : POOL16C_OR16_XOR16_FM_MMR6<0b1001>;
212 class SLL16_MMR6_ENC : SHIFT_FM_MM16<0>;
213 class SRL16_MMR6_ENC : SHIFT_FM_MM16<1>;
214 class BREAK16_MMR6_ENC : POOL16C_BREAKPOINT_FM_MMR6<0b011011>;
215 class LI16_MMR6_ENC : LI_FM_MM16;
216 class MOVE16_MMR6_ENC : MOVE_FM_MM16<0b000011>;
217 class MOVEP_MMR6_ENC  : POOL16C_MOVEP16_FM_MMR6;
218 class SDBBP16_MMR6_ENC : POOL16C_BREAKPOINT_FM_MMR6<0b111011>;
219 class SUBU16_MMR6_ENC : POOL16A_SUBU16_FM_MMR6;
220 class XOR16_MMR6_ENC : POOL16C_OR16_XOR16_FM_MMR6<0b1000>;
221 class TLBINV_MMR6_ENC : POOL32A_TLBINV_FM_MMR6<"tlbinv", 0x10d>;
222 class TLBINVF_MMR6_ENC : POOL32A_TLBINV_FM_MMR6<"tlbinvf", 0x14d>;
223 class DVP_MMR6_ENC : POOL32A_DVPEVP_FM_MMR6<"dvp", 0b0001100101>;
224 class EVP_MMR6_ENC : POOL32A_DVPEVP_FM_MMR6<"evp", 0b0011100101>;
225 class BC1EQZC_MMR6_ENC : POOL32I_BRANCH_COP_1_2_FM_MMR6<"bc1eqzc", 0b01000>;
226 class BC1NEZC_MMR6_ENC : POOL32I_BRANCH_COP_1_2_FM_MMR6<"bc1nezc", 0b01001>;
227 class BC2EQZC_MMR6_ENC : POOL32I_BRANCH_COP_1_2_FM_MMR6<"bc2eqzc", 0b01010>;
228 class BC2NEZC_MMR6_ENC : POOL32I_BRANCH_COP_1_2_FM_MMR6<"bc2nezc", 0b01011>;
229 class LDC1_MMR6_ENC : LDWC1_SDWC1_FM_MMR6<"ldc1", 0b101111>;
230 class SDC1_MMR6_ENC : LDWC1_SDWC1_FM_MMR6<"sdc1", 0b101110>;
231 class LDC2_MMR6_ENC : POOL32B_LDWC2_SDWC2_FM_MMR6<"ldc2", 0b0010>;
232 class SDC2_MMR6_ENC : POOL32B_LDWC2_SDWC2_FM_MMR6<"sdc2", 0b1010>;
233 class LWC2_MMR6_ENC : POOL32B_LDWC2_SDWC2_FM_MMR6<"lwc2", 0b0000>;
234 class SWC2_MMR6_ENC : POOL32B_LDWC2_SDWC2_FM_MMR6<"swc2", 0b1000>;
235
236 class LL_MMR6_ENC  : POOL32C_LL_E_SC_E_FM_MMR6<"ll", 0b0011, 0b000>;
237 class SC_MMR6_ENC  : POOL32C_LL_E_SC_E_FM_MMR6<"sc", 0b1011, 0b000>;
238
239 /// Floating Point Instructions
240 class FADD_S_MMR6_ENC : POOL32F_ARITH_FM_MMR6<"add.s", 0, 0b00110000>;
241 class FSUB_S_MMR6_ENC : POOL32F_ARITH_FM_MMR6<"sub.s", 0, 0b01110000>;
242 class FMUL_S_MMR6_ENC : POOL32F_ARITH_FM_MMR6<"mul.s", 0, 0b10110000>;
243 class FDIV_S_MMR6_ENC : POOL32F_ARITH_FM_MMR6<"div.s", 0, 0b11110000>;
244 class MADDF_S_MMR6_ENC : POOL32F_ARITHF_FM_MMR6<"maddf.s", 0, 0b110111000>;
245 class MADDF_D_MMR6_ENC : POOL32F_ARITHF_FM_MMR6<"maddf.d", 1, 0b110111000>;
246 class MSUBF_S_MMR6_ENC : POOL32F_ARITHF_FM_MMR6<"msubf.s", 0, 0b111111000>;
247 class MSUBF_D_MMR6_ENC : POOL32F_ARITHF_FM_MMR6<"msubf.d", 1, 0b111111000>;
248 class FMOV_S_MMR6_ENC : POOL32F_MOV_NEG_FM_MMR6<"mov.s", 0, 0b0000001>;
249 class FNEG_S_MMR6_ENC : POOL32F_MOV_NEG_FM_MMR6<"neg.s", 0, 0b0101101>;
250 class MAX_S_MMR6_ENC : POOL32F_MINMAX_FM<"max.s", 0, 0b000001011>;
251 class MAX_D_MMR6_ENC : POOL32F_MINMAX_FM<"max.d", 1, 0b000001011>;
252 class MAXA_S_MMR6_ENC : POOL32F_MINMAX_FM<"maxa.s", 0, 0b000101011>;
253 class MAXA_D_MMR6_ENC : POOL32F_MINMAX_FM<"maxa.d", 1, 0b000101011>;
254 class MIN_S_MMR6_ENC : POOL32F_MINMAX_FM<"min.s", 0, 0b000000011>;
255 class MIN_D_MMR6_ENC : POOL32F_MINMAX_FM<"min.d", 1, 0b000000011>;
256 class MINA_S_MMR6_ENC : POOL32F_MINMAX_FM<"mina.s", 0, 0b000100011>;
257 class MINA_D_MMR6_ENC : POOL32F_MINMAX_FM<"mina.d", 1, 0b000100011>;
258
259 class CVT_L_S_MMR6_ENC : POOL32F_CVT_LW_FM<"cvt.l.s", 0, 0b00000100>;
260 class CVT_L_D_MMR6_ENC : POOL32F_CVT_LW_FM<"cvt.l.d", 1, 0b00000100>;
261 class CVT_W_S_MMR6_ENC : POOL32F_CVT_LW_FM<"cvt.w.s", 0, 0b00100100>;
262 class CVT_D_L_MMR6_ENC : POOL32F_CVT_DS_FM<"cvt.d.l", 2, 0b1001101>;
263 class CVT_S_W_MMR6_ENC : POOL32F_CVT_DS_FM<"cvt.s.w", 1, 0b1101101>;
264 class CVT_S_L_MMR6_ENC : POOL32F_CVT_DS_FM<"cvt.s.l", 2, 0b1101101>;
265
266 //===----------------------------------------------------------------------===//
267 //
268 // Instruction Descriptions
269 //
270 //===----------------------------------------------------------------------===//
271
272 class CMP_CBR_RT_Z_MMR6_DESC_BASE<string instr_asm, DAGOperand opnd,
273                                   RegisterOperand GPROpnd>
274     : BRANCH_DESC_BASE {
275   dag InOperandList = (ins GPROpnd:$rt, opnd:$offset);
276   dag OutOperandList = (outs);
277   string AsmString = !strconcat(instr_asm, "\t$rt, $offset");
278   list<Register> Defs = [AT];
279   InstrItinClass Itinerary = II_BCCZC;
280 }
281
282 class BEQZALC_MMR6_DESC : CMP_CBR_RT_Z_MMR6_DESC_BASE<"beqzalc", brtarget_mm,
283                                                       GPR32Opnd> {
284   list<Register> Defs = [RA];
285 }
286
287 class BGEZALC_MMR6_DESC : CMP_CBR_RT_Z_MMR6_DESC_BASE<"bgezalc", brtarget_mm,
288                                                       GPR32Opnd> {
289   list<Register> Defs = [RA];
290 }
291
292 class BGTZALC_MMR6_DESC : CMP_CBR_RT_Z_MMR6_DESC_BASE<"bgtzalc", brtarget_mm,
293                                                       GPR32Opnd> {
294   list<Register> Defs = [RA];
295 }
296
297 class BLEZALC_MMR6_DESC : CMP_CBR_RT_Z_MMR6_DESC_BASE<"blezalc", brtarget_mm,
298                                                       GPR32Opnd> {
299   list<Register> Defs = [RA];
300 }
301
302 class BLTZALC_MMR6_DESC : CMP_CBR_RT_Z_MMR6_DESC_BASE<"bltzalc", brtarget_mm,
303                                                       GPR32Opnd> {
304   list<Register> Defs = [RA];
305 }
306
307 class BNEZALC_MMR6_DESC : CMP_CBR_RT_Z_MMR6_DESC_BASE<"bnezalc", brtarget_mm,
308                                                       GPR32Opnd> {
309   list<Register> Defs = [RA];
310 }
311
312 class BLTZC_MMR6_DESC : CMP_CBR_RT_Z_MMR6_DESC_BASE<"bltzc", brtarget_lsl2_mm,
313                                                     GPR32Opnd>;
314 class BLEZC_MMR6_DESC : CMP_CBR_RT_Z_MMR6_DESC_BASE<"blezc", brtarget_lsl2_mm,
315                                                     GPR32Opnd>;
316 class BGEZC_MMR6_DESC : CMP_CBR_RT_Z_MMR6_DESC_BASE<"bgezc", brtarget_lsl2_mm,
317                                                     GPR32Opnd>;
318 class BGTZC_MMR6_DESC : CMP_CBR_RT_Z_MMR6_DESC_BASE<"bgtzc", brtarget_lsl2_mm,
319                                                     GPR32Opnd>;
320
321 class CMP_CBR_2R_MMR6_DESC_BASE<string instr_asm, DAGOperand opnd,
322                                 RegisterOperand GPROpnd> : BRANCH_DESC_BASE {
323   dag InOperandList = (ins GPROpnd:$rs, GPROpnd:$rt, opnd:$offset);
324   dag OutOperandList = (outs);
325   string AsmString = !strconcat(instr_asm, "\t$rs, $rt, $offset");
326   list<Register> Defs = [AT];
327   InstrItinClass Itinerary = II_BCCC;
328 }
329
330 class BGEC_MMR6_DESC : CMP_CBR_2R_MMR6_DESC_BASE<"bgec", brtarget_lsl2_mm,
331                                                  GPR32Opnd>;
332 class BGEUC_MMR6_DESC : CMP_CBR_2R_MMR6_DESC_BASE<"bgeuc", brtarget_lsl2_mm,
333                                                  GPR32Opnd>;
334 class BLTC_MMR6_DESC : CMP_CBR_2R_MMR6_DESC_BASE<"bltc", brtarget_lsl2_mm,
335                                                  GPR32Opnd>;
336 class BLTUC_MMR6_DESC : CMP_CBR_2R_MMR6_DESC_BASE<"bltuc", brtarget_lsl2_mm,
337                                                  GPR32Opnd>;
338 class BEQC_MMR6_DESC : CMP_CBR_2R_MMR6_DESC_BASE<"beqc", brtarget_lsl2_mm,
339                                                  GPR32Opnd>;
340 class BNEC_MMR6_DESC : CMP_CBR_2R_MMR6_DESC_BASE<"bnec", brtarget_lsl2_mm,
341                                                  GPR32Opnd>;
342
343 class ADD_MMR6_DESC : ArithLogicR<"add", GPR32Opnd, 1, II_ADD>;
344 class ADDIU_MMR6_DESC : ArithLogicI<"addiu", simm16, GPR32Opnd, II_ADDIU, immSExt16, add>;
345 class ADDU_MMR6_DESC : ArithLogicR<"addu", GPR32Opnd, 1, II_ADDU>;
346 class MUL_MMR6_DESC : ArithLogicR<"mul", GPR32Opnd, 1, II_MUL, mul>;
347 class MUH_MMR6_DESC : ArithLogicR<"muh", GPR32Opnd, 1, II_MUH, mulhs>;
348 class MULU_MMR6_DESC : ArithLogicR<"mulu", GPR32Opnd, 1, II_MULU>;
349 class MUHU_MMR6_DESC : ArithLogicR<"muhu", GPR32Opnd, 1, II_MUHU, mulhu>;
350
351 class BC_MMR6_DESC_BASE<string instr_asm, DAGOperand opnd, InstrItinClass Itin>
352     : BRANCH_DESC_BASE, MMR6Arch<instr_asm> {
353   dag InOperandList = (ins opnd:$offset);
354   dag OutOperandList = (outs);
355   string AsmString = !strconcat(instr_asm, "\t$offset");
356   bit isBarrier = 1;
357   InstrItinClass Itinerary = Itin;
358 }
359
360 class BALC_MMR6_DESC : BC_MMR6_DESC_BASE<"balc", brtarget26_mm, II_BALC> {
361   bit isCall = 1;
362   list<Register> Defs = [RA];
363 }
364 class BC_MMR6_DESC : BC_MMR6_DESC_BASE<"bc", brtarget26_mm, II_BC> {
365   list<dag> Pattern = [(br bb:$offset)];
366 }
367
368 class BC16_MMR6_DESC : MicroMipsInst16<(outs), (ins brtarget10_mm:$offset),
369                                        !strconcat("bc16", "\t$offset"), [],
370                                        II_BC, FrmI>,
371                        MMR6Arch<"bc16"> {
372   let isBranch = 1;
373   let isTerminator = 1;
374   let isBarrier = 1;
375   let hasDelaySlot = 0;
376   let AdditionalPredicates = [RelocPIC];
377   let Defs = [AT];
378 }
379
380 class BEQZC_BNEZC_MM16R6_DESC_BASE<string instr_asm>
381     : CBranchZeroMM<instr_asm, brtarget7_mm, GPRMM16Opnd>,
382       MMR6Arch<instr_asm> {
383   let isBranch = 1;
384   let isTerminator = 1;
385   let hasDelaySlot = 0;
386   let Defs = [AT];
387 }
388 class BEQZC16_MMR6_DESC : BEQZC_BNEZC_MM16R6_DESC_BASE<"beqzc16">;
389 class BNEZC16_MMR6_DESC : BEQZC_BNEZC_MM16R6_DESC_BASE<"bnezc16">;
390
391 class SUB_MMR6_DESC : ArithLogicR<"sub", GPR32Opnd, 0, II_SUB>;
392 class SUBU_MMR6_DESC : ArithLogicR<"subu", GPR32Opnd, 0,II_SUBU>;
393
394 class BITSWAP_MMR6_DESC_BASE<string instr_asm, RegisterOperand GPROpnd>
395     : MMR6Arch<instr_asm> {
396   dag OutOperandList = (outs GPROpnd:$rd);
397   dag InOperandList = (ins GPROpnd:$rt);
398   string AsmString = !strconcat(instr_asm, "\t$rd, $rt");
399   list<dag> Pattern = [];
400   InstrItinClass Itinerary = II_BITSWAP;
401 }
402
403 class BITSWAP_MMR6_DESC : BITSWAP_MMR6_DESC_BASE<"bitswap", GPR32Opnd>;
404
405 class BRK_MMR6_DESC : BRK_FT<"break">;
406
407 class CACHE_HINT_MMR6_DESC<string instr_asm, Operand MemOpnd,
408                            RegisterOperand GPROpnd, InstrItinClass Itin>
409       : MMR6Arch<instr_asm> {
410   dag OutOperandList = (outs);
411   dag InOperandList = (ins MemOpnd:$addr, uimm5:$hint);
412   string AsmString = !strconcat(instr_asm, "\t$hint, $addr");
413   list<dag> Pattern = [];
414   string DecoderMethod = "DecodeCacheOpMM";
415   InstrItinClass Itinerary = Itin;
416 }
417
418 class CACHE_MMR6_DESC : CACHE_HINT_MMR6_DESC<"cache", mem_mm_12, GPR32Opnd,
419                                              II_CACHE>;
420 class PREF_MMR6_DESC : CACHE_HINT_MMR6_DESC<"pref", mem_mm_12, GPR32Opnd,
421                                              II_PREF>;
422
423 class LB_LBU_MMR6_DESC_BASE<string instr_asm, Operand MemOpnd,
424                             RegisterOperand GPROpnd, InstrItinClass Itin>
425     : MMR6Arch<instr_asm> {
426   dag OutOperandList = (outs GPROpnd:$rt);
427   dag InOperandList = (ins MemOpnd:$addr);
428   string AsmString = !strconcat(instr_asm, "\t$rt, $addr");
429   string DecoderMethod = "DecodeLoadByte15";
430   bit mayLoad = 1;
431   InstrItinClass Itinerary = Itin;
432 }
433 class LB_MMR6_DESC : LB_LBU_MMR6_DESC_BASE<"lb", mem_mm_16, GPR32Opnd, II_LB>;
434 class LBU_MMR6_DESC : LB_LBU_MMR6_DESC_BASE<"lbu", mem_mm_16, GPR32Opnd,
435                                             II_LBU>;
436
437 class CLO_CLZ_MMR6_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
438                              InstrItinClass Itin> : MMR6Arch<instr_asm> {
439   dag OutOperandList = (outs GPROpnd:$rt);
440   dag InOperandList = (ins GPROpnd:$rs);
441   string AsmString = !strconcat(instr_asm, "\t$rt, $rs");
442   InstrItinClass Itinerary = Itin;
443 }
444
445 class CLO_MMR6_DESC : CLO_CLZ_MMR6_DESC_BASE<"clo", GPR32Opnd, II_CLO>;
446 class CLZ_MMR6_DESC : CLO_CLZ_MMR6_DESC_BASE<"clz", GPR32Opnd, II_CLZ>;
447
448 class EHB_MMR6_DESC : Barrier<"ehb", II_EHB>;
449 class EI_MMR6_DESC : DEI_FT<"ei", GPR32Opnd, II_EI>;
450 class DI_MMR6_DESC : DEI_FT<"di", GPR32Opnd, II_DI>;
451
452 class ERET_MMR6_DESC : ER_FT<"eret", II_ERET>;
453 class DERET_MMR6_DESC : ER_FT<"deret", II_DERET>;
454 class ERETNC_MMR6_DESC : ER_FT<"eretnc", II_ERETNC>;
455
456 class JALRC16_MMR6_DESC_BASE<string opstr, RegisterOperand RO>
457     : MicroMipsInst16<(outs), (ins RO:$rs), !strconcat(opstr, "\t$rs"),
458                       [(MipsJmpLink RO:$rs)], II_JALR, FrmR>,
459       MMR6Arch<opstr> {
460   let isCall = 1;
461   let hasDelaySlot = 0;
462   let Defs = [RA];
463   let hasPostISelHook = 1;
464 }
465 class JALRC16_MMR6_DESC : JALRC16_MMR6_DESC_BASE<"jalr", GPR32Opnd>;
466
467 class JMP_MMR6_IDX_COMPACT_DESC_BASE<string opstr, DAGOperand opnd,
468                                      RegisterOperand GPROpnd,
469                                      InstrItinClass Itin>
470     : MMR6Arch<opstr> {
471   dag InOperandList = (ins GPROpnd:$rt, opnd:$offset);
472   string AsmString = !strconcat(opstr, "\t$rt, $offset");
473   list<dag> Pattern = [];
474   bit isTerminator = 1;
475   bit hasDelaySlot = 0;
476   InstrItinClass Itinerary = Itin;
477 }
478
479 class JIALC_MMR6_DESC : JMP_MMR6_IDX_COMPACT_DESC_BASE<"jialc", calloffset16,
480                                                        GPR32Opnd, II_JIALC> {
481   bit isCall = 1;
482   list<Register> Defs = [RA];
483 }
484
485 class JIC_MMR6_DESC : JMP_MMR6_IDX_COMPACT_DESC_BASE<"jic", jmpoffset16,
486                                                      GPR32Opnd, II_JIC> {
487   bit isBarrier = 1;
488   list<Register> Defs = [AT];
489 }
490
491 class JRC16_MMR6_DESC_BASE<string opstr, RegisterOperand RO>
492     : MicroMipsInst16<(outs), (ins RO:$rs), !strconcat(opstr, "\t$rs"),
493                       [], II_JR, FrmR>,
494       MMR6Arch<opstr> {
495   let hasDelaySlot = 0;
496   let isBranch = 1;
497   let isIndirectBranch = 1;
498 }
499 class JRC16_MMR6_DESC : JRC16_MMR6_DESC_BASE<"jrc16", GPR32Opnd>;
500
501 class JRCADDIUSP_MMR6_DESC
502     : MicroMipsInst16<(outs), (ins uimm5_lsl2:$imm), "jrcaddiusp\t$imm",
503                       [], II_JRADDIUSP, FrmR>,
504       MMR6Arch<"jrcaddiusp"> {
505   let hasDelaySlot = 0;
506   let isTerminator = 1;
507   let isBarrier = 1;
508   let isBranch = 1;
509   let isIndirectBranch = 1;
510 }
511
512 class ALIGN_MMR6_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
513                       Operand ImmOpnd, InstrItinClass Itin>
514     : MMR6Arch<instr_asm> {
515   dag OutOperandList = (outs GPROpnd:$rd);
516   dag InOperandList = (ins GPROpnd:$rs, GPROpnd:$rt, ImmOpnd:$bp);
517   string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt, $bp");
518   list<dag> Pattern = [];
519   InstrItinClass Itinerary = Itin;
520 }
521
522 class ALIGN_MMR6_DESC : ALIGN_MMR6_DESC_BASE<"align", GPR32Opnd, uimm2,
523                                              II_ALIGN>;
524
525 class AUI_MMR6_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
526                          InstrItinClass Itin> : MMR6Arch<instr_asm> {
527   dag OutOperandList = (outs GPROpnd:$rt);
528   dag InOperandList = (ins GPROpnd:$rs, uimm16:$imm);
529   string AsmString = !strconcat(instr_asm, "\t$rt, $rs, $imm");
530   list<dag> Pattern = [];
531   InstrItinClass Itinerary = Itin;
532 }
533
534 class AUI_MMR6_DESC : AUI_MMR6_DESC_BASE<"aui", GPR32Opnd, II_AUI>;
535
536 class ALUIPC_MMR6_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
537                             InstrItinClass Itin> : MMR6Arch<instr_asm> {
538   dag OutOperandList = (outs GPROpnd:$rt);
539   dag InOperandList = (ins simm16:$imm);
540   string AsmString = !strconcat(instr_asm, "\t$rt, $imm");
541   list<dag> Pattern = [];
542   InstrItinClass Itinerary = Itin;
543 }
544
545 class ALUIPC_MMR6_DESC : ALUIPC_MMR6_DESC_BASE<"aluipc", GPR32Opnd, II_ALUIPC>;
546 class AUIPC_MMR6_DESC : ALUIPC_MMR6_DESC_BASE<"auipc", GPR32Opnd, II_AUIPC>;
547
548 class LSA_MMR6_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
549                          Operand ImmOpnd, InstrItinClass Itin>
550     : MMR6Arch<instr_asm> {
551   dag OutOperandList = (outs GPROpnd:$rd);
552   dag InOperandList = (ins GPROpnd:$rs, GPROpnd:$rt, ImmOpnd:$imm2);
553   string AsmString = !strconcat(instr_asm, "\t$rt, $rs, $rd, $imm2");
554   list<dag> Pattern = [];
555   InstrItinClass Itinerary = Itin;
556 }
557
558 class LSA_MMR6_DESC : LSA_MMR6_DESC_BASE<"lsa", GPR32Opnd, uimm2_plus1, II_LSA>;
559
560 class PCREL_MMR6_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
561                            Operand ImmOpnd, InstrItinClass Itin>
562     : MMR6Arch<instr_asm> {
563   dag OutOperandList = (outs GPROpnd:$rt);
564   dag InOperandList = (ins ImmOpnd:$imm);
565   string AsmString = !strconcat(instr_asm, "\t$rt, $imm");
566   list<dag> Pattern = [];
567   InstrItinClass Itinerary = Itin;
568 }
569
570 class ADDIUPC_MMR6_DESC : PCREL_MMR6_DESC_BASE<"addiupc", GPR32Opnd,
571                                                simm19_lsl2, II_ADDIUPC>;
572 class LWPC_MMR6_DESC: PCREL_MMR6_DESC_BASE<"lwpc", GPR32Opnd, simm19_lsl2,
573                                            II_LWPC>;
574
575 class SELEQNE_Z_MMR6_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
576                                InstrItinClass Itin> : MMR6Arch<instr_asm> {
577   dag OutOperandList = (outs GPROpnd:$rd);
578   dag InOperandList = (ins GPROpnd:$rs, GPROpnd:$rt);
579   string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt");
580   list<dag> Pattern = [];
581   InstrItinClass Itinerary = Itin;
582 }
583
584 class SELEQZ_MMR6_DESC : SELEQNE_Z_MMR6_DESC_BASE<"seleqz", GPR32Opnd,
585                                                   II_SELCCZ>;
586 class SELNEZ_MMR6_DESC : SELEQNE_Z_MMR6_DESC_BASE<"selnez", GPR32Opnd,
587                                                   II_SELCCZ>;
588 class PAUSE_MMR6_DESC : Barrier<"pause", II_PAUSE>;
589 class RDHWR_MMR6_DESC : MMR6Arch<"rdhwr">, MipsR6Inst {
590   dag OutOperandList = (outs GPR32Opnd:$rt);
591   dag InOperandList = (ins HWRegsOpnd:$rs, uimm3:$sel);
592   string AsmString = !strconcat("rdhwr", "\t$rt, $rs, $sel");
593   list<dag> Pattern = [];
594   InstrItinClass Itinerary = II_RDHWR;
595   Format Form = FrmR;
596 }
597
598 class WAIT_MMR6_DESC : WaitMM<"wait">;
599 // FIXME: ssnop should not be defined for R6. Per MD000582 microMIPS32 6.03:
600 //        Assemblers targeting specifically Release 6 should reject the SSNOP
601 //        instruction with an error.
602 class SSNOP_MMR6_DESC : Barrier<"ssnop", II_SSNOP>;
603 class SLL_MMR6_DESC : shift_rotate_imm<"sll", uimm5, GPR32Opnd, II_SLL>;
604
605 class DIVMOD_MMR6_DESC_BASE<string opstr, RegisterOperand GPROpnd,
606                             InstrItinClass Itin,
607                             SDPatternOperator OpNode=null_frag>
608     : MipsR6Inst {
609   dag OutOperandList = (outs GPROpnd:$rd);
610   dag InOperandList = (ins GPROpnd:$rs, GPROpnd:$rt);
611   string AsmString = !strconcat(opstr, "\t$rd, $rs, $rt");
612   list<dag> Pattern = [(set GPROpnd:$rd, (OpNode GPROpnd:$rs, GPROpnd:$rt))];
613   string BaseOpcode = opstr;
614   Format f = FrmR;
615   let isCommutable = 0;
616   let isReMaterializable = 1;
617   InstrItinClass Itinerary = Itin;
618
619   // This instruction doesn't trap division by zero itself. We must insert
620   // teq instructions as well.
621   bit usesCustomInserter = 1;
622 }
623 class DIV_MMR6_DESC  : DIVMOD_MMR6_DESC_BASE<"div", GPR32Opnd, II_DIV, sdiv>;
624 class DIVU_MMR6_DESC : DIVMOD_MMR6_DESC_BASE<"divu", GPR32Opnd, II_DIVU, udiv>;
625 class MOD_MMR6_DESC  : DIVMOD_MMR6_DESC_BASE<"mod", GPR32Opnd, II_MOD, srem>;
626 class MODU_MMR6_DESC : DIVMOD_MMR6_DESC_BASE<"modu", GPR32Opnd, II_MODU, urem>;
627 class AND_MMR6_DESC : ArithLogicR<"and", GPR32Opnd, 1, II_AND, and>;
628 class ANDI_MMR6_DESC : ArithLogicI<"andi", uimm16, GPR32Opnd, II_ANDI>;
629 class NOR_MMR6_DESC : LogicNOR<"nor", GPR32Opnd>;
630 class OR_MMR6_DESC : ArithLogicR<"or", GPR32Opnd, 1, II_OR, or>;
631 class ORI_MMR6_DESC : ArithLogicI<"ori", uimm16, GPR32Opnd, II_ORI, immZExt16,
632                                   or> {
633   int AddedComplexity = 1;
634 }
635 class XOR_MMR6_DESC : ArithLogicR<"xor", GPR32Opnd, 1, II_XOR, xor>;
636 class XORI_MMR6_DESC : ArithLogicI<"xori", uimm16, GPR32Opnd, II_XORI,
637                                    immZExt16, xor>;
638 class SW_MMR6_DESC : Store<"sw", GPR32Opnd> {
639   InstrItinClass Itinerary = II_SW;
640 }
641 class WRPGPR_WSBH_MMR6_DESC_BASE<string instr_asm, RegisterOperand RO,
642                                  InstrItinClass Itin> {
643   dag InOperandList = (ins RO:$rs);
644   dag OutOperandList = (outs RO:$rt);
645   string AsmString = !strconcat(instr_asm, "\t$rt, $rs");
646   list<dag> Pattern = [];
647   Format f = FrmR;
648   string BaseOpcode = instr_asm;
649   bit hasSideEffects = 0;
650   InstrItinClass Itinerary = Itin;
651 }
652 class WRPGPR_MMR6_DESC : WRPGPR_WSBH_MMR6_DESC_BASE<"wrpgpr", GPR32Opnd,
653                                                     II_WRPGPR>;
654 class WSBH_MMR6_DESC : WRPGPR_WSBH_MMR6_DESC_BASE<"wsbh", GPR32Opnd, II_WSBH>;
655
656 class MTC0_MMR6_DESC_BASE<string opstr, RegisterOperand DstRC,
657                          RegisterOperand SrcRC, InstrItinClass Itin> {
658   dag InOperandList = (ins SrcRC:$rt, uimm3:$sel);
659   dag OutOperandList = (outs DstRC:$rs);
660   string AsmString = !strconcat(opstr, "\t$rt, $rs, $sel");
661   list<dag> Pattern = [];
662   Format f = FrmFR;
663   string BaseOpcode = opstr;
664   InstrItinClass Itinerary = Itin;
665 }
666 class MTC1_MMR6_DESC_BASE<
667       string opstr, RegisterOperand DstRC, RegisterOperand SrcRC,
668       InstrItinClass Itin = NoItinerary, SDPatternOperator OpNode = null_frag>
669       : MipsR6Inst {
670   dag InOperandList = (ins SrcRC:$rt);
671   dag OutOperandList = (outs DstRC:$fs);
672   string AsmString = !strconcat(opstr, "\t$rt, $fs");
673   list<dag> Pattern = [(set DstRC:$fs, (OpNode SrcRC:$rt))];
674   Format f = FrmFR;
675   InstrItinClass Itinerary = Itin;
676   string BaseOpcode = opstr;
677 }
678 class MTC1_64_MMR6_DESC_BASE<
679       string opstr, RegisterOperand DstRC, RegisterOperand SrcRC,
680       InstrItinClass Itin = NoItinerary> : MipsR6Inst {
681   dag InOperandList = (ins DstRC:$fs_in, SrcRC:$rt);
682   dag OutOperandList = (outs DstRC:$fs);
683   string AsmString = !strconcat(opstr, "\t$rt, $fs");
684   list<dag> Pattern = [];
685   Format f = FrmFR;
686   InstrItinClass Itinerary = Itin;
687   string BaseOpcode = opstr;
688   // $fs_in is part of a white lie to work around a widespread bug in the FPU
689   // implementation. See expandBuildPairF64 for details.
690   let Constraints = "$fs = $fs_in";
691 }
692 class MTC2_MMR6_DESC_BASE<string opstr, RegisterOperand DstRC,
693                          RegisterOperand SrcRC, InstrItinClass Itin> {
694   dag InOperandList = (ins SrcRC:$rt);
695   dag OutOperandList = (outs DstRC:$impl);
696   string AsmString = !strconcat(opstr, "\t$rt, $impl");
697   list<dag> Pattern = [];
698   Format f = FrmFR;
699   string BaseOpcode = opstr;
700   InstrItinClass Itinerary = Itin;
701 }
702
703 class MTC0_MMR6_DESC : MTC0_MMR6_DESC_BASE<"mtc0", COP0Opnd, GPR32Opnd,
704                                            II_MTC0>;
705 class MTC1_MMR6_DESC : MTC1_MMR6_DESC_BASE<"mtc1", FGR32Opnd, GPR32Opnd,
706                                            II_MTC1, bitconvert>, HARDFLOAT;
707 class MTC2_MMR6_DESC : MTC2_MMR6_DESC_BASE<"mtc2", COP2Opnd, GPR32Opnd,
708                                            II_MTC2>;
709 class MTHC0_MMR6_DESC : MTC0_MMR6_DESC_BASE<"mthc0", COP0Opnd, GPR32Opnd,
710                                             II_MTHC0>;
711 class MTHC2_MMR6_DESC : MTC2_MMR6_DESC_BASE<"mthc2", COP2Opnd, GPR32Opnd,
712                                             II_MTC2>;
713
714 class MFC0_MMR6_DESC_BASE<string opstr, RegisterOperand DstRC,
715                           RegisterOperand SrcRC, InstrItinClass Itin> {
716   dag InOperandList = (ins SrcRC:$rs, uimm3:$sel);
717   dag OutOperandList = (outs DstRC:$rt);
718   string AsmString = !strconcat(opstr, "\t$rt, $rs, $sel");
719   list<dag> Pattern = [];
720   Format f = FrmFR;
721   string BaseOpcode = opstr;
722   InstrItinClass Itinerary = Itin;
723 }
724 class MFC1_MMR6_DESC_BASE<string opstr, RegisterOperand DstRC,
725                           RegisterOperand SrcRC,
726                           InstrItinClass Itin = NoItinerary,
727                           SDPatternOperator OpNode = null_frag> : MipsR6Inst {
728   dag InOperandList = (ins SrcRC:$fs);
729   dag OutOperandList = (outs DstRC:$rt);
730   string AsmString = !strconcat(opstr, "\t$rt, $fs");
731   list<dag> Pattern = [(set DstRC:$rt, (OpNode SrcRC:$fs))];
732   Format f = FrmFR;
733   InstrItinClass Itinerary = Itin;
734   string BaseOpcode = opstr;
735 }
736 class MFC2_MMR6_DESC_BASE<string opstr, RegisterOperand DstRC,
737                           RegisterOperand SrcRC, InstrItinClass Itin> {
738   dag InOperandList = (ins SrcRC:$impl);
739   dag OutOperandList = (outs DstRC:$rt);
740   string AsmString = !strconcat(opstr, "\t$rt, $impl");
741   list<dag> Pattern = [];
742   Format f = FrmFR;
743   string BaseOpcode = opstr;
744   InstrItinClass Itinerary = Itin;
745 }
746 class MFC0_MMR6_DESC : MFC0_MMR6_DESC_BASE<"mfc0", GPR32Opnd, COP0Opnd,
747                                            II_MFC0>;
748 class MFC1_MMR6_DESC : MFC1_MMR6_DESC_BASE<"mfc1", GPR32Opnd, FGR32Opnd,
749                                            II_MFC1, bitconvert>, HARDFLOAT;
750 class MFC2_MMR6_DESC : MFC2_MMR6_DESC_BASE<"mfc2", GPR32Opnd, COP2Opnd,
751                                            II_MFC2>;
752 class MFHC0_MMR6_DESC : MFC0_MMR6_DESC_BASE<"mfhc0", GPR32Opnd, COP0Opnd,
753                                             II_MFHC0>;
754 class MFHC2_MMR6_DESC : MFC2_MMR6_DESC_BASE<"mfhc2", GPR32Opnd, COP2Opnd,
755                                             II_MFC2>;
756
757 class LDC1_D64_MMR6_DESC : MipsR6Inst, HARDFLOAT, FGR_64 {
758   dag InOperandList = (ins mem_mm_16:$addr);
759   dag OutOperandList = (outs FGR64Opnd:$ft);
760   string AsmString = !strconcat("ldc1", "\t$ft, $addr");
761   list<dag> Pattern = [(set FGR64Opnd:$ft, (load addrimm16:$addr))];
762   Format f = FrmFI;
763   InstrItinClass Itinerary = II_LDC1;
764   string BaseOpcode = "ldc1";
765   bit mayLoad = 1;
766   let DecoderMethod = "DecodeFMemMMR2";
767 }
768
769 class SDC1_D64_MMR6_DESC : MipsR6Inst, HARDFLOAT, FGR_64 {
770   dag InOperandList = (ins FGR64Opnd:$ft, mem_mm_16:$addr);
771   dag OutOperandList = (outs);
772   string AsmString = !strconcat("sdc1", "\t$ft, $addr");
773   list<dag> Pattern = [(store FGR64Opnd:$ft, addrimm16:$addr)];
774   Format f = FrmFI;
775   InstrItinClass Itinerary = II_SDC1;
776   string BaseOpcode = "sdc1";
777   bit mayStore = 1;
778   let DecoderMethod = "DecodeFMemMMR2";
779 }
780
781 class LDC2_LWC2_MMR6_DESC_BASE<string opstr, InstrItinClass itin> {
782   dag OutOperandList = (outs COP2Opnd:$rt);
783   dag InOperandList = (ins mem_mm_11:$addr);
784   string AsmString = !strconcat(opstr, "\t$rt, $addr");
785   list<dag> Pattern = [(set COP2Opnd:$rt, (load addrimm11:$addr))];
786   Format f = FrmFI;
787   InstrItinClass Itinerary = itin;
788   string BaseOpcode = opstr;
789   bit mayLoad = 1;
790   string DecoderMethod = "DecodeFMemCop2MMR6";
791 }
792 class LDC2_MMR6_DESC : LDC2_LWC2_MMR6_DESC_BASE<"ldc2", II_LDC2>;
793 class LWC2_MMR6_DESC : LDC2_LWC2_MMR6_DESC_BASE<"lwc2", II_LWC2>;
794
795 class SDC2_SWC2_MMR6_DESC_BASE<string opstr, InstrItinClass itin> {
796   dag OutOperandList = (outs);
797   dag InOperandList = (ins COP2Opnd:$rt, mem_mm_11:$addr);
798   string AsmString = !strconcat(opstr, "\t$rt, $addr");
799   list<dag> Pattern = [(store COP2Opnd:$rt, addrimm11:$addr)];
800   Format f = FrmFI;
801   InstrItinClass Itinerary = itin;
802   string BaseOpcode = opstr;
803   bit mayStore = 1;
804   string DecoderMethod = "DecodeFMemCop2MMR6";
805 }
806 class SDC2_MMR6_DESC : SDC2_SWC2_MMR6_DESC_BASE<"sdc2", II_SDC2>;
807 class SWC2_MMR6_DESC : SDC2_SWC2_MMR6_DESC_BASE<"swc2", II_SWC2>;
808
809 class GINV_MMR6_DESC_BASE<string opstr,
810                           RegisterOperand SrcRC, InstrItinClass Itin> {
811   dag InOperandList = (ins SrcRC:$rs, uimm2:$type);
812   dag OutOperandList = (outs);
813   string AsmString = !strconcat(opstr, "\t$rs, $type");
814   list<dag> Pattern = [];
815   Format f = FrmFR;
816   string BaseOpcode = opstr;
817   InstrItinClass Itinerary = Itin;
818 }
819
820 class GINVI_MMR6_DESC : GINV_MMR6_DESC_BASE<"ginvi", GPR32Opnd,
821                                             II_GINVI> {
822   dag InOperandList = (ins GPR32Opnd:$rs);
823   string AsmString = "ginvi\t$rs";
824 }
825 class GINVT_MMR6_DESC : GINV_MMR6_DESC_BASE<"ginvt", GPR32Opnd,
826                                             II_GINVT>;
827
828 class SC_MMR6_DESC_BASE<string opstr, InstrItinClass itin> {
829   dag OutOperandList = (outs GPR32Opnd:$dst);
830   dag InOperandList = (ins GPR32Opnd:$rt, mem_mm_9:$addr);
831   string AsmString = !strconcat(opstr, "\t$rt, $addr");
832   InstrItinClass Itinerary = itin;
833   string BaseOpcode = opstr;
834   bit mayStore = 1;
835   string Constraints = "$rt = $dst";
836   string DecoderMethod = "DecodeMemMMImm9";
837 }
838
839 class LL_MMR6_DESC_BASE<string opstr, InstrItinClass itin> {
840   dag OutOperandList = (outs GPR32Opnd:$rt);
841   dag InOperandList = (ins mem_mm_9:$addr);
842   string AsmString = !strconcat(opstr, "\t$rt, $addr");
843   InstrItinClass Itinerary = itin;
844   string BaseOpcode = opstr;
845   bit mayLoad = 1;
846   string DecoderMethod = "DecodeMemMMImm9";
847 }
848
849 class SC_MMR6_DESC : SC_MMR6_DESC_BASE<"sc", II_SC>;
850 class LL_MMR6_DESC : LL_MMR6_DESC_BASE<"ll", II_LL>;
851
852 /// Floating Point Instructions
853 class FARITH_MMR6_DESC_BASE<string instr_asm, RegisterOperand RC,
854                             InstrItinClass Itin, bit isComm,
855                             SDPatternOperator OpNode = null_frag> : HARDFLOAT {
856   dag OutOperandList = (outs RC:$fd);
857   dag InOperandList = (ins RC:$ft, RC:$fs);
858   string AsmString = !strconcat(instr_asm, "\t$fd, $fs, $ft");
859   list<dag> Pattern = [(set RC:$fd, (OpNode RC:$fs, RC:$ft))];
860   InstrItinClass Itinerary = Itin;
861   bit isCommutable = isComm;
862 }
863 class FADD_S_MMR6_DESC
864   : FARITH_MMR6_DESC_BASE<"add.s", FGR32Opnd, II_ADD_S, 1, fadd>;
865 class FSUB_S_MMR6_DESC
866   : FARITH_MMR6_DESC_BASE<"sub.s", FGR32Opnd, II_SUB_S, 0, fsub>;
867 class FMUL_S_MMR6_DESC
868   : FARITH_MMR6_DESC_BASE<"mul.s", FGR32Opnd, II_MUL_S, 1, fmul>;
869 class FDIV_S_MMR6_DESC
870   : FARITH_MMR6_DESC_BASE<"div.s", FGR32Opnd, II_DIV_S, 0, fdiv>;
871 class MADDF_S_MMR6_DESC : COP1_4R_DESC_BASE<"maddf.s", FGR32Opnd,
872                                             II_MADDF_S>, HARDFLOAT;
873 class MADDF_D_MMR6_DESC : COP1_4R_DESC_BASE<"maddf.d", FGR64Opnd,
874                                             II_MADDF_D>, HARDFLOAT;
875 class MSUBF_S_MMR6_DESC : COP1_4R_DESC_BASE<"msubf.s", FGR32Opnd,
876                                             II_MSUBF_S>, HARDFLOAT;
877 class MSUBF_D_MMR6_DESC : COP1_4R_DESC_BASE<"msubf.d", FGR64Opnd,
878                                             II_MSUBF_D>, HARDFLOAT;
879
880 class FMOV_FNEG_MMR6_DESC_BASE<string instr_asm, RegisterOperand DstRC,
881                                RegisterOperand SrcRC, InstrItinClass Itin,
882                                SDPatternOperator OpNode = null_frag>
883                                : HARDFLOAT, NeverHasSideEffects {
884   dag OutOperandList = (outs DstRC:$ft);
885   dag InOperandList = (ins SrcRC:$fs);
886   string AsmString = !strconcat(instr_asm, "\t$ft, $fs");
887   list<dag> Pattern = [(set DstRC:$ft, (OpNode SrcRC:$fs))];
888   InstrItinClass Itinerary = Itin;
889   Format Form = FrmFR;
890 }
891 class FMOV_S_MMR6_DESC
892   : FMOV_FNEG_MMR6_DESC_BASE<"mov.s", FGR32Opnd, FGR32Opnd, II_MOV_S>;
893 class FNEG_S_MMR6_DESC
894   : FMOV_FNEG_MMR6_DESC_BASE<"neg.s", FGR32Opnd, FGR32Opnd, II_NEG, fneg>;
895
896 class MAX_S_MMR6_DESC : MAX_MIN_DESC_BASE<"max.s", FGR32Opnd, II_MAX_S>,
897                         HARDFLOAT;
898 class MAX_D_MMR6_DESC : MAX_MIN_DESC_BASE<"max.d", FGR64Opnd, II_MAX_D>,
899                         HARDFLOAT;
900 class MIN_S_MMR6_DESC : MAX_MIN_DESC_BASE<"min.s", FGR32Opnd, II_MIN_S>,
901                         HARDFLOAT;
902 class MIN_D_MMR6_DESC : MAX_MIN_DESC_BASE<"min.d", FGR64Opnd, II_MIN_D>,
903                         HARDFLOAT;
904
905 class MAXA_S_MMR6_DESC : MAX_MIN_DESC_BASE<"maxa.s", FGR32Opnd, II_MAXA_S>,
906                          HARDFLOAT;
907 class MAXA_D_MMR6_DESC : MAX_MIN_DESC_BASE<"maxa.d", FGR64Opnd, II_MAXA_D>,
908                          HARDFLOAT;
909 class MINA_S_MMR6_DESC : MAX_MIN_DESC_BASE<"mina.s", FGR32Opnd, II_MINA_S>,
910                          HARDFLOAT;
911 class MINA_D_MMR6_DESC : MAX_MIN_DESC_BASE<"mina.d", FGR64Opnd, II_MINA_D>,
912                          HARDFLOAT;
913
914 class CVT_MMR6_DESC_BASE<
915     string instr_asm, RegisterOperand DstRC, RegisterOperand SrcRC,
916     InstrItinClass Itin, SDPatternOperator OpNode = null_frag>
917     : HARDFLOAT, NeverHasSideEffects {
918   dag OutOperandList = (outs DstRC:$ft);
919   dag InOperandList = (ins SrcRC:$fs);
920   string AsmString = !strconcat(instr_asm, "\t$ft, $fs");
921   list<dag> Pattern = [(set DstRC:$ft, (OpNode SrcRC:$fs))];
922   InstrItinClass Itinerary = Itin;
923   Format Form = FrmFR;
924 }
925
926 class CVT_L_S_MMR6_DESC : CVT_MMR6_DESC_BASE<"cvt.l.s", FGR64Opnd, FGR32Opnd,
927                                              II_CVT>;
928 class CVT_L_D_MMR6_DESC : CVT_MMR6_DESC_BASE<"cvt.l.d", FGR64Opnd, FGR64Opnd,
929                                              II_CVT>;
930 class CVT_W_S_MMR6_DESC : CVT_MMR6_DESC_BASE<"cvt.w.s", FGR32Opnd, FGR32Opnd,
931                                              II_CVT>;
932 class CVT_D_L_MMR6_DESC : CVT_MMR6_DESC_BASE<"cvt.d.l", FGR64Opnd, FGR64Opnd,
933                                              II_CVT>, FGR_64;
934 class CVT_S_W_MMR6_DESC : CVT_MMR6_DESC_BASE<"cvt.s.w", FGR32Opnd, FGR32Opnd,
935                                              II_CVT>;
936 class CVT_S_L_MMR6_DESC : CVT_MMR6_DESC_BASE<"cvt.s.l", FGR64Opnd, FGR32Opnd,
937                                              II_CVT>, FGR_64;
938
939 multiclass CMP_CC_MMR6<bits<6> format, string Typestr,
940                        RegisterOperand FGROpnd, InstrItinClass Itin> {
941   def CMP_AF_#NAME : R6MMR6Rel, POOL32F_CMP_FM<
942       !strconcat("cmp.af.", Typestr), format, FIELD_CMP_COND_AF>,
943       CMP_CONDN_DESC_BASE<"af", Typestr, FGROpnd, Itin>, HARDFLOAT,
944       ISA_MICROMIPS32R6;
945   def CMP_UN_#NAME : R6MMR6Rel, POOL32F_CMP_FM<
946       !strconcat("cmp.un.", Typestr), format, FIELD_CMP_COND_UN>,
947       CMP_CONDN_DESC_BASE<"un", Typestr, FGROpnd, Itin, setuo>, HARDFLOAT,
948       ISA_MICROMIPS32R6;
949   def CMP_EQ_#NAME : R6MMR6Rel, POOL32F_CMP_FM<
950       !strconcat("cmp.eq.", Typestr), format, FIELD_CMP_COND_EQ>,
951       CMP_CONDN_DESC_BASE<"eq", Typestr, FGROpnd, Itin, setoeq>, HARDFLOAT,
952       ISA_MICROMIPS32R6;
953   def CMP_UEQ_#NAME : R6MMR6Rel, POOL32F_CMP_FM<
954       !strconcat("cmp.ueq.", Typestr), format, FIELD_CMP_COND_UEQ>,
955       CMP_CONDN_DESC_BASE<"ueq", Typestr, FGROpnd, Itin, setueq>, HARDFLOAT,
956       ISA_MICROMIPS32R6;
957   def CMP_LT_#NAME : R6MMR6Rel, POOL32F_CMP_FM<
958       !strconcat("cmp.lt.", Typestr), format, FIELD_CMP_COND_LT>,
959       CMP_CONDN_DESC_BASE<"lt", Typestr, FGROpnd, Itin, setolt>, HARDFLOAT,
960       ISA_MICROMIPS32R6;
961   def CMP_ULT_#NAME : R6MMR6Rel, POOL32F_CMP_FM<
962       !strconcat("cmp.ult.", Typestr), format, FIELD_CMP_COND_ULT>,
963       CMP_CONDN_DESC_BASE<"ult", Typestr, FGROpnd, Itin, setult>, HARDFLOAT,
964       ISA_MICROMIPS32R6;
965   def CMP_LE_#NAME : R6MMR6Rel, POOL32F_CMP_FM<
966       !strconcat("cmp.le.", Typestr), format, FIELD_CMP_COND_LE>,
967       CMP_CONDN_DESC_BASE<"le", Typestr, FGROpnd, Itin, setole>, HARDFLOAT,
968       ISA_MICROMIPS32R6;
969   def CMP_ULE_#NAME : R6MMR6Rel, POOL32F_CMP_FM<
970       !strconcat("cmp.ule.", Typestr), format, FIELD_CMP_COND_ULE>,
971       CMP_CONDN_DESC_BASE<"ule", Typestr, FGROpnd, Itin, setule>, HARDFLOAT,
972       ISA_MICROMIPS32R6;
973   def CMP_SAF_#NAME : R6MMR6Rel, POOL32F_CMP_FM<
974       !strconcat("cmp.saf.", Typestr), format, FIELD_CMP_COND_SAF>,
975       CMP_CONDN_DESC_BASE<"saf", Typestr, FGROpnd, Itin>, HARDFLOAT,
976       ISA_MICROMIPS32R6;
977   def CMP_SUN_#NAME : R6MMR6Rel, POOL32F_CMP_FM<
978       !strconcat("cmp.sun.", Typestr), format, FIELD_CMP_COND_SUN>,
979       CMP_CONDN_DESC_BASE<"sun", Typestr, FGROpnd, Itin>, HARDFLOAT,
980       ISA_MICROMIPS32R6;
981   def CMP_SEQ_#NAME : R6MMR6Rel, POOL32F_CMP_FM<
982       !strconcat("cmp.seq.", Typestr), format, FIELD_CMP_COND_SEQ>,
983       CMP_CONDN_DESC_BASE<"seq", Typestr, FGROpnd, Itin>, HARDFLOAT,
984       ISA_MICROMIPS32R6;
985   def CMP_SUEQ_#NAME : R6MMR6Rel, POOL32F_CMP_FM<
986       !strconcat("cmp.sueq.", Typestr), format, FIELD_CMP_COND_SUEQ>,
987       CMP_CONDN_DESC_BASE<"sueq", Typestr, FGROpnd, Itin>, HARDFLOAT,
988       ISA_MICROMIPS32R6;
989   def CMP_SLT_#NAME : R6MMR6Rel, POOL32F_CMP_FM<
990       !strconcat("cmp.slt.", Typestr), format, FIELD_CMP_COND_SLT>,
991       CMP_CONDN_DESC_BASE<"slt", Typestr, FGROpnd, Itin>, HARDFLOAT,
992       ISA_MICROMIPS32R6;
993   def CMP_SULT_#NAME : R6MMR6Rel, POOL32F_CMP_FM<
994       !strconcat("cmp.sult.", Typestr), format, FIELD_CMP_COND_SULT>,
995       CMP_CONDN_DESC_BASE<"sult", Typestr, FGROpnd, Itin>, HARDFLOAT,
996       ISA_MICROMIPS32R6;
997   def CMP_SLE_#NAME : R6MMR6Rel, POOL32F_CMP_FM<
998       !strconcat("cmp.sle.", Typestr), format, FIELD_CMP_COND_SLE>,
999       CMP_CONDN_DESC_BASE<"sle", Typestr, FGROpnd, Itin>, HARDFLOAT,
1000       ISA_MICROMIPS32R6;
1001   def CMP_SULE_#NAME : R6MMR6Rel, POOL32F_CMP_FM<
1002       !strconcat("cmp.sule.", Typestr), format, FIELD_CMP_COND_SULE>,
1003       CMP_CONDN_DESC_BASE<"sule", Typestr, FGROpnd, Itin>, HARDFLOAT,
1004       ISA_MICROMIPS32R6;
1005 }
1006
1007 class ABSS_FT_MMR6_DESC_BASE<string instr_asm, RegisterOperand DstRC,
1008                              RegisterOperand SrcRC, InstrItinClass Itin,
1009                              SDPatternOperator OpNode = null_frag>
1010     : HARDFLOAT, NeverHasSideEffects {
1011   dag OutOperandList = (outs DstRC:$ft);
1012   dag InOperandList  = (ins SrcRC:$fs);
1013   string AsmString   = !strconcat(instr_asm, "\t$ft, $fs");
1014   list<dag>  Pattern = [(set DstRC:$ft, (OpNode SrcRC:$fs))];
1015   InstrItinClass Itinerary = Itin;
1016   Format Form = FrmFR;
1017   list<Predicate> EncodingPredicates = [HasStdEnc];
1018 }
1019
1020 class FLOOR_L_S_MMR6_DESC : ABSS_FT_MMR6_DESC_BASE<"floor.l.s", FGR64Opnd,
1021                                                     FGR32Opnd, II_FLOOR>;
1022 class FLOOR_L_D_MMR6_DESC : ABSS_FT_MMR6_DESC_BASE<"floor.l.d", FGR64Opnd,
1023                                                     FGR64Opnd, II_FLOOR>;
1024 class FLOOR_W_S_MMR6_DESC : ABSS_FT_MMR6_DESC_BASE<"floor.w.s", FGR32Opnd,
1025                                                     FGR32Opnd, II_FLOOR>;
1026 class FLOOR_W_D_MMR6_DESC : ABSS_FT_MMR6_DESC_BASE<"floor.w.d", FGR32Opnd,
1027                                                     AFGR64Opnd, II_FLOOR>;
1028 class CEIL_L_S_MMR6_DESC : ABSS_FT_MMR6_DESC_BASE<"ceil.l.s", FGR64Opnd,
1029                                                    FGR32Opnd, II_CEIL>;
1030 class CEIL_L_D_MMR6_DESC : ABSS_FT_MMR6_DESC_BASE<"ceil.l.d", FGR64Opnd,
1031                                                    FGR64Opnd, II_CEIL>;
1032 class CEIL_W_S_MMR6_DESC : ABSS_FT_MMR6_DESC_BASE<"ceil.w.s", FGR32Opnd,
1033                                                    FGR32Opnd, II_CEIL>;
1034 class CEIL_W_D_MMR6_DESC : ABSS_FT_MMR6_DESC_BASE<"ceil.w.d", FGR32Opnd,
1035                                                    AFGR64Opnd, II_CEIL>;
1036 class TRUNC_L_S_MMR6_DESC : ABSS_FT_MMR6_DESC_BASE<"trunc.l.s", FGR64Opnd,
1037                                                     FGR32Opnd, II_TRUNC>;
1038 class TRUNC_L_D_MMR6_DESC : ABSS_FT_MMR6_DESC_BASE<"trunc.l.d", FGR64Opnd,
1039                                                     FGR64Opnd, II_TRUNC>;
1040 class TRUNC_W_S_MMR6_DESC : ABSS_FT_MMR6_DESC_BASE<"trunc.w.s", FGR32Opnd,
1041                                                     FGR32Opnd, II_TRUNC>;
1042 class TRUNC_W_D_MMR6_DESC : ABSS_FT_MMR6_DESC_BASE<"trunc.w.d", FGR32Opnd,
1043                                                     AFGR64Opnd, II_TRUNC>;
1044 class SQRT_S_MMR6_DESC : ABSS_FT_MMR6_DESC_BASE<"sqrt.s", FGR32Opnd, FGR32Opnd,
1045                                                  II_SQRT_S, fsqrt>;
1046 class SQRT_D_MMR6_DESC : ABSS_FT_MMR6_DESC_BASE<"sqrt.d", AFGR64Opnd, AFGR64Opnd,
1047                                                  II_SQRT_D, fsqrt>;
1048 class ROUND_L_S_MMR6_DESC : ABSS_FT_MMR6_DESC_BASE<"round.l.s", FGR64Opnd,
1049                                                    FGR32Opnd, II_ROUND>;
1050 class ROUND_L_D_MMR6_DESC : ABSS_FT_MMR6_DESC_BASE<"round.l.d", FGR64Opnd,
1051                                                    FGR64Opnd, II_ROUND>;
1052 class ROUND_W_S_MMR6_DESC : ABSS_FT_MMR6_DESC_BASE<"round.w.s", FGR32Opnd,
1053                                                    FGR32Opnd, II_ROUND>;
1054 class ROUND_W_D_MMR6_DESC : ABSS_FT_MMR6_DESC_BASE<"round.w.d", FGR64Opnd,
1055                                                    FGR64Opnd, II_ROUND>;
1056
1057 class SEL_S_MMR6_DESC : COP1_SEL_DESC_BASE<"sel.s", FGR32Opnd, II_SEL_S>;
1058 class SEL_D_MMR6_DESC : COP1_SEL_D_DESC_BASE<"sel.d", FGR64Opnd, II_SEL_D>;
1059
1060 class SELEQZ_S_MMR6_DESC : SELEQNEZ_DESC_BASE<"seleqz.s", FGR32Opnd,
1061                                               II_SELCCZ_S>;
1062 class SELEQZ_D_MMR6_DESC : SELEQNEZ_DESC_BASE<"seleqz.d", FGR64Opnd,
1063                                               II_SELCCZ_D>;
1064 class SELNEZ_S_MMR6_DESC : SELEQNEZ_DESC_BASE<"selnez.s", FGR32Opnd,
1065                                               II_SELCCZ_S>;
1066 class SELNEZ_D_MMR6_DESC : SELEQNEZ_DESC_BASE<"selnez.d", FGR64Opnd,
1067                                               II_SELCCZ_D>;
1068 class RINT_S_MMR6_DESC : CLASS_RINT_DESC_BASE<"rint.s", FGR32Opnd,
1069                                               II_RINT_S>;
1070 class RINT_D_MMR6_DESC : CLASS_RINT_DESC_BASE<"rint.d", FGR64Opnd,
1071                                               II_RINT_S>;
1072 class CLASS_S_MMR6_DESC  : CLASS_RINT_DESC_BASE<"class.s", FGR32Opnd,
1073                                               II_CLASS_S>;
1074 class CLASS_D_MMR6_DESC  : CLASS_RINT_DESC_BASE<"class.d", FGR64Opnd,
1075                                               II_CLASS_S>;
1076
1077 class STORE_MMR6_DESC_BASE<string opstr, DAGOperand RO,
1078                            InstrItinClass Itin>
1079     : Store<opstr, RO>, MMR6Arch<opstr> {
1080   let DecoderMethod = "DecodeMemMMImm16";
1081   InstrItinClass Itinerary = Itin;
1082 }
1083 class SB_MMR6_DESC : STORE_MMR6_DESC_BASE<"sb", GPR32Opnd, II_SB>;
1084
1085 class SH_MMR6_DESC : STORE_MMR6_DESC_BASE<"sh", GPR32Opnd, II_SH>;
1086 class ADDU16_MMR6_DESC : ArithRMM16<"addu16", GPRMM16Opnd, 1, II_ADDU, add>,
1087       MMR6Arch<"addu16"> {
1088   int AddedComplexity = 1;
1089 }
1090 class AND16_MMR6_DESC : LogicRMM16<"and16", GPRMM16Opnd, II_AND>,
1091       MMR6Arch<"and16">;
1092 class ANDI16_MMR6_DESC : AndImmMM16<"andi16", GPRMM16Opnd, II_AND>,
1093       MMR6Arch<"andi16">;
1094 class NOT16_MMR6_DESC : NotMM16<"not16", GPRMM16Opnd>, MMR6Arch<"not16"> {
1095   int AddedComplexity = 1;
1096 }
1097 class OR16_MMR6_DESC : LogicRMM16<"or16", GPRMM16Opnd, II_OR>, MMR6Arch<"or16">;
1098 class SLL16_MMR6_DESC : ShiftIMM16<"sll16", uimm3_shift, GPRMM16Opnd, II_SLL>,
1099       MMR6Arch<"sll16">;
1100 class SRL16_MMR6_DESC : ShiftIMM16<"srl16", uimm3_shift, GPRMM16Opnd, II_SRL>,
1101       MMR6Arch<"srl16">;
1102 class BREAK16_MMR6_DESC : BrkSdbbp16MM<"break16", II_BREAK>, MMR6Arch<"break16">;
1103 class LI16_MMR6_DESC : LoadImmMM16<"li16", li16_imm, GPRMM16Opnd>,
1104       MMR6Arch<"li16">, IsAsCheapAsAMove;
1105 class MOVE16_MMR6_DESC : MoveMM16<"move16", GPR32Opnd>, MMR6Arch<"move16">;
1106 class MOVEP_MMR6_DESC : MovePMM16<"movep", GPRMM16OpndMovePPairFirst,
1107                                   GPRMM16OpndMovePPairSecond, GPRMM16OpndMoveP>,
1108                         MMR6Arch<"movep">;
1109 class SDBBP16_MMR6_DESC : BrkSdbbp16MM<"sdbbp16", II_SDBBP>, MMR6Arch<"sdbbp16">;
1110 class SUBU16_MMR6_DESC : ArithRMM16<"subu16", GPRMM16Opnd, 0, II_SUBU, sub>,
1111       MMR6Arch<"subu16"> {
1112   int AddedComplexity = 1;
1113 }
1114 class XOR16_MMR6_DESC : LogicRMM16<"xor16", GPRMM16Opnd, II_XOR>,
1115       MMR6Arch<"xor16">;
1116
1117 class LW_MMR6_DESC : MMR6Arch<"lw">, MipsR6Inst {
1118   dag OutOperandList = (outs GPR32Opnd:$rt);
1119   dag InOperandList = (ins mem:$addr);
1120   string AsmString = "lw\t$rt, $addr";
1121   let DecoderMethod = "DecodeMemMMImm16";
1122   let canFoldAsLoad = 1;
1123   let mayLoad = 1;
1124   list<dag> Pattern = [(set GPR32Opnd:$rt, (load addrDefault:$addr))];
1125   InstrItinClass Itinerary = II_LW;
1126 }
1127
1128 class LUI_MMR6_DESC : IsAsCheapAsAMove, MMR6Arch<"lui">, MipsR6Inst{
1129   dag OutOperandList = (outs GPR32Opnd:$rt);
1130   dag InOperandList = (ins uimm16:$imm16);
1131   string AsmString = "lui\t$rt, $imm16";
1132   list<dag> Pattern = [];
1133   bit hasSideEffects = 0;
1134   bit isReMaterializable = 1;
1135   InstrItinClass Itinerary = II_LUI;
1136   Format Form = FrmI;
1137 }
1138
1139 class SYNC_MMR6_DESC : MMR6Arch<"sync">, MipsR6Inst {
1140   dag OutOperandList = (outs);
1141   dag InOperandList = (ins uimm5:$stype);
1142   string AsmString = !strconcat("sync", "\t$stype");
1143   list<dag> Pattern = [(MipsSync immZExt5:$stype)];
1144   InstrItinClass Itinerary = II_SYNC;
1145   bit HasSideEffects = 1;
1146 }
1147
1148 class SYNCI_MMR6_DESC : SYNCI_FT<"synci", mem_mm_16> {
1149   let DecoderMethod = "DecodeSynciR6";
1150 }
1151
1152 class RDPGPR_MMR6_DESC : MMR6Arch<"rdpgpr">, MipsR6Inst {
1153   dag OutOperandList = (outs GPR32Opnd:$rt);
1154   dag InOperandList = (ins GPR32Opnd:$rd);
1155   string AsmString = !strconcat("rdpgpr", "\t$rt, $rd");
1156   InstrItinClass Itinerary = II_RDPGPR;
1157 }
1158
1159 class SDBBP_MMR6_DESC : MipsR6Inst {
1160   dag OutOperandList = (outs);
1161   dag InOperandList = (ins uimm20:$code_);
1162   string AsmString = !strconcat("sdbbp", "\t$code_");
1163   list<dag> Pattern = [];
1164   InstrItinClass Itinerary = II_SDBBP;
1165 }
1166
1167 class SIGRIE_MMR6_DESC : MipsR6Inst {
1168   dag OutOperandList = (outs);
1169   dag InOperandList = (ins uimm16:$code_);
1170   string AsmString = !strconcat("sigrie", "\t$code_");
1171   list<dag> Pattern = [];
1172   InstrItinClass Itinerary = II_SIGRIE;
1173 }
1174
1175 class LWM16_MMR6_DESC
1176     : MicroMipsInst16<(outs reglist16:$rt), (ins mem_mm_4sp:$addr),
1177                       !strconcat("lwm16", "\t$rt, $addr"), [],
1178                       II_LWM, FrmI>,
1179       MMR6Arch<"lwm16"> {
1180   let DecoderMethod = "DecodeMemMMReglistImm4Lsl2";
1181   let mayLoad = 1;
1182   ComplexPattern Addr = addr;
1183 }
1184
1185 class SWM16_MMR6_DESC
1186     : MicroMipsInst16<(outs), (ins reglist16:$rt, mem_mm_4sp:$addr),
1187                       !strconcat("swm16", "\t$rt, $addr"), [],
1188                       II_SWM, FrmI>,
1189       MMR6Arch<"swm16"> {
1190   let DecoderMethod = "DecodeMemMMReglistImm4Lsl2";
1191   let mayStore = 1;
1192   ComplexPattern Addr = addr;
1193 }
1194
1195 class SB16_MMR6_DESC_BASE<string opstr, DAGOperand RTOpnd, DAGOperand RO,
1196                           SDPatternOperator OpNode, InstrItinClass Itin,
1197                           Operand MemOpnd>
1198     : MicroMipsInst16<(outs), (ins RTOpnd:$rt, MemOpnd:$addr),
1199                       !strconcat(opstr, "\t$rt, $addr"), [], Itin, FrmI>,
1200       MMR6Arch<opstr> {
1201   let DecoderMethod = "DecodeMemMMImm4";
1202   let mayStore = 1;
1203 }
1204 class SB16_MMR6_DESC : SB16_MMR6_DESC_BASE<"sb16", GPRMM16OpndZero, GPRMM16Opnd,
1205                                            truncstorei8, II_SB, mem_mm_4>;
1206 class SH16_MMR6_DESC : SB16_MMR6_DESC_BASE<"sh16", GPRMM16OpndZero, GPRMM16Opnd,
1207                                            truncstorei16, II_SH, mem_mm_4_lsl1>;
1208 class SW16_MMR6_DESC : SB16_MMR6_DESC_BASE<"sw16", GPRMM16OpndZero, GPRMM16Opnd,
1209                                            store, II_SW, mem_mm_4_lsl2>;
1210
1211 class SWSP_MMR6_DESC
1212     : MicroMipsInst16<(outs), (ins GPR32Opnd:$rt, mem_mm_sp_imm5_lsl2:$offset),
1213                       !strconcat("sw", "\t$rt, $offset"), [], II_SW, FrmI>,
1214       MMR6Arch<"sw"> {
1215   let DecoderMethod = "DecodeMemMMSPImm5Lsl2";
1216   let mayStore = 1;
1217 }
1218
1219 class JALRC_HB_MMR6_DESC {
1220   dag OutOperandList = (outs GPR32Opnd:$rt);
1221   dag InOperandList = (ins GPR32Opnd:$rs);
1222   string AsmString = !strconcat("jalrc.hb", "\t$rt, $rs");
1223   list<dag> Pattern = [];
1224   InstrItinClass Itinerary = II_JALR_HB;
1225   Format Form = FrmJ;
1226   bit isIndirectBranch = 1;
1227   bit hasDelaySlot = 0;
1228 }
1229
1230 class TLBINV_MMR6_DESC_BASE<string opstr, InstrItinClass Itin> {
1231   dag OutOperandList = (outs);
1232   dag InOperandList = (ins);
1233   string AsmString = opstr;
1234   list<dag> Pattern = [];
1235   InstrItinClass Itinerary = Itin;
1236 }
1237
1238 class TLBINV_MMR6_DESC : TLBINV_MMR6_DESC_BASE<"tlbinv", II_TLBINV>;
1239 class TLBINVF_MMR6_DESC : TLBINV_MMR6_DESC_BASE<"tlbinvf", II_TLBINVF>;
1240
1241 class DVPEVP_MMR6_DESC_BASE<string opstr, InstrItinClass Itin> {
1242   dag OutOperandList = (outs GPR32Opnd:$rs);
1243   dag InOperandList = (ins);
1244   string AsmString = !strconcat(opstr, "\t$rs");
1245   list<dag> Pattern = [];
1246   InstrItinClass Itinerary = Itin;
1247   bit hasUnModeledSideEffects = 1;
1248 }
1249
1250 class DVP_MMR6_DESC : DVPEVP_MMR6_DESC_BASE<"dvp", II_DVP>;
1251 class EVP_MMR6_DESC : DVPEVP_MMR6_DESC_BASE<"evp", II_EVP>;
1252
1253 class BEQZC_MMR6_DESC
1254     : CMP_CBR_EQNE_Z_DESC_BASE<"beqzc", brtarget21_mm, GPR32Opnd>,
1255       MMR6Arch<"beqzc">;
1256 class BNEZC_MMR6_DESC
1257     : CMP_CBR_EQNE_Z_DESC_BASE<"bnezc", brtarget21_mm, GPR32Opnd>,
1258       MMR6Arch<"bnezc">;
1259
1260 class BRANCH_COP1_MMR6_DESC_BASE<string opstr> :
1261     InstSE<(outs), (ins FGR64Opnd:$rt, brtarget_mm:$offset),
1262            !strconcat(opstr, "\t$rt, $offset"), [], II_BC1CCZ, FrmI>,
1263     HARDFLOAT, BRANCH_DESC_BASE {
1264   list<Register> Defs = [AT];
1265 }
1266
1267 class BC1EQZC_MMR6_DESC : BRANCH_COP1_MMR6_DESC_BASE<"bc1eqzc">;
1268 class BC1NEZC_MMR6_DESC : BRANCH_COP1_MMR6_DESC_BASE<"bc1nezc">;
1269
1270 class BRANCH_COP2_MMR6_DESC_BASE<string opstr, InstrItinClass Itin>
1271     : BRANCH_DESC_BASE {
1272   dag InOperandList = (ins COP2Opnd:$rt, brtarget_mm:$offset);
1273   dag OutOperandList = (outs);
1274   string AsmString = !strconcat(opstr, "\t$rt, $offset");
1275   list<Register> Defs = [AT];
1276   InstrItinClass Itinerary = Itin;
1277 }
1278
1279 class BC2EQZC_MMR6_DESC : BRANCH_COP2_MMR6_DESC_BASE<"bc2eqzc", II_BC2CCZ>;
1280 class BC2NEZC_MMR6_DESC : BRANCH_COP2_MMR6_DESC_BASE<"bc2nezc", II_BC2CCZ>;
1281
1282 class EXT_MMR6_DESC {
1283   dag OutOperandList = (outs GPR32Opnd:$rt);
1284   dag InOperandList = (ins GPR32Opnd:$rs, uimm5:$pos, uimm5_plus1:$size);
1285   string AsmString = !strconcat("ext", "\t$rt, $rs, $pos, $size");
1286   list<dag> Pattern = [(set GPR32Opnd:$rt, (MipsExt GPR32Opnd:$rs, imm:$pos,
1287                        imm:$size))];
1288   InstrItinClass Itinerary = II_EXT;
1289   Format Form = FrmR;
1290   string BaseOpcode = "ext";
1291 }
1292
1293 class INS_MMR6_DESC {
1294   dag OutOperandList = (outs GPR32Opnd:$rt);
1295   dag InOperandList = (ins GPR32Opnd:$rs, uimm5:$pos, uimm5_inssize_plus1:$size,
1296                        GPR32Opnd:$src);
1297   string AsmString = !strconcat("ins", "\t$rt, $rs, $pos, $size");
1298   list<dag> Pattern = [(set GPR32Opnd:$rt, (MipsIns GPR32Opnd:$rs, imm:$pos,
1299                        imm:$size, GPR32Opnd:$src))];
1300   InstrItinClass Itinerary = II_INS;
1301   Format Form = FrmR;
1302   string BaseOpcode = "ins";
1303   string Constraints = "$src = $rt";
1304 }
1305
1306 class JALRC_MMR6_DESC {
1307   dag OutOperandList = (outs GPR32Opnd:$rt);
1308   dag InOperandList = (ins GPR32Opnd:$rs);
1309   string AsmString = !strconcat("jalrc", "\t$rt, $rs");
1310   list<dag> Pattern = [];
1311   InstrItinClass Itinerary = II_JALRC;
1312   bit isCall = 1;
1313   bit hasDelaySlot = 0;
1314   list<Register> Defs = [RA];
1315 }
1316
1317 class BOVC_BNVC_MMR6_DESC_BASE<string instr_asm, Operand opnd,
1318                                RegisterOperand GPROpnd>
1319     : BRANCH_DESC_BASE {
1320   dag InOperandList = (ins GPROpnd:$rt, GPROpnd:$rs, opnd:$offset);
1321   dag OutOperandList = (outs);
1322   string AsmString = !strconcat(instr_asm, "\t$rt, $rs, $offset");
1323   list<Register> Defs = [AT];
1324   InstrItinClass Itinerary = II_BCCC;
1325 }
1326
1327 class BOVC_MMR6_DESC : BOVC_BNVC_MMR6_DESC_BASE<"bovc", brtargetr6, GPR32Opnd>;
1328 class BNVC_MMR6_DESC : BOVC_BNVC_MMR6_DESC_BASE<"bnvc", brtargetr6, GPR32Opnd>;
1329
1330 //===----------------------------------------------------------------------===//
1331 //
1332 // Instruction Definitions
1333 //
1334 //===----------------------------------------------------------------------===//
1335
1336 let DecoderNamespace = "MicroMipsR6" in {
1337 def ADD_MMR6 : StdMMR6Rel, ADD_MMR6_DESC, ADD_MMR6_ENC, ISA_MICROMIPS32R6;
1338 def ADDIU_MMR6 : StdMMR6Rel, ADDIU_MMR6_DESC, ADDIU_MMR6_ENC, ISA_MICROMIPS32R6;
1339 def ADDU_MMR6 : StdMMR6Rel, ADDU_MMR6_DESC, ADDU_MMR6_ENC, ISA_MICROMIPS32R6;
1340 def ADDIUPC_MMR6 : R6MMR6Rel, ADDIUPC_MMR6_ENC, ADDIUPC_MMR6_DESC,
1341                    ISA_MICROMIPS32R6;
1342 def ALUIPC_MMR6 : R6MMR6Rel, ALUIPC_MMR6_ENC, ALUIPC_MMR6_DESC,
1343                   ISA_MICROMIPS32R6;
1344 def AND_MMR6 : StdMMR6Rel, AND_MMR6_DESC, AND_MMR6_ENC, ISA_MICROMIPS32R6;
1345 def ANDI_MMR6 : StdMMR6Rel, ANDI_MMR6_DESC, ANDI_MMR6_ENC, ISA_MICROMIPS32R6;
1346 def AUIPC_MMR6 : R6MMR6Rel, AUIPC_MMR6_ENC, AUIPC_MMR6_DESC, ISA_MICROMIPS32R6;
1347 def ALIGN_MMR6 : R6MMR6Rel, ALIGN_MMR6_ENC, ALIGN_MMR6_DESC, ISA_MICROMIPS32R6;
1348 def AUI_MMR6 : R6MMR6Rel, AUI_MMR6_ENC, AUI_MMR6_DESC, ISA_MICROMIPS32R6;
1349 def BALC_MMR6 : R6MMR6Rel, BALC_MMR6_ENC, BALC_MMR6_DESC, ISA_MICROMIPS32R6;
1350 def BC_MMR6 : R6MMR6Rel, BC_MMR6_ENC, BC_MMR6_DESC, ISA_MICROMIPS32R6;
1351 def BC16_MMR6 : StdMMR6Rel, BC16_MMR6_DESC, BC16_MMR6_ENC, ISA_MICROMIPS32R6;
1352 def BEQZC_MMR6 : R6MMR6Rel, BEQZC_MMR6_ENC, BEQZC_MMR6_DESC,
1353                  ISA_MICROMIPS32R6;
1354 def BEQZC16_MMR6 : StdMMR6Rel, BEQZC16_MMR6_DESC, BEQZC16_MMR6_ENC,
1355                    ISA_MICROMIPS32R6;
1356 def BNEZC_MMR6 : R6MMR6Rel, BNEZC_MMR6_ENC, BNEZC_MMR6_DESC,
1357                  ISA_MICROMIPS32R6;
1358 def BNEZC16_MMR6 : StdMMR6Rel, BNEZC16_MMR6_DESC, BNEZC16_MMR6_ENC,
1359                    ISA_MICROMIPS32R6;
1360 def BITSWAP_MMR6 : R6MMR6Rel, BITSWAP_MMR6_ENC, BITSWAP_MMR6_DESC,
1361                    ISA_MICROMIPS32R6;
1362 def BEQZALC_MMR6 : R6MMR6Rel, BEQZALC_MMR6_ENC, BEQZALC_MMR6_DESC,
1363                    ISA_MICROMIPS32R6;
1364 def BNEZALC_MMR6 : R6MMR6Rel, BNEZALC_MMR6_ENC, BNEZALC_MMR6_DESC,
1365                    ISA_MICROMIPS32R6;
1366 def BREAK_MMR6 : StdMMR6Rel, BRK_MMR6_DESC, BRK_MMR6_ENC, ISA_MICROMIPS32R6;
1367 def CACHE_MMR6 : R6MMR6Rel, CACHE_MMR6_ENC, CACHE_MMR6_DESC, ISA_MICROMIPS32R6;
1368 def CLO_MMR6 : R6MMR6Rel, CLO_MMR6_ENC, CLO_MMR6_DESC, ISA_MICROMIPS32R6;
1369 def CLZ_MMR6 : R6MMR6Rel, CLZ_MMR6_ENC, CLZ_MMR6_DESC, ISA_MICROMIPS32R6;
1370 def DIV_MMR6 : R6MMR6Rel, DIV_MMR6_DESC, DIV_MMR6_ENC, ISA_MICROMIPS32R6;
1371 def DIVU_MMR6 : R6MMR6Rel, DIVU_MMR6_DESC, DIVU_MMR6_ENC, ISA_MICROMIPS32R6;
1372 def EHB_MMR6 : StdMMR6Rel, EHB_MMR6_DESC, EHB_MMR6_ENC, ISA_MICROMIPS32R6;
1373 def EI_MMR6 : StdMMR6Rel, EI_MMR6_DESC, EI_MMR6_ENC, ISA_MICROMIPS32R6;
1374 def DI_MMR6 : StdMMR6Rel, DI_MMR6_DESC, DI_MMR6_ENC, ISA_MICROMIPS32R6;
1375 def ERET_MMR6 : StdMMR6Rel, ERET_MMR6_DESC, ERET_MMR6_ENC, ISA_MICROMIPS32R6;
1376 def DERET_MMR6 : StdMMR6Rel, DERET_MMR6_DESC, DERET_MMR6_ENC, ISA_MICROMIPS32R6;
1377 def ERETNC_MMR6 : R6MMR6Rel, ERETNC_MMR6_DESC, ERETNC_MMR6_ENC,
1378                   ISA_MICROMIPS32R6;
1379 def GINVI_MMR6 : R6MMR6Rel, GINVI_MMR6_ENC, GINVI_MMR6_DESC,
1380                  ISA_MICROMIPS32R6, ASE_GINV;
1381 def GINVT_MMR6 : R6MMR6Rel, GINVT_MMR6_ENC, GINVT_MMR6_DESC,
1382                  ISA_MICROMIPS32R6, ASE_GINV;
1383 let FastISelShouldIgnore = 1 in
1384 def JALRC16_MMR6 : R6MMR6Rel, JALRC16_MMR6_DESC, JALRC16_MMR6_ENC,
1385                    ISA_MICROMIPS32R6;
1386 def JIALC_MMR6 : R6MMR6Rel, JIALC_MMR6_ENC, JIALC_MMR6_DESC, ISA_MICROMIPS32R6;
1387 def JIC_MMR6 : R6MMR6Rel, JIC_MMR6_ENC, JIC_MMR6_DESC, ISA_MICROMIPS32R6;
1388 def JRC16_MMR6 : R6MMR6Rel, JRC16_MMR6_DESC, JRC16_MMR6_ENC, ISA_MICROMIPS32R6;
1389 def JRCADDIUSP_MMR6 : R6MMR6Rel, JRCADDIUSP_MMR6_DESC, JRCADDIUSP_MMR6_ENC,
1390                       ISA_MICROMIPS32R6;
1391 def LSA_MMR6 : R6MMR6Rel, LSA_MMR6_ENC, LSA_MMR6_DESC, ISA_MICROMIPS32R6;
1392 def LWPC_MMR6 : R6MMR6Rel, LWPC_MMR6_ENC, LWPC_MMR6_DESC, ISA_MICROMIPS32R6;
1393 def LWM16_MMR6 : StdMMR6Rel, LWM16_MMR6_DESC, LWM16_MMR6_ENC, ISA_MICROMIPS32R6;
1394 def MTC0_MMR6 : StdMMR6Rel, MTC0_MMR6_ENC, MTC0_MMR6_DESC, ISA_MICROMIPS32R6;
1395 def MTC1_MMR6 : StdMMR6Rel, MTC1_MMR6_DESC, MTC1_MMR6_ENC, ISA_MICROMIPS32R6;
1396 def MTC2_MMR6 : StdMMR6Rel, MTC2_MMR6_ENC, MTC2_MMR6_DESC, ISA_MICROMIPS32R6;
1397 def MTHC0_MMR6 : R6MMR6Rel, MTHC0_MMR6_ENC, MTHC0_MMR6_DESC, ISA_MICROMIPS32R6;
1398 def MTHC2_MMR6 : StdMMR6Rel, MTHC2_MMR6_ENC, MTHC2_MMR6_DESC, ISA_MICROMIPS32R6;
1399 def MFC0_MMR6 : StdMMR6Rel, MFC0_MMR6_ENC, MFC0_MMR6_DESC, ISA_MICROMIPS32R6;
1400 def MFC1_MMR6 : StdMMR6Rel, MFC1_MMR6_DESC, MFC1_MMR6_ENC, ISA_MICROMIPS32R6;
1401 def MFC2_MMR6 : StdMMR6Rel, MFC2_MMR6_ENC, MFC2_MMR6_DESC, ISA_MICROMIPS32R6;
1402 def MFHC0_MMR6 : R6MMR6Rel, MFHC0_MMR6_ENC, MFHC0_MMR6_DESC, ISA_MICROMIPS32R6;
1403 def MFHC2_MMR6 : StdMMR6Rel, MFHC2_MMR6_ENC, MFHC2_MMR6_DESC, ISA_MICROMIPS32R6;
1404 def MOD_MMR6 : R6MMR6Rel, MOD_MMR6_DESC, MOD_MMR6_ENC, ISA_MICROMIPS32R6;
1405 def MODU_MMR6 : R6MMR6Rel, MODU_MMR6_DESC, MODU_MMR6_ENC, ISA_MICROMIPS32R6;
1406 def MUL_MMR6 : R6MMR6Rel, MUL_MMR6_DESC, MUL_MMR6_ENC, ISA_MICROMIPS32R6;
1407 def MUH_MMR6 : R6MMR6Rel, MUH_MMR6_DESC, MUH_MMR6_ENC, ISA_MICROMIPS32R6;
1408 def MULU_MMR6 : R6MMR6Rel, MULU_MMR6_DESC, MULU_MMR6_ENC, ISA_MICROMIPS32R6;
1409 def MUHU_MMR6 : R6MMR6Rel, MUHU_MMR6_DESC, MUHU_MMR6_ENC, ISA_MICROMIPS32R6;
1410 def NOR_MMR6 : StdMMR6Rel, NOR_MMR6_DESC, NOR_MMR6_ENC, ISA_MICROMIPS32R6;
1411 def OR_MMR6 : StdMMR6Rel, OR_MMR6_DESC, OR_MMR6_ENC, ISA_MICROMIPS32R6;
1412 def ORI_MMR6 : StdMMR6Rel, ORI_MMR6_DESC, ORI_MMR6_ENC, ISA_MICROMIPS32R6;
1413 def PREF_MMR6 : R6MMR6Rel, PREF_MMR6_ENC, PREF_MMR6_DESC, ISA_MICROMIPS32R6;
1414 def SB16_MMR6 : StdMMR6Rel, SB16_MMR6_DESC, SB16_MMR6_ENC, ISA_MICROMIPS32R6;
1415 def SELEQZ_MMR6 : R6MMR6Rel, SELEQZ_MMR6_ENC, SELEQZ_MMR6_DESC,
1416                   ISA_MICROMIPS32R6;
1417 def SELNEZ_MMR6 : R6MMR6Rel, SELNEZ_MMR6_ENC, SELNEZ_MMR6_DESC,
1418                   ISA_MICROMIPS32R6;
1419 def SH16_MMR6 : StdMMR6Rel, SH16_MMR6_DESC, SH16_MMR6_ENC, ISA_MICROMIPS32R6;
1420 def SLL_MMR6 : StdMMR6Rel, SLL_MMR6_DESC, SLL_MMR6_ENC, ISA_MICROMIPS32R6;
1421 def SUB_MMR6 : StdMMR6Rel, SUB_MMR6_DESC, SUB_MMR6_ENC, ISA_MICROMIPS32R6;
1422 def SUBU_MMR6 : StdMMR6Rel, SUBU_MMR6_DESC, SUBU_MMR6_ENC, ISA_MICROMIPS32R6;
1423 def SW16_MMR6 : StdMMR6Rel, SW16_MMR6_DESC, SW16_MMR6_ENC, ISA_MICROMIPS32R6;
1424 def SWM16_MMR6 : StdMMR6Rel, SWM16_MMR6_DESC, SWM16_MMR6_ENC, ISA_MICROMIPS32R6;
1425 def SWSP_MMR6 : StdMMR6Rel, SWSP_MMR6_DESC, SWSP_MMR6_ENC, ISA_MICROMIPS32R6;
1426 def WRPGPR_MMR6 : StdMMR6Rel, WRPGPR_MMR6_ENC, WRPGPR_MMR6_DESC,
1427                   ISA_MICROMIPS32R6;
1428 def WSBH_MMR6 : StdMMR6Rel, WSBH_MMR6_ENC, WSBH_MMR6_DESC, ISA_MICROMIPS32R6;
1429 def LB_MMR6 : R6MMR6Rel, LB_MMR6_ENC, LB_MMR6_DESC, ISA_MICROMIPS32R6;
1430 def LBU_MMR6 : R6MMR6Rel, LBU_MMR6_ENC, LBU_MMR6_DESC, ISA_MICROMIPS32R6;
1431 def PAUSE_MMR6 : StdMMR6Rel, PAUSE_MMR6_DESC, PAUSE_MMR6_ENC, ISA_MICROMIPS32R6;
1432 def RDHWR_MMR6 : R6MMR6Rel, RDHWR_MMR6_DESC, RDHWR_MMR6_ENC, ISA_MICROMIPS32R6;
1433 def WAIT_MMR6 : StdMMR6Rel, WAIT_MMR6_DESC, WAIT_MMR6_ENC, ISA_MICROMIPS32R6;
1434 def SSNOP_MMR6 : StdMMR6Rel, SSNOP_MMR6_DESC, SSNOP_MMR6_ENC, ISA_MICROMIPS32R6;
1435 def SYNC_MMR6 : StdMMR6Rel, SYNC_MMR6_DESC, SYNC_MMR6_ENC, ISA_MICROMIPS32R6;
1436 def SYNCI_MMR6 : StdMMR6Rel, SYNCI_MMR6_DESC, SYNCI_MMR6_ENC, ISA_MICROMIPS32R6;
1437 def RDPGPR_MMR6 : R6MMR6Rel, RDPGPR_MMR6_DESC, RDPGPR_MMR6_ENC,
1438                   ISA_MICROMIPS32R6;
1439 def SDBBP_MMR6 : R6MMR6Rel, SDBBP_MMR6_DESC, SDBBP_MMR6_ENC, ISA_MICROMIPS32R6;
1440 def SIGRIE_MMR6 : R6MMR6Rel, SIGRIE_MMR6_DESC, SIGRIE_MMR6_ENC, ISA_MICROMIPS32R6;
1441 def XOR_MMR6 : StdMMR6Rel, XOR_MMR6_DESC, XOR_MMR6_ENC, ISA_MICROMIPS32R6;
1442 def XORI_MMR6 : StdMMR6Rel, XORI_MMR6_DESC, XORI_MMR6_ENC, ISA_MICROMIPS32R6;
1443 let DecoderMethod = "DecodeMemMMImm16" in {
1444   def SW_MMR6 : StdMMR6Rel, SW_MMR6_DESC, SW_MMR6_ENC, ISA_MICROMIPS32R6;
1445 }
1446 /// Floating Point Instructions
1447 def FADD_S_MMR6 : StdMMR6Rel, FADD_S_MMR6_ENC, FADD_S_MMR6_DESC,
1448                   ISA_MICROMIPS32R6;
1449 def FSUB_S_MMR6 : StdMMR6Rel, FSUB_S_MMR6_ENC, FSUB_S_MMR6_DESC,
1450                   ISA_MICROMIPS32R6;
1451 def FMUL_S_MMR6 : StdMMR6Rel, FMUL_S_MMR6_ENC, FMUL_S_MMR6_DESC,
1452                   ISA_MICROMIPS32R6;
1453 def FDIV_S_MMR6 : StdMMR6Rel, FDIV_S_MMR6_ENC, FDIV_S_MMR6_DESC,
1454                   ISA_MICROMIPS32R6;
1455 def MADDF_S_MMR6 : R6MMR6Rel, MADDF_S_MMR6_ENC, MADDF_S_MMR6_DESC,
1456                    ISA_MICROMIPS32R6;
1457 def MADDF_D_MMR6 : R6MMR6Rel, MADDF_D_MMR6_ENC, MADDF_D_MMR6_DESC,
1458                    ISA_MICROMIPS32R6;
1459 def MSUBF_S_MMR6 : R6MMR6Rel, MSUBF_S_MMR6_ENC, MSUBF_S_MMR6_DESC,
1460                    ISA_MICROMIPS32R6;
1461 def MSUBF_D_MMR6 : R6MMR6Rel, MSUBF_D_MMR6_ENC, MSUBF_D_MMR6_DESC,
1462                    ISA_MICROMIPS32R6;
1463 def FMOV_S_MMR6 : StdMMR6Rel, FMOV_S_MMR6_ENC, FMOV_S_MMR6_DESC,
1464                   ISA_MICROMIPS32R6;
1465 def FNEG_S_MMR6 : StdMMR6Rel, FNEG_S_MMR6_ENC, FNEG_S_MMR6_DESC,
1466                   ISA_MICROMIPS32R6;
1467 def MAX_S_MMR6 : R6MMR6Rel, MAX_S_MMR6_ENC, MAX_S_MMR6_DESC, ISA_MICROMIPS32R6;
1468 def MAX_D_MMR6 : R6MMR6Rel, MAX_D_MMR6_ENC, MAX_D_MMR6_DESC, ISA_MICROMIPS32R6;
1469 def MIN_S_MMR6 : R6MMR6Rel, MIN_S_MMR6_ENC, MIN_S_MMR6_DESC, ISA_MICROMIPS32R6;
1470 def MIN_D_MMR6 : R6MMR6Rel, MIN_D_MMR6_ENC, MIN_D_MMR6_DESC, ISA_MICROMIPS32R6;
1471 def MAXA_S_MMR6 : R6MMR6Rel, MAXA_S_MMR6_ENC, MAXA_S_MMR6_DESC,
1472                   ISA_MICROMIPS32R6;
1473 def MAXA_D_MMR6 : R6MMR6Rel, MAXA_D_MMR6_ENC, MAXA_D_MMR6_DESC,
1474                   ISA_MICROMIPS32R6;
1475 def MINA_S_MMR6 : R6MMR6Rel, MINA_S_MMR6_ENC, MINA_S_MMR6_DESC,
1476                   ISA_MICROMIPS32R6;
1477 def MINA_D_MMR6 : R6MMR6Rel, MINA_D_MMR6_ENC, MINA_D_MMR6_DESC,
1478                   ISA_MICROMIPS32R6;
1479 def CVT_L_S_MMR6 : StdMMR6Rel, CVT_L_S_MMR6_ENC, CVT_L_S_MMR6_DESC,
1480                    ISA_MICROMIPS32R6;
1481 def CVT_L_D_MMR6 : StdMMR6Rel, CVT_L_D_MMR6_ENC, CVT_L_D_MMR6_DESC,
1482                    ISA_MICROMIPS32R6;
1483 def CVT_W_S_MMR6 : StdMMR6Rel, CVT_W_S_MMR6_ENC, CVT_W_S_MMR6_DESC,
1484                    ISA_MICROMIPS32R6;
1485 def CVT_D_L_MMR6 : StdMMR6Rel, CVT_D_L_MMR6_ENC, CVT_D_L_MMR6_DESC,
1486                    ISA_MICROMIPS32R6;
1487 def CVT_S_W_MMR6 : StdMMR6Rel, CVT_S_W_MMR6_ENC, CVT_S_W_MMR6_DESC,
1488                    ISA_MICROMIPS32R6;
1489 def CVT_S_L_MMR6 : StdMMR6Rel, CVT_S_L_MMR6_ENC, CVT_S_L_MMR6_DESC,
1490                    ISA_MICROMIPS32R6;
1491 defm S_MMR6 : CMP_CC_MMR6<0b000101, "s", FGR32Opnd, II_CMP_CC_S>;
1492 defm D_MMR6 : CMP_CC_MMR6<0b010101, "d", FGR64Opnd, II_CMP_CC_D>;
1493 def FLOOR_L_S_MMR6 : StdMMR6Rel, FLOOR_L_S_MMR6_ENC, FLOOR_L_S_MMR6_DESC,
1494                      ISA_MICROMIPS32R6;
1495 def FLOOR_L_D_MMR6 : StdMMR6Rel, FLOOR_L_D_MMR6_ENC, FLOOR_L_D_MMR6_DESC,
1496                      ISA_MICROMIPS32R6;
1497 def FLOOR_W_S_MMR6 : StdMMR6Rel, FLOOR_W_S_MMR6_ENC, FLOOR_W_S_MMR6_DESC,
1498                      ISA_MICROMIPS32R6;
1499 def FLOOR_W_D_MMR6 : StdMMR6Rel, FLOOR_W_D_MMR6_ENC, FLOOR_W_D_MMR6_DESC,
1500                      ISA_MICROMIPS32R6;
1501 def CEIL_L_S_MMR6 : StdMMR6Rel, CEIL_L_S_MMR6_ENC, CEIL_L_S_MMR6_DESC,
1502                     ISA_MICROMIPS32R6;
1503 def CEIL_L_D_MMR6 : StdMMR6Rel, CEIL_L_D_MMR6_ENC, CEIL_L_D_MMR6_DESC,
1504                     ISA_MICROMIPS32R6;
1505 def CEIL_W_S_MMR6 : StdMMR6Rel, CEIL_W_S_MMR6_ENC, CEIL_W_S_MMR6_DESC,
1506                     ISA_MICROMIPS32R6;
1507 def CEIL_W_D_MMR6 : StdMMR6Rel, CEIL_W_D_MMR6_ENC, CEIL_W_D_MMR6_DESC,
1508                     ISA_MICROMIPS32R6;
1509 def TRUNC_L_S_MMR6 : StdMMR6Rel, TRUNC_L_S_MMR6_ENC, TRUNC_L_S_MMR6_DESC,
1510                      ISA_MICROMIPS32R6;
1511 def TRUNC_L_D_MMR6 : StdMMR6Rel, TRUNC_L_D_MMR6_ENC, TRUNC_L_D_MMR6_DESC,
1512                      ISA_MICROMIPS32R6;
1513 def TRUNC_W_S_MMR6 : StdMMR6Rel, TRUNC_W_S_MMR6_ENC, TRUNC_W_S_MMR6_DESC,
1514                      ISA_MICROMIPS32R6;
1515 def TRUNC_W_D_MMR6 : StdMMR6Rel, TRUNC_W_D_MMR6_ENC, TRUNC_W_D_MMR6_DESC,
1516                      ISA_MICROMIPS32R6;
1517 def SB_MMR6 : StdMMR6Rel, SB_MMR6_DESC, SB_MMR6_ENC, ISA_MICROMIPS32R6;
1518 def SH_MMR6 : StdMMR6Rel, SH_MMR6_DESC, SH_MMR6_ENC, ISA_MICROMIPS32R6;
1519 def LW_MMR6 : StdMMR6Rel, LW_MMR6_DESC, LW_MMR6_ENC, ISA_MICROMIPS32R6;
1520 def LUI_MMR6 : R6MMR6Rel, LUI_MMR6_DESC, LUI_MMR6_ENC, ISA_MICROMIPS32R6;
1521 def ADDU16_MMR6 : StdMMR6Rel, ADDU16_MMR6_DESC, ADDU16_MMR6_ENC,
1522                   ISA_MICROMIPS32R6;
1523 def AND16_MMR6 : StdMMR6Rel, AND16_MMR6_DESC, AND16_MMR6_ENC,
1524                   ISA_MICROMIPS32R6;
1525 def ANDI16_MMR6 : StdMMR6Rel, ANDI16_MMR6_DESC, ANDI16_MMR6_ENC,
1526                   ISA_MICROMIPS32R6;
1527 def NOT16_MMR6 : StdMMR6Rel, NOT16_MMR6_DESC, NOT16_MMR6_ENC,
1528                   ISA_MICROMIPS32R6;
1529 def OR16_MMR6 : StdMMR6Rel, OR16_MMR6_DESC, OR16_MMR6_ENC,
1530                   ISA_MICROMIPS32R6;
1531 def SLL16_MMR6 : StdMMR6Rel, SLL16_MMR6_DESC, SLL16_MMR6_ENC,
1532                   ISA_MICROMIPS32R6;
1533 def SRL16_MMR6 : StdMMR6Rel, SRL16_MMR6_DESC, SRL16_MMR6_ENC,
1534                   ISA_MICROMIPS32R6;
1535 def BREAK16_MMR6 : StdMMR6Rel, BREAK16_MMR6_DESC, BREAK16_MMR6_ENC,
1536                    ISA_MICROMIPS32R6;
1537 def LI16_MMR6 : StdMMR6Rel, LI16_MMR6_DESC, LI16_MMR6_ENC,
1538                 ISA_MICROMIPS32R6;
1539 def MOVE16_MMR6 : StdMMR6Rel, MOVE16_MMR6_DESC, MOVE16_MMR6_ENC,
1540                   ISA_MICROMIPS32R6;
1541 def MOVEP_MMR6  : StdMMR6Rel, MOVEP_MMR6_DESC, MOVEP_MMR6_ENC,
1542                   ISA_MICROMIPS32R6;
1543 def SDBBP16_MMR6 : StdMMR6Rel, SDBBP16_MMR6_DESC, SDBBP16_MMR6_ENC,
1544                    ISA_MICROMIPS32R6;
1545 def SUBU16_MMR6 : StdMMR6Rel, SUBU16_MMR6_DESC, SUBU16_MMR6_ENC,
1546                   ISA_MICROMIPS32R6;
1547 def XOR16_MMR6 : StdMMR6Rel, XOR16_MMR6_DESC, XOR16_MMR6_ENC,
1548                  ISA_MICROMIPS32R6;
1549 def JALRC_HB_MMR6 : R6MMR6Rel, JALRC_HB_MMR6_ENC, JALRC_HB_MMR6_DESC,
1550                     ISA_MICROMIPS32R6;
1551 def EXT_MMR6 : StdMMR6Rel, EXT_MMR6_ENC, EXT_MMR6_DESC, ISA_MICROMIPS32R6;
1552 def INS_MMR6 : StdMMR6Rel, INS_MMR6_ENC, INS_MMR6_DESC, ISA_MICROMIPS32R6;
1553 def JALRC_MMR6 : R6MMR6Rel, JALRC_MMR6_ENC, JALRC_MMR6_DESC, ISA_MICROMIPS32R6;
1554 def RINT_S_MMR6 : StdMMR6Rel, RINT_S_MMR6_ENC, RINT_S_MMR6_DESC,
1555                   ISA_MICROMIPS32R6;
1556 def RINT_D_MMR6 : StdMMR6Rel, RINT_D_MMR6_ENC, RINT_D_MMR6_DESC, ISA_MICROMIPS32R6;
1557 def ROUND_L_S_MMR6 : StdMMR6Rel, ROUND_L_S_MMR6_ENC, ROUND_L_S_MMR6_DESC,
1558                      ISA_MICROMIPS32R6;
1559 def ROUND_L_D_MMR6 : StdMMR6Rel, ROUND_L_D_MMR6_ENC, ROUND_L_D_MMR6_DESC,
1560                      ISA_MICROMIPS32R6;
1561 def ROUND_W_S_MMR6 : StdMMR6Rel, ROUND_W_S_MMR6_ENC, ROUND_W_S_MMR6_DESC,
1562                      ISA_MICROMIPS32R6;
1563 def ROUND_W_D_MMR6 : StdMMR6Rel, ROUND_W_D_MMR6_ENC, ROUND_W_D_MMR6_DESC,
1564                      ISA_MICROMIPS32R6;
1565 def SEL_S_MMR6 : R6MMR6Rel, SEL_S_MMR6_ENC, SEL_S_MMR6_DESC, ISA_MICROMIPS32R6;
1566 def SEL_D_MMR6 : R6MMR6Rel, SEL_D_MMR6_ENC, SEL_D_MMR6_DESC, ISA_MICROMIPS32R6;
1567 def SELEQZ_S_MMR6 : R6MMR6Rel, SELEQZ_S_MMR6_ENC, SELEQZ_S_MMR6_DESC,
1568                     ISA_MICROMIPS32R6;
1569 def SELEQZ_D_MMR6 : R6MMR6Rel, SELEQZ_D_MMR6_ENC, SELEQZ_D_MMR6_DESC,
1570                     ISA_MICROMIPS32R6;
1571 def SELNEZ_S_MMR6 : R6MMR6Rel, SELNEZ_S_MMR6_ENC, SELNEZ_S_MMR6_DESC,
1572                     ISA_MICROMIPS32R6;
1573 def SELNEZ_D_MMR6 : R6MMR6Rel, SELNEZ_D_MMR6_ENC, SELNEZ_D_MMR6_DESC,
1574                     ISA_MICROMIPS32R6;
1575 def CLASS_S_MMR6 : StdMMR6Rel, CLASS_S_MMR6_ENC, CLASS_S_MMR6_DESC,
1576                    ISA_MICROMIPS32R6;
1577 def CLASS_D_MMR6 : StdMMR6Rel, CLASS_D_MMR6_ENC, CLASS_D_MMR6_DESC,
1578                    ISA_MICROMIPS32R6;
1579 def TLBINV_MMR6 : StdMMR6Rel, TLBINV_MMR6_ENC, TLBINV_MMR6_DESC,
1580                   ISA_MICROMIPS32R6;
1581 def TLBINVF_MMR6 : StdMMR6Rel, TLBINVF_MMR6_ENC, TLBINVF_MMR6_DESC,
1582                    ISA_MICROMIPS32R6;
1583 def DVP_MMR6 : R6MMR6Rel, DVP_MMR6_ENC, DVP_MMR6_DESC, ISA_MICROMIPS32R6;
1584 def EVP_MMR6 : R6MMR6Rel, EVP_MMR6_ENC, EVP_MMR6_DESC, ISA_MICROMIPS32R6;
1585 def BC1EQZC_MMR6 : R6MMR6Rel, BC1EQZC_MMR6_DESC, BC1EQZC_MMR6_ENC,
1586                    ISA_MICROMIPS32R6;
1587 def BC1NEZC_MMR6 : R6MMR6Rel, BC1NEZC_MMR6_DESC, BC1NEZC_MMR6_ENC,
1588                    ISA_MICROMIPS32R6;
1589 def BC2EQZC_MMR6 : R6MMR6Rel, MipsR6Inst, BC2EQZC_MMR6_ENC, BC2EQZC_MMR6_DESC,
1590                    ISA_MICROMIPS32R6;
1591 def BC2NEZC_MMR6 : R6MMR6Rel, MipsR6Inst, BC2NEZC_MMR6_ENC, BC2NEZC_MMR6_DESC,
1592                    ISA_MICROMIPS32R6;
1593 let DecoderNamespace = "MicroMipsFP64" in {
1594   def LDC1_D64_MMR6 : StdMMR6Rel, LDC1_D64_MMR6_DESC, LDC1_MMR6_ENC,
1595                       ISA_MICROMIPS32R6 {
1596     let BaseOpcode = "LDC164";
1597   }
1598   def SDC1_D64_MMR6 : StdMMR6Rel, SDC1_D64_MMR6_DESC, SDC1_MMR6_ENC,
1599                       ISA_MICROMIPS32R6;
1600 }
1601 def LDC2_MMR6 : StdMMR6Rel, LDC2_MMR6_ENC, LDC2_MMR6_DESC, ISA_MICROMIPS32R6;
1602 def SDC2_MMR6 : StdMMR6Rel, SDC2_MMR6_ENC, SDC2_MMR6_DESC, ISA_MICROMIPS32R6;
1603 def LWC2_MMR6 : StdMMR6Rel, LWC2_MMR6_ENC, LWC2_MMR6_DESC, ISA_MICROMIPS32R6;
1604 def SWC2_MMR6 : StdMMR6Rel, SWC2_MMR6_ENC, SWC2_MMR6_DESC, ISA_MICROMIPS32R6;
1605 def LL_MMR6   : R6MMR6Rel, LL_MMR6_ENC, LL_MMR6_DESC, ISA_MICROMIPS32R6;
1606 def SC_MMR6   : R6MMR6Rel, SC_MMR6_ENC, SC_MMR6_DESC, ISA_MICROMIPS32R6;
1607 }
1608
1609 def BOVC_MMR6 : R6MMR6Rel, BOVC_MMR6_ENC, BOVC_MMR6_DESC, ISA_MICROMIPS32R6,
1610                 MMDecodeDisambiguatedBy<"POP35GroupBranchMMR6">;
1611 def BNVC_MMR6 : R6MMR6Rel, BNVC_MMR6_ENC, BNVC_MMR6_DESC, ISA_MICROMIPS32R6,
1612                 MMDecodeDisambiguatedBy<"POP37GroupBranchMMR6">;
1613 def BGEC_MMR6 : R6MMR6Rel, BGEC_MMR6_ENC, BGEC_MMR6_DESC, ISA_MICROMIPS32R6;
1614 def BGEUC_MMR6 : R6MMR6Rel, BGEUC_MMR6_ENC, BGEUC_MMR6_DESC, ISA_MICROMIPS32R6;
1615 def BLTC_MMR6 : R6MMR6Rel, BLTC_MMR6_ENC, BLTC_MMR6_DESC, ISA_MICROMIPS32R6;
1616 def BLTUC_MMR6 : R6MMR6Rel, BLTUC_MMR6_ENC, BLTUC_MMR6_DESC, ISA_MICROMIPS32R6;
1617 def BEQC_MMR6 : R6MMR6Rel, BEQC_MMR6_ENC, BEQC_MMR6_DESC, ISA_MICROMIPS32R6,
1618                 DecodeDisambiguates<"POP35GroupBranchMMR6">;
1619 def BNEC_MMR6 : R6MMR6Rel, BNEC_MMR6_ENC, BNEC_MMR6_DESC, ISA_MICROMIPS32R6,
1620                 DecodeDisambiguates<"POP37GroupBranchMMR6">;
1621 def BLTZC_MMR6 : R6MMR6Rel, BLTZC_MMR6_ENC, BLTZC_MMR6_DESC, ISA_MICROMIPS32R6;
1622 def BLEZC_MMR6 : R6MMR6Rel, BLEZC_MMR6_ENC, BLEZC_MMR6_DESC, ISA_MICROMIPS32R6;
1623 def BGEZC_MMR6 : R6MMR6Rel, BGEZC_MMR6_ENC, BGEZC_MMR6_DESC, ISA_MICROMIPS32R6;
1624 def BGTZC_MMR6 : R6MMR6Rel, BGTZC_MMR6_ENC, BGTZC_MMR6_DESC, ISA_MICROMIPS32R6;
1625 def BGEZALC_MMR6 : R6MMR6Rel, BGEZALC_MMR6_ENC, BGEZALC_MMR6_DESC,
1626                    ISA_MICROMIPS32R6;
1627 def BGTZALC_MMR6 : R6MMR6Rel, BGTZALC_MMR6_ENC, BGTZALC_MMR6_DESC,
1628                    ISA_MICROMIPS32R6;
1629 def BLEZALC_MMR6 : R6MMR6Rel, BLEZALC_MMR6_ENC, BLEZALC_MMR6_DESC,
1630                    ISA_MICROMIPS32R6;
1631 def BLTZALC_MMR6 : R6MMR6Rel, BLTZALC_MMR6_ENC, BLTZALC_MMR6_DESC,
1632                    ISA_MICROMIPS32R6;
1633
1634 //===----------------------------------------------------------------------===//
1635 //
1636 // MicroMips instruction aliases
1637 //
1638 //===----------------------------------------------------------------------===//
1639
1640 def : MipsInstAlias<"ei", (EI_MMR6 ZERO), 1>, ISA_MICROMIPS32R6;
1641 def : MipsInstAlias<"di", (DI_MMR6 ZERO), 1>, ISA_MICROMIPS32R6;
1642 def : MipsInstAlias<"nop", (SLL_MMR6 ZERO, ZERO, 0), 1>, ISA_MICROMIPS32R6;
1643 def B_MMR6_Pseudo : MipsAsmPseudoInst<(outs), (ins brtarget_mm:$offset),
1644                                       !strconcat("b", "\t$offset")> {
1645   string DecoderNamespace = "MicroMipsR6";
1646 }
1647 def : MipsInstAlias<"sync", (SYNC_MMR6 0), 1>, ISA_MICROMIPS32R6;
1648 def : MipsInstAlias<"sdbbp", (SDBBP_MMR6 0), 1>, ISA_MICROMIPS32R6;
1649 def : MipsInstAlias<"sigrie", (SIGRIE_MMR6 0), 1>, ISA_MICROMIPS32R6;
1650 def : MipsInstAlias<"rdhwr $rt, $rs",
1651                     (RDHWR_MMR6 GPR32Opnd:$rt, HWRegsOpnd:$rs, 0), 1>,
1652                     ISA_MICROMIPS32R6;
1653 def : MipsInstAlias<"mtc0 $rt, $rs",
1654                     (MTC0_MMR6 COP0Opnd:$rs, GPR32Opnd:$rt, 0), 0>,
1655                     ISA_MICROMIPS32R6;
1656 def : MipsInstAlias<"mthc0 $rt, $rs",
1657                     (MTHC0_MMR6 COP0Opnd:$rs, GPR32Opnd:$rt, 0), 0>,
1658                     ISA_MICROMIPS32R6;
1659 def : MipsInstAlias<"mfc0 $rt, $rs",
1660                     (MFC0_MMR6 GPR32Opnd:$rt, COP0Opnd:$rs, 0), 0>,
1661                     ISA_MICROMIPS32R6;
1662 def : MipsInstAlias<"mfhc0 $rt, $rs",
1663                     (MFHC0_MMR6 GPR32Opnd:$rt, COP0Opnd:$rs, 0), 0>,
1664                     ISA_MICROMIPS32R6;
1665 def : MipsInstAlias<"jalrc.hb $rs", (JALRC_HB_MMR6 RA, GPR32Opnd:$rs), 1>,
1666                     ISA_MICROMIPS32R6;
1667 def : MipsInstAlias<"jal $offset", (BALC_MMR6 brtarget26_mm:$offset), 0>,
1668                     ISA_MICROMIPS32R6;
1669 def : MipsInstAlias<"dvp", (DVP_MMR6 ZERO), 0>, ISA_MICROMIPS32R6;
1670 def : MipsInstAlias<"evp", (EVP_MMR6 ZERO), 0>, ISA_MICROMIPS32R6;
1671 def : MipsInstAlias<"jalrc $rs", (JALRC_MMR6 RA, GPR32Opnd:$rs), 1>,
1672       ISA_MICROMIPS32R6;
1673 def : MipsInstAlias<"and $rs, $rt, $imm",
1674                     (ANDI_MMR6 GPR32Opnd:$rs, GPR32Opnd:$rt, uimm16:$imm), 0>,
1675                     ISA_MICROMIPS32R6;
1676 def : MipsInstAlias<"and $rs, $imm",
1677                     (ANDI_MMR6 GPR32Opnd:$rs, GPR32Opnd:$rs, uimm16:$imm), 0>,
1678                     ISA_MICROMIPS32R6;
1679 def : MipsInstAlias<"or $rs, $rt, $imm",
1680                     (ORI_MMR6 GPR32Opnd:$rs, GPR32Opnd:$rt, uimm16:$imm), 0>,
1681                     ISA_MICROMIPS32R6;
1682 def : MipsInstAlias<"or $rs, $imm",
1683                     (ORI_MMR6 GPR32Opnd:$rs, GPR32Opnd:$rs, uimm16:$imm), 0>,
1684                     ISA_MICROMIPS32R6;
1685 def : MipsInstAlias<"xor $rs, $rt, $imm",
1686                     (XORI_MMR6 GPR32Opnd:$rs, GPR32Opnd:$rt, uimm16:$imm), 0>,
1687                     ISA_MICROMIPS32R6;
1688 def : MipsInstAlias<"xor $rs, $imm",
1689                     (XORI_MMR6 GPR32Opnd:$rs, GPR32Opnd:$rs, uimm16:$imm), 0>,
1690                     ISA_MICROMIPS32R6;
1691 def : MipsInstAlias<"not $rt, $rs",
1692                     (NOR_MMR6 GPR32Opnd:$rt, GPR32Opnd:$rs, ZERO), 0>,
1693                     ISA_MICROMIPS32R6;
1694 def : MipsInstAlias<"not $rt",
1695                     (NOR_MMR6 GPR32Opnd:$rt, GPR32Opnd:$rt, ZERO), 0>,
1696                     ISA_MICROMIPS32R6;
1697 def : MipsInstAlias<"lapc $rd, $imm",
1698                     (ADDIUPC_MMR6 GPR32Opnd:$rd, simm19_lsl2:$imm)>,
1699                     ISA_MICROMIPS32R6;
1700 def : MipsInstAlias<"neg $rt, $rs",
1701                     (SUB_MMR6 GPR32Opnd:$rt, ZERO, GPR32Opnd:$rs), 1>,
1702       ISA_MICROMIPS32R6;
1703 def : MipsInstAlias<"neg $rt",
1704                     (SUB_MMR6 GPR32Opnd:$rt, ZERO, GPR32Opnd:$rt), 1>,
1705       ISA_MICROMIPS32R6;
1706 def : MipsInstAlias<"negu $rt, $rs",
1707                     (SUBU_MMR6 GPR32Opnd:$rt, ZERO, GPR32Opnd:$rs), 1>,
1708       ISA_MICROMIPS32R6;
1709 def : MipsInstAlias<"negu $rt",
1710                     (SUBU_MMR6 GPR32Opnd:$rt, ZERO, GPR32Opnd:$rt), 1>,
1711       ISA_MICROMIPS32R6;
1712 def : MipsInstAlias<"beqz16 $rs, $offset", (BEQZC16_MMR6 GPRMM16Opnd:$rs,
1713                                                          brtarget7_mm:$offset),
1714                     0>, ISA_MICROMIPS32R6;
1715 def : MipsInstAlias<"bnez16 $rs, $offset", (BNEZC16_MMR6 GPRMM16Opnd:$rs,
1716                                                          brtarget7_mm:$offset),
1717                     0>, ISA_MICROMIPS32R6;
1718 def : MipsInstAlias<"b16 $offset", (BC16_MMR6 brtarget10_mm:$offset), 0>,
1719                     ISA_MICROMIPS32R6;
1720
1721 //===----------------------------------------------------------------------===//
1722 //
1723 // MicroMips arbitrary patterns that map to one or more instructions
1724 //
1725 //===----------------------------------------------------------------------===//
1726
1727 def : MipsPat<(store GPRMM16:$src, addrimm4lsl2:$addr),
1728               (SW16_MMR6 GPRMM16:$src, addrimm4lsl2:$addr)>, ISA_MICROMIPS32R6;
1729 def : MipsPat<(subc GPR32:$lhs, GPR32:$rhs),
1730               (SUBU_MMR6 GPR32:$lhs, GPR32:$rhs)>, ISA_MICROMIPS32R6;
1731
1732 def : MipsPat<(select i32:$cond, i32:$t, i32:$f),
1733               (OR_MM (SELNEZ_MMR6 i32:$t, i32:$cond),
1734                      (SELEQZ_MMR6 i32:$f, i32:$cond))>,
1735               ISA_MICROMIPS32R6;
1736 def : MipsPat<(select i32:$cond, i32:$t, immz),
1737               (SELNEZ_MMR6 i32:$t, i32:$cond)>,
1738               ISA_MICROMIPS32R6;
1739 def : MipsPat<(select i32:$cond, immz, i32:$f),
1740               (SELEQZ_MMR6 i32:$f, i32:$cond)>,
1741               ISA_MICROMIPS32R6;
1742
1743 defm : SelectInt_Pats<i32, OR_MM, XORI_MMR6, SLTi_MM, SLTiu_MM, SELEQZ_MMR6,
1744                       SELNEZ_MMR6, immZExt16, i32>, ISA_MICROMIPS32R6;
1745
1746 defm S_MMR6 : Cmp_Pats<f32, NOR_MMR6, ZERO>, ISA_MICROMIPS32R6;
1747 defm D_MMR6 : Cmp_Pats<f64, NOR_MMR6, ZERO>, ISA_MICROMIPS32R6;
1748
1749 def : MipsPat<(f32 fpimm0), (MTC1_MMR6 ZERO)>, ISA_MICROMIPS32R6;
1750 def : MipsPat<(f32 fpimm0neg), (FNEG_S_MMR6 (MTC1_MMR6 ZERO))>, ISA_MICROMIPS32R6;
1751 def : MipsPat<(MipsTruncIntFP FGR64Opnd:$src),
1752               (TRUNC_W_D_MMR6 FGR64Opnd:$src)>, ISA_MICROMIPS32R6;
1753
1754 def : MipsPat<(and GPRMM16:$src, immZExtAndi16:$imm),
1755               (ANDI16_MMR6 GPRMM16:$src, immZExtAndi16:$imm)>,
1756               ISA_MICROMIPS32R6;
1757 def : MipsPat<(and GPR32:$src, immZExt16:$imm),
1758               (ANDI_MMR6 GPR32:$src, immZExt16:$imm)>, ISA_MICROMIPS32R6;
1759 def : MipsPat<(i32 immZExt16:$imm),
1760               (XORI_MMR6 ZERO, immZExt16:$imm)>, ISA_MICROMIPS32R6;
1761 def : MipsPat<(not GPRMM16:$in),
1762               (NOT16_MMR6 GPRMM16:$in)>, ISA_MICROMIPS32R6;
1763 def : MipsPat<(not GPR32:$in),
1764               (NOR_MMR6 GPR32Opnd:$in, ZERO)>, ISA_MICROMIPS32R6;
1765 // Patterns for load with a reg+imm operand.
1766 let AddedComplexity = 41 in {
1767   def : LoadRegImmPat<LDC1_D64_MMR6, f64, load>, FGR_64, ISA_MICROMIPS32R6;
1768   def : StoreRegImmPat<SDC1_D64_MMR6, f64>, FGR_64, ISA_MICROMIPS32R6;
1769 }
1770
1771 def TAILCALL_MMR6 : TailCall<BC_MMR6, brtarget26_mm>, ISA_MICROMIPS32R6;
1772
1773 def TAILCALLREG_MMR6  : TailCallReg<JRC16_MM, GPR32Opnd>, ISA_MICROMIPS32R6;
1774
1775 def PseudoIndirectBranch_MMR6 : PseudoIndirectBranchBase<JRC16_MMR6,
1776                                                          GPR32Opnd>,
1777                                 ISA_MICROMIPS32R6;
1778
1779 def : MipsPat<(MipsTailCall (iPTR tglobaladdr:$dst)),
1780               (TAILCALL_MMR6 tglobaladdr:$dst)>, ISA_MICROMIPS32R6;
1781
1782 def : MipsPat<(MipsTailCall (iPTR texternalsym:$dst)),
1783               (TAILCALL_MMR6 texternalsym:$dst)>, ISA_MICROMIPS32R6;
1784
1785
1786 def : MipsPat<(brcond (i32 (setne GPR32:$lhs, 0)), bb:$dst),
1787               (BNEZC_MMR6 GPR32:$lhs, bb:$dst)>, ISA_MICROMIPS32R6;
1788 def : MipsPat<(brcond (i32 (seteq GPR32:$lhs, 0)), bb:$dst),
1789               (BEQZC_MMR6 GPR32:$lhs, bb:$dst)>, ISA_MICROMIPS32R6;
1790
1791 def : MipsPat<(brcond (i32 (setge GPR32:$lhs, GPR32:$rhs)), bb:$dst),
1792               (BEQZC_MMR6 (SLT_MM GPR32:$lhs, GPR32:$rhs), bb:$dst)>,
1793       ISA_MICROMIPS32R6;
1794 def : MipsPat<(brcond (i32 (setuge GPR32:$lhs, GPR32:$rhs)), bb:$dst),
1795               (BEQZC_MMR6 (SLTu_MM GPR32:$lhs, GPR32:$rhs), bb:$dst)>,
1796       ISA_MICROMIPS32R6;
1797 def : MipsPat<(brcond (i32 (setge GPR32:$lhs, immSExt16:$rhs)), bb:$dst),
1798               (BEQZC_MMR6 (SLTi_MM GPR32:$lhs, immSExt16:$rhs), bb:$dst)>,
1799       ISA_MICROMIPS32R6;
1800 def : MipsPat<(brcond (i32 (setuge GPR32:$lhs, immSExt16:$rhs)), bb:$dst),
1801               (BEQZC_MMR6 (SLTiu_MM GPR32:$lhs, immSExt16:$rhs), bb:$dst)>,
1802       ISA_MICROMIPS32R6;
1803 def : MipsPat<(brcond (i32 (setgt GPR32:$lhs, immSExt16Plus1:$rhs)), bb:$dst),
1804               (BEQZC_MMR6 (SLTi_MM GPR32:$lhs, (Plus1 imm:$rhs)), bb:$dst)>,
1805       ISA_MICROMIPS32R6;
1806 def : MipsPat<(brcond (i32 (setugt GPR32:$lhs, immSExt16Plus1:$rhs)), bb:$dst),
1807               (BEQZC_MMR6 (SLTiu_MM GPR32:$lhs, (Plus1 imm:$rhs)), bb:$dst)>,
1808       ISA_MICROMIPS32R6;
1809
1810 def : MipsPat<(brcond (i32 (setle GPR32:$lhs, GPR32:$rhs)), bb:$dst),
1811               (BEQZC_MMR6  (SLT_MM GPR32:$rhs, GPR32:$lhs), bb:$dst)>,
1812       ISA_MICROMIPS32R6;
1813 def : MipsPat<(brcond (i32 (setule GPR32:$lhs, GPR32:$rhs)), bb:$dst),
1814               (BEQZC_MMR6  (SLTu_MM GPR32:$rhs, GPR32:$lhs), bb:$dst)>,
1815       ISA_MICROMIPS32R6;
1816
1817 def : MipsPat<(brcond GPR32:$cond, bb:$dst),
1818               (BNEZC_MMR6 GPR32:$cond, bb:$dst)>, ISA_MICROMIPS32R6;