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