1 //=- Mips32r6InstrInfo.td - Mips32r6 Instruction Information -*- tablegen -*-=//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file describes Mips32r6 instructions.
12 //===----------------------------------------------------------------------===//
14 include "Mips32r6InstrFormats.td"
16 // Notes about removals/changes from MIPS32r6:
18 // Reencoded: cache, pref
19 // Reencoded: clo, clz
20 // Reencoded: jr -> jalr
21 // Reencoded: jr.hb -> jalr.hb
28 // Removed: bc1any2, bc1any4
30 // Removed: bc2f, bc2t
33 // Removed: c.cond.fmt, bc1[ft]
39 // Removed: madd.[ds], nmadd.[ds], nmsub.[ds], sub.[ds]
40 // Removed: mfhi, mflo, mthi, mtlo, madd, maddu, msub, msubu, mul
41 // Removed: movf, movt
42 // Removed: movf.fmt, movt.fmt, movn.fmt, movz.fmt
43 // Removed: movn, movz
44 // Removed: mult, multu
49 // Rencoded: [ls][wd]c2
51 def brtarget21 : Operand<OtherVT> {
52 let EncoderMethod = "getBranchTarget21OpValue";
53 let OperandType = "OPERAND_PCREL";
54 let DecoderMethod = "DecodeBranchTarget21";
55 let ParserMatchClass = MipsJumpTargetAsmOperand;
58 def brtarget26 : Operand<OtherVT> {
59 let EncoderMethod = "getBranchTarget26OpValue";
60 let OperandType = "OPERAND_PCREL";
61 let DecoderMethod = "DecodeBranchTarget26";
62 let ParserMatchClass = MipsJumpTargetAsmOperand;
65 def jmpoffset16 : Operand<OtherVT> {
66 let EncoderMethod = "getJumpOffset16OpValue";
67 let ParserMatchClass = MipsJumpTargetAsmOperand;
70 def calloffset16 : Operand<iPTR> {
71 let EncoderMethod = "getJumpOffset16OpValue";
72 let ParserMatchClass = MipsJumpTargetAsmOperand;
75 //===----------------------------------------------------------------------===//
77 // Instruction Encodings
79 //===----------------------------------------------------------------------===//
81 class ADDIUPC_ENC : PCREL19_FM<OPCODE2_ADDIUPC>;
82 class ALIGN_ENC : SPECIAL3_ALIGN_FM<OPCODE6_ALIGN>;
83 class ALUIPC_ENC : PCREL16_FM<OPCODE5_ALUIPC>;
84 class AUI_ENC : AUI_FM;
85 class AUIPC_ENC : PCREL16_FM<OPCODE5_AUIPC>;
87 class BALC_ENC : BRANCH_OFF26_FM<0b111010>;
88 class BC_ENC : BRANCH_OFF26_FM<0b110010>;
89 class BEQC_ENC : CMP_BRANCH_2R_OFF16_FM<OPGROUP_ADDI>,
90 DecodeDisambiguates<"AddiGroupBranch">;
91 class BEQZALC_ENC : CMP_BRANCH_1R_RT_OFF16_FM<OPGROUP_ADDI>,
92 DecodeDisambiguatedBy<"DaddiGroupBranch">;
93 class BNEC_ENC : CMP_BRANCH_2R_OFF16_FM<OPGROUP_DADDI>,
94 DecodeDisambiguates<"DaddiGroupBranch">;
95 class BNEZALC_ENC : CMP_BRANCH_1R_RT_OFF16_FM<OPGROUP_DADDI>,
96 DecodeDisambiguatedBy<"DaddiGroupBranch">;
98 class BLTZC_ENC : CMP_BRANCH_1R_BOTH_OFF16_FM<OPGROUP_BGTZL>,
99 DecodeDisambiguates<"BgtzlGroupBranch">;
100 class BGEZC_ENC : CMP_BRANCH_1R_BOTH_OFF16_FM<OPGROUP_BLEZL>,
101 DecodeDisambiguates<"BlezlGroupBranch">;
102 class BGTZALC_ENC : CMP_BRANCH_1R_RT_OFF16_FM<OPGROUP_BGTZ>,
103 DecodeDisambiguatedBy<"BgtzGroupBranch">;
105 class BLEZC_ENC : CMP_BRANCH_1R_RT_OFF16_FM<OPGROUP_BLEZL>,
106 DecodeDisambiguatedBy<"BlezlGroupBranch">;
107 class BLTZALC_ENC : CMP_BRANCH_1R_BOTH_OFF16_FM<OPGROUP_BGTZ>,
108 DecodeDisambiguates<"BgtzGroupBranch">;
109 class BGTZC_ENC : CMP_BRANCH_1R_RT_OFF16_FM<OPGROUP_BGTZL>,
110 DecodeDisambiguatedBy<"BgtzlGroupBranch">;
112 class BEQZC_ENC : CMP_BRANCH_OFF21_FM<0b110110>;
113 class BGEZALC_ENC : CMP_BRANCH_1R_BOTH_OFF16_FM<OPGROUP_BLEZ>;
114 class BNEZC_ENC : CMP_BRANCH_OFF21_FM<0b111110>;
116 class BC1EQZ_ENC : COP1_BCCZ_FM<OPCODE5_BC1EQZ>;
117 class BC1NEZ_ENC : COP1_BCCZ_FM<OPCODE5_BC1NEZ>;
118 class BC2EQZ_ENC : COP2_BCCZ_FM<OPCODE5_BC2EQZ>;
119 class BC2NEZ_ENC : COP2_BCCZ_FM<OPCODE5_BC2NEZ>;
121 class JIALC_ENC : JMP_IDX_COMPACT_FM<0b111110>;
122 class JIC_ENC : JMP_IDX_COMPACT_FM<0b110110>;
124 class BITSWAP_ENC : SPECIAL3_2R_FM<OPCODE6_BITSWAP>;
125 class BLEZALC_ENC : CMP_BRANCH_1R_RT_OFF16_FM<OPGROUP_BLEZ>;
126 class BNVC_ENC : CMP_BRANCH_2R_OFF16_FM<OPGROUP_DADDI>,
127 DecodeDisambiguatedBy<"DaddiGroupBranch">;
128 class BOVC_ENC : CMP_BRANCH_2R_OFF16_FM<OPGROUP_ADDI>,
129 DecodeDisambiguatedBy<"AddiGroupBranch">;
130 class DIV_ENC : SPECIAL_3R_FM<0b00010, 0b011010>;
131 class DIVU_ENC : SPECIAL_3R_FM<0b00010, 0b011011>;
132 class MOD_ENC : SPECIAL_3R_FM<0b00011, 0b011010>;
133 class MODU_ENC : SPECIAL_3R_FM<0b00011, 0b011011>;
134 class MUH_ENC : SPECIAL_3R_FM<0b00011, 0b011000>;
135 class MUHU_ENC : SPECIAL_3R_FM<0b00011, 0b011001>;
136 class MUL_R6_ENC : SPECIAL_3R_FM<0b00010, 0b011000>;
137 class MULU_ENC : SPECIAL_3R_FM<0b00010, 0b011001>;
139 class MADDF_S_ENC : COP1_3R_FM<0b011000, FIELD_FMT_S>;
140 class MADDF_D_ENC : COP1_3R_FM<0b011000, FIELD_FMT_D>;
141 class MSUBF_S_ENC : COP1_3R_FM<0b011001, FIELD_FMT_S>;
142 class MSUBF_D_ENC : COP1_3R_FM<0b011001, FIELD_FMT_D>;
144 class SEL_D_ENC : COP1_3R_FM<0b010000, FIELD_FMT_D>;
145 class SEL_S_ENC : COP1_3R_FM<0b010000, FIELD_FMT_S>;
147 class SELEQZ_ENC : SPECIAL_3R_FM<0b00000, 0b110101>;
148 class SELNEZ_ENC : SPECIAL_3R_FM<0b00000, 0b110111>;
150 class LWPC_ENC : PCREL19_FM<OPCODE2_LWPC>;
151 class LWUPC_ENC : PCREL19_FM<OPCODE2_LWUPC>;
153 class MAX_S_ENC : COP1_3R_FM<0b011101, FIELD_FMT_S>;
154 class MAX_D_ENC : COP1_3R_FM<0b011101, FIELD_FMT_D>;
155 class MIN_S_ENC : COP1_3R_FM<0b011100, FIELD_FMT_S>;
156 class MIN_D_ENC : COP1_3R_FM<0b011100, FIELD_FMT_D>;
158 class MAXA_S_ENC : COP1_3R_FM<0b011111, FIELD_FMT_S>;
159 class MAXA_D_ENC : COP1_3R_FM<0b011111, FIELD_FMT_D>;
160 class MINA_S_ENC : COP1_3R_FM<0b011110, FIELD_FMT_S>;
161 class MINA_D_ENC : COP1_3R_FM<0b011110, FIELD_FMT_D>;
163 class SELEQZ_S_ENC : COP1_3R_FM<0b010100, FIELD_FMT_S>;
164 class SELEQZ_D_ENC : COP1_3R_FM<0b010100, FIELD_FMT_D>;
165 class SELNEZ_S_ENC : COP1_3R_FM<0b010111, FIELD_FMT_S>;
166 class SELNEZ_D_ENC : COP1_3R_FM<0b010111, FIELD_FMT_D>;
168 class RINT_S_ENC : COP1_2R_FM<0b011010, FIELD_FMT_S>;
169 class RINT_D_ENC : COP1_2R_FM<0b011010, FIELD_FMT_D>;
170 class CLASS_S_ENC : COP1_2R_FM<0b011011, FIELD_FMT_S>;
171 class CLASS_D_ENC : COP1_2R_FM<0b011011, FIELD_FMT_D>;
173 class CMP_CONDN_DESC_BASE<string CondStr, string Typestr, RegisterOperand FGROpnd> {
174 dag OutOperandList = (outs FGROpnd:$fd);
175 dag InOperandList = (ins FGROpnd:$fs, FGROpnd:$ft);
176 string AsmString = !strconcat("cmp.", CondStr, ".", Typestr, "\t$fd, $fs, $ft");
177 list<dag> Pattern = [];
180 //===----------------------------------------------------------------------===//
182 // Instruction Multiclasses
184 //===----------------------------------------------------------------------===//
186 multiclass CMP_CC_M <FIELD_CMP_FORMAT Format, string Typestr,
187 RegisterOperand FGROpnd>{
188 def CMP_F_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_F>,
189 CMP_CONDN_DESC_BASE<"f", Typestr, FGROpnd>,
191 def CMP_UN_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_UN>,
192 CMP_CONDN_DESC_BASE<"un", Typestr, FGROpnd>,
194 def CMP_EQ_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_EQ>,
195 CMP_CONDN_DESC_BASE<"eq", Typestr, FGROpnd>,
197 def CMP_UEQ_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_UEQ>,
198 CMP_CONDN_DESC_BASE<"ueq", Typestr, FGROpnd>,
200 def CMP_OLT_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_OLT>,
201 CMP_CONDN_DESC_BASE<"olt", Typestr, FGROpnd>,
203 def CMP_ULT_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_ULT>,
204 CMP_CONDN_DESC_BASE<"ult", Typestr, FGROpnd>,
206 def CMP_OLE_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_OLE>,
207 CMP_CONDN_DESC_BASE<"ole", Typestr, FGROpnd>,
209 def CMP_ULE_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_ULE>,
210 CMP_CONDN_DESC_BASE<"ule", Typestr, FGROpnd>,
212 def CMP_SF_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_SF>,
213 CMP_CONDN_DESC_BASE<"sf", Typestr, FGROpnd>,
215 def CMP_NGLE_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_NGLE>,
216 CMP_CONDN_DESC_BASE<"ngle", Typestr, FGROpnd>,
218 def CMP_SEQ_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_SEQ>,
219 CMP_CONDN_DESC_BASE<"seq", Typestr, FGROpnd>,
221 def CMP_NGL_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_NGL>,
222 CMP_CONDN_DESC_BASE<"ngl", Typestr, FGROpnd>,
224 def CMP_LT_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_LT>,
225 CMP_CONDN_DESC_BASE<"lt", Typestr, FGROpnd>,
227 def CMP_NGE_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_NGE>,
228 CMP_CONDN_DESC_BASE<"nge", Typestr, FGROpnd>,
230 def CMP_LE_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_LE>,
231 CMP_CONDN_DESC_BASE<"le", Typestr, FGROpnd>,
233 def CMP_NGT_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_NGT>,
234 CMP_CONDN_DESC_BASE<"ngt", Typestr, FGROpnd>,
238 //===----------------------------------------------------------------------===//
240 // Instruction Descriptions
242 //===----------------------------------------------------------------------===//
244 class PCREL_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
246 dag OutOperandList = (outs GPROpnd:$rs);
247 dag InOperandList = (ins ImmOpnd:$imm);
248 string AsmString = !strconcat(instr_asm, "\t$rs, $imm");
249 list<dag> Pattern = [];
252 class ADDIUPC_DESC : PCREL_DESC_BASE<"addiupc", GPR32Opnd, simm19_lsl2>;
253 class LWPC_DESC: PCREL_DESC_BASE<"lwpc", GPR32Opnd, simm19_lsl2>;
254 class LWUPC_DESC: PCREL_DESC_BASE<"lwupc", GPR32Opnd, simm19_lsl2>;
256 class ALIGN_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
258 dag OutOperandList = (outs GPROpnd:$rd);
259 dag InOperandList = (ins GPROpnd:$rs, GPROpnd:$rt, ImmOpnd:$bp);
260 string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt, $bp");
261 list<dag> Pattern = [];
264 class ALIGN_DESC : ALIGN_DESC_BASE<"align", GPR32Opnd, uimm2>;
266 class ALUIPC_DESC_BASE<string instr_asm, RegisterOperand GPROpnd> {
267 dag OutOperandList = (outs GPROpnd:$rs);
268 dag InOperandList = (ins simm16:$imm);
269 string AsmString = !strconcat(instr_asm, "\t$rs, $imm");
270 list<dag> Pattern = [];
273 class ALUIPC_DESC : ALUIPC_DESC_BASE<"aluipc", GPR32Opnd>;
274 class AUIPC_DESC : ALUIPC_DESC_BASE<"auipc", GPR32Opnd>;
276 class AUI_DESC_BASE<string instr_asm, RegisterOperand GPROpnd> {
277 dag OutOperandList = (outs GPROpnd:$rs);
278 dag InOperandList = (ins GPROpnd:$rt, simm16:$imm);
279 string AsmString = !strconcat(instr_asm, "\t$rs, $rt, $imm");
280 list<dag> Pattern = [];
283 class AUI_DESC : AUI_DESC_BASE<"aui", GPR32Opnd>;
285 class BRANCH_DESC_BASE {
287 bit isTerminator = 1;
288 bit hasDelaySlot = 0;
291 class BC_DESC_BASE<string instr_asm, DAGOperand opnd> : BRANCH_DESC_BASE {
292 dag InOperandList = (ins opnd:$offset);
293 dag OutOperandList = (outs);
294 string AsmString = !strconcat(instr_asm, "\t$offset");
298 class CMP_BC_DESC_BASE<string instr_asm, DAGOperand opnd,
299 RegisterOperand GPROpnd> : BRANCH_DESC_BASE {
300 dag InOperandList = (ins GPROpnd:$rs, GPROpnd:$rt, opnd:$offset);
301 dag OutOperandList = (outs);
302 string AsmString = !strconcat(instr_asm, "\t$rs, $rt, $offset");
303 list<Register> Defs = [AT];
306 class CMP_CBR_EQNE_Z_DESC_BASE<string instr_asm, DAGOperand opnd,
307 RegisterOperand GPROpnd> : BRANCH_DESC_BASE {
308 dag InOperandList = (ins GPROpnd:$rs, opnd:$offset);
309 dag OutOperandList = (outs);
310 string AsmString = !strconcat(instr_asm, "\t$rs, $offset");
311 list<Register> Defs = [AT];
314 class CMP_CBR_RT_Z_DESC_BASE<string instr_asm, DAGOperand opnd,
315 RegisterOperand GPROpnd> : BRANCH_DESC_BASE {
316 dag InOperandList = (ins GPROpnd:$rt, opnd:$offset);
317 dag OutOperandList = (outs);
318 string AsmString = !strconcat(instr_asm, "\t$rt, $offset");
319 list<Register> Defs = [AT];
322 class BALC_DESC : BC_DESC_BASE<"balc", brtarget26> {
324 list<Register> Defs = [RA];
327 class BC_DESC : BC_DESC_BASE<"bc", brtarget26>;
328 class BEQC_DESC : CMP_BC_DESC_BASE<"beqc", brtarget, GPR32Opnd>;
329 class BNEC_DESC : CMP_BC_DESC_BASE<"bnec", brtarget, GPR32Opnd>;
331 class BLTZC_DESC : CMP_CBR_RT_Z_DESC_BASE<"bltzc", brtarget, GPR32Opnd>;
332 class BGEZC_DESC : CMP_CBR_RT_Z_DESC_BASE<"bgezc", brtarget, GPR32Opnd>;
334 class BLEZC_DESC : CMP_CBR_RT_Z_DESC_BASE<"blezc", brtarget, GPR32Opnd>;
335 class BGTZC_DESC : CMP_CBR_RT_Z_DESC_BASE<"bgtzc", brtarget, GPR32Opnd>;
337 class BEQZC_DESC : CMP_CBR_EQNE_Z_DESC_BASE<"beqzc", brtarget21, GPR32Opnd>;
338 class BNEZC_DESC : CMP_CBR_EQNE_Z_DESC_BASE<"bnezc", brtarget21, GPR32Opnd>;
340 class COP1_BCCZ_DESC_BASE<string instr_asm> : BRANCH_DESC_BASE {
341 dag InOperandList = (ins FGR64Opnd:$ft, brtarget:$offset);
342 dag OutOperandList = (outs);
343 string AsmString = instr_asm;
344 bit hasDelaySlot = 1;
347 class BC1EQZ_DESC : COP1_BCCZ_DESC_BASE<"bc1eqz $ft, $offset">;
348 class BC1NEZ_DESC : COP1_BCCZ_DESC_BASE<"bc1nez $ft, $offset">;
350 class COP2_BCCZ_DESC_BASE<string instr_asm> : BRANCH_DESC_BASE {
351 dag InOperandList = (ins COP2Opnd:$ct, brtarget:$offset);
352 dag OutOperandList = (outs);
353 string AsmString = instr_asm;
354 bit hasDelaySlot = 1;
357 class BC2EQZ_DESC : COP2_BCCZ_DESC_BASE<"bc2eqz $ct, $offset">;
358 class BC2NEZ_DESC : COP2_BCCZ_DESC_BASE<"bc2nez $ct, $offset">;
360 class BOVC_DESC : CMP_BC_DESC_BASE<"bovc", brtarget, GPR32Opnd>;
361 class BNVC_DESC : CMP_BC_DESC_BASE<"bnvc", brtarget, GPR32Opnd>;
363 class JMP_IDX_COMPACT_DESC_BASE<string opstr, DAGOperand opnd,
364 RegisterOperand GPROpnd> {
365 dag InOperandList = (ins GPROpnd:$rt, opnd:$offset);
366 string AsmString = !strconcat(opstr, "\t$rt, $offset");
367 list<dag> Pattern = [];
368 bit isTerminator = 1;
369 bit hasDelaySlot = 0;
370 string DecoderMethod = "DecodeSimm16";
373 class JIALC_DESC : JMP_IDX_COMPACT_DESC_BASE<"jialc", calloffset16,
376 list<Register> Defs = [RA];
379 class JIC_DESC : JMP_IDX_COMPACT_DESC_BASE<"jic", jmpoffset16, GPR32Opnd> {
381 list<Register> Defs = [AT];
384 class BITSWAP_DESC_BASE<string instr_asm, RegisterOperand GPROpnd> {
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 = [];
391 class BITSWAP_DESC : BITSWAP_DESC_BASE<"bitswap", GPR32Opnd>;
393 class DIVMOD_DESC_BASE<string instr_asm, RegisterOperand GPROpnd> {
394 dag OutOperandList = (outs GPROpnd:$rd);
395 dag InOperandList = (ins GPROpnd:$rs, GPROpnd:$rt);
396 string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt");
397 list<dag> Pattern = [];
400 class DIV_DESC : DIVMOD_DESC_BASE<"div", GPR32Opnd>;
401 class DIVU_DESC : DIVMOD_DESC_BASE<"divu", GPR32Opnd>;
402 class MOD_DESC : DIVMOD_DESC_BASE<"mod", GPR32Opnd>;
403 class MODU_DESC : DIVMOD_DESC_BASE<"modu", GPR32Opnd>;
405 class BEQZALC_DESC : CMP_CBR_RT_Z_DESC_BASE<"beqzalc", brtarget, GPR32Opnd> {
406 list<Register> Defs = [RA];
409 class BGEZALC_DESC : CMP_CBR_RT_Z_DESC_BASE<"bgezalc", brtarget, GPR32Opnd> {
410 list<Register> Defs = [RA];
413 class BGTZALC_DESC : CMP_CBR_RT_Z_DESC_BASE<"bgtzalc", brtarget, GPR32Opnd> {
414 list<Register> Defs = [RA];
417 class BLEZALC_DESC : CMP_CBR_RT_Z_DESC_BASE<"blezalc", brtarget, GPR32Opnd> {
418 list<Register> Defs = [RA];
421 class BLTZALC_DESC : CMP_CBR_RT_Z_DESC_BASE<"bltzalc", brtarget, GPR32Opnd> {
422 list<Register> Defs = [RA];
425 class BNEZALC_DESC : CMP_CBR_RT_Z_DESC_BASE<"bnezalc", brtarget, GPR32Opnd> {
426 list<Register> Defs = [RA];
428 class MUL_R6_DESC_BASE<string instr_asm, RegisterOperand GPROpnd> {
429 dag OutOperandList = (outs GPROpnd:$rd);
430 dag InOperandList = (ins GPROpnd:$rs, GPROpnd:$rt);
431 string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt");
432 list<dag> Pattern = [];
435 class MUH_DESC : MUL_R6_DESC_BASE<"muh", GPR32Opnd>;
436 class MUHU_DESC : MUL_R6_DESC_BASE<"muhu", GPR32Opnd>;
437 class MUL_R6_DESC : MUL_R6_DESC_BASE<"mul", GPR32Opnd>;
438 class MULU_DESC : MUL_R6_DESC_BASE<"mulu", GPR32Opnd>;
440 class COP1_4R_DESC_BASE<string instr_asm, RegisterOperand FGROpnd> {
441 dag OutOperandList = (outs FGROpnd:$fd);
442 dag InOperandList = (ins FGROpnd:$fd_in, FGROpnd:$fs, FGROpnd:$ft);
443 string AsmString = !strconcat(instr_asm, "\t$fd, $fs, $ft");
444 list<dag> Pattern = [];
445 string Constraints = "$fd_in = $fd";
448 class SEL_D_DESC : COP1_4R_DESC_BASE<"sel.d", FGR64Opnd>;
449 class SEL_S_DESC : COP1_4R_DESC_BASE<"sel.s", FGR32Opnd>;
451 class SELEQNE_Z_DESC_BASE<string instr_asm, RegisterOperand GPROpnd> {
452 dag OutOperandList = (outs GPROpnd:$rd);
453 dag InOperandList = (ins GPROpnd:$rs, GPROpnd:$rt);
454 string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt");
455 list<dag> Pattern = [];
458 class SELEQZ_DESC : SELEQNE_Z_DESC_BASE<"seleqz", GPR32Opnd>;
459 class SELNEZ_DESC : SELEQNE_Z_DESC_BASE<"selnez", GPR32Opnd>;
461 class MADDF_S_DESC : COP1_4R_DESC_BASE<"maddf.s", FGR32Opnd>;
462 class MADDF_D_DESC : COP1_4R_DESC_BASE<"maddf.d", FGR64Opnd>;
463 class MSUBF_S_DESC : COP1_4R_DESC_BASE<"msubf.s", FGR32Opnd>;
464 class MSUBF_D_DESC : COP1_4R_DESC_BASE<"msubf.d", FGR64Opnd>;
466 class MAX_MIN_DESC_BASE<string instr_asm, RegisterOperand FGROpnd> {
467 dag OutOperandList = (outs FGROpnd:$fd);
468 dag InOperandList = (ins FGROpnd:$fs, FGROpnd:$ft);
469 string AsmString = !strconcat(instr_asm, "\t$fd, $fs, $ft");
470 list<dag> Pattern = [];
473 class MAX_S_DESC : MAX_MIN_DESC_BASE<"max.s", FGR32Opnd>;
474 class MAX_D_DESC : MAX_MIN_DESC_BASE<"max.d", FGR64Opnd>;
475 class MIN_S_DESC : MAX_MIN_DESC_BASE<"min.s", FGR32Opnd>;
476 class MIN_D_DESC : MAX_MIN_DESC_BASE<"min.d", FGR64Opnd>;
478 class MAXA_S_DESC : MAX_MIN_DESC_BASE<"maxa.s", FGR32Opnd>;
479 class MAXA_D_DESC : MAX_MIN_DESC_BASE<"maxa.d", FGR64Opnd>;
480 class MINA_S_DESC : MAX_MIN_DESC_BASE<"mina.s", FGR32Opnd>;
481 class MINA_D_DESC : MAX_MIN_DESC_BASE<"mina.d", FGR64Opnd>;
483 class SELEQNEZ_DESC_BASE<string instr_asm, RegisterOperand FGROpnd> {
484 dag OutOperandList = (outs FGROpnd:$fd);
485 dag InOperandList = (ins FGROpnd:$fs, FGROpnd:$ft);
486 string AsmString = !strconcat(instr_asm, "\t$fd, $fs, $ft");
487 list<dag> Pattern = [];
490 class SELEQZ_S_DESC : SELEQNEZ_DESC_BASE<"seleqz.s", FGR32Opnd>;
491 class SELEQZ_D_DESC : SELEQNEZ_DESC_BASE<"seleqz.d", FGR64Opnd>;
492 class SELNEZ_S_DESC : SELEQNEZ_DESC_BASE<"selnez.s", FGR32Opnd>;
493 class SELNEZ_D_DESC : SELEQNEZ_DESC_BASE<"selnez.d", FGR64Opnd>;
495 class CLASS_RINT_DESC_BASE<string instr_asm, RegisterOperand FGROpnd> {
496 dag OutOperandList = (outs FGROpnd:$fd);
497 dag InOperandList = (ins FGROpnd:$fs);
498 string AsmString = !strconcat(instr_asm, "\t$fd, $fs");
499 list<dag> Pattern = [];
502 class RINT_S_DESC : CLASS_RINT_DESC_BASE<"rint.s", FGR32Opnd>;
503 class RINT_D_DESC : CLASS_RINT_DESC_BASE<"rint.d", FGR64Opnd>;
504 class CLASS_S_DESC : CLASS_RINT_DESC_BASE<"class.s", FGR32Opnd>;
505 class CLASS_D_DESC : CLASS_RINT_DESC_BASE<"class.d", FGR64Opnd>;
507 //===----------------------------------------------------------------------===//
509 // Instruction Definitions
511 //===----------------------------------------------------------------------===//
513 def ADDIUPC : ADDIUPC_ENC, ADDIUPC_DESC, ISA_MIPS32R6;
514 def ALIGN : ALIGN_ENC, ALIGN_DESC, ISA_MIPS32R6;
515 def ALUIPC : ALUIPC_ENC, ALUIPC_DESC, ISA_MIPS32R6;
516 def AUI : AUI_ENC, AUI_DESC, ISA_MIPS32R6;
517 def AUIPC : AUIPC_ENC, AUIPC_DESC, ISA_MIPS32R6;
518 def BALC : BALC_ENC, BALC_DESC, ISA_MIPS32R6;
519 def BC1EQZ : BC1EQZ_ENC, BC1EQZ_DESC, ISA_MIPS32R6;
520 def BC1NEZ : BC1NEZ_ENC, BC1NEZ_DESC, ISA_MIPS32R6;
521 def BC2EQZ : BC2EQZ_ENC, BC2EQZ_DESC, ISA_MIPS32R6;
522 def BC2NEZ : BC2NEZ_ENC, BC2NEZ_DESC, ISA_MIPS32R6;
523 def BC : BC_ENC, BC_DESC, ISA_MIPS32R6;
524 def BEQC : BEQC_ENC, BEQC_DESC, ISA_MIPS32R6;
525 def BEQZALC : BEQZALC_ENC, BEQZALC_DESC, ISA_MIPS32R6;
526 def BEQZC : BEQZC_ENC, BEQZC_DESC, ISA_MIPS32R6;
527 def BGEC; // Also aliased to blec with operands swapped
528 def BGEUC; // Also aliased to bleuc with operands swapped
529 def BGEZALC : BGEZALC_ENC, BGEZALC_DESC, ISA_MIPS32R6;
530 def BGEZC : BGEZC_ENC, BGEZC_DESC, ISA_MIPS32R6;
531 def BGTZALC : BGTZALC_ENC, BGTZALC_DESC, ISA_MIPS32R6;
532 def BGTZC : BGTZC_ENC, BGTZC_DESC, ISA_MIPS32R6;
533 def BITSWAP : BITSWAP_ENC, BITSWAP_DESC, ISA_MIPS32R6;
534 def BLEZALC : BLEZALC_ENC, BLEZALC_DESC, ISA_MIPS32R6;
535 def BLEZC : BLEZC_ENC, BLEZC_DESC, ISA_MIPS32R6;
536 def BLTC; // Also aliased to bgtc with operands swapped
537 def BLTUC; // Also aliased to bgtuc with operands swapped
538 def BLTZALC : BLTZALC_ENC, BLTZALC_DESC, ISA_MIPS32R6;
539 def BLTZC : BLTZC_ENC, BLTZC_DESC, ISA_MIPS32R6;
540 def BNEC : BNEC_ENC, BNEC_DESC, ISA_MIPS32R6;
541 def BNEZALC : BNEZALC_ENC, BNEZALC_DESC, ISA_MIPS32R6;
542 def BNEZC : BNEZC_ENC, BNEZC_DESC, ISA_MIPS32R6;
543 def BNVC : BNVC_ENC, BNVC_DESC, ISA_MIPS32R6;
544 def BOVC : BOVC_ENC, BOVC_DESC, ISA_MIPS32R6;
545 def CLASS_D : CLASS_D_ENC, CLASS_D_DESC, ISA_MIPS32R6;
546 def CLASS_S : CLASS_S_ENC, CLASS_S_DESC, ISA_MIPS32R6;
547 defm S : CMP_CC_M<FIELD_CMP_FORMAT_S, "s", FGR32Opnd>;
548 defm D : CMP_CC_M<FIELD_CMP_FORMAT_D, "d", FGR64Opnd>;
549 def DIV : DIV_ENC, DIV_DESC, ISA_MIPS32R6;
550 def DIVU : DIVU_ENC, DIVU_DESC, ISA_MIPS32R6;
551 def JIALC : JIALC_ENC, JIALC_DESC, ISA_MIPS32R6;
552 def JIC : JIC_ENC, JIC_DESC, ISA_MIPS32R6;
553 // def LSA; // See MSA
554 def LWPC : LWPC_ENC, LWPC_DESC, ISA_MIPS32R6;
555 def LWUPC : LWUPC_ENC, LWUPC_DESC, ISA_MIPS32R6;
556 def MADDF_S : MADDF_S_ENC, MADDF_S_DESC, ISA_MIPS32R6;
557 def MADDF_D : MADDF_D_ENC, MADDF_D_DESC, ISA_MIPS32R6;
558 def MAXA_D : MAXA_D_ENC, MAXA_D_DESC, ISA_MIPS32R6;
559 def MAXA_S : MAXA_S_ENC, MAXA_S_DESC, ISA_MIPS32R6;
560 def MAX_D : MAX_D_ENC, MAX_D_DESC, ISA_MIPS32R6;
561 def MAX_S : MAX_S_ENC, MAX_S_DESC, ISA_MIPS32R6;
562 def MINA_D : MINA_D_ENC, MINA_D_DESC, ISA_MIPS32R6;
563 def MINA_S : MINA_S_ENC, MINA_S_DESC, ISA_MIPS32R6;
564 def MIN_D : MIN_D_ENC, MIN_D_DESC, ISA_MIPS32R6;
565 def MIN_S : MIN_S_ENC, MIN_S_DESC, ISA_MIPS32R6;
566 def MOD : MOD_ENC, MOD_DESC, ISA_MIPS32R6;
567 def MODU : MODU_ENC, MODU_DESC, ISA_MIPS32R6;
568 def MSUBF_S : MSUBF_S_ENC, MSUBF_S_DESC, ISA_MIPS32R6;
569 def MSUBF_D : MSUBF_D_ENC, MSUBF_D_DESC, ISA_MIPS32R6;
570 def MUH : MUH_ENC, MUH_DESC, ISA_MIPS32R6;
571 def MUHU : MUHU_ENC, MUHU_DESC, ISA_MIPS32R6;
572 def MUL_R6 : MUL_R6_ENC, MUL_R6_DESC, ISA_MIPS32R6;
573 def MULU : MULU_ENC, MULU_DESC, ISA_MIPS32R6;
574 def NAL; // BAL with rd=0
575 def RINT_D : RINT_D_ENC, RINT_D_DESC, ISA_MIPS32R6;
576 def RINT_S : RINT_S_ENC, RINT_S_DESC, ISA_MIPS32R6;
577 def SELEQZ : SELEQZ_ENC, SELEQZ_DESC, ISA_MIPS32R6;
578 def SELEQZ_D : SELEQZ_D_ENC, SELEQZ_D_DESC, ISA_MIPS32R6;
579 def SELEQZ_S : SELEQZ_S_ENC, SELEQZ_S_DESC, ISA_MIPS32R6;
580 def SELNEZ : SELNEZ_ENC, SELNEZ_DESC, ISA_MIPS32R6;
581 def SELNEZ_D : SELNEZ_D_ENC, SELNEZ_D_DESC, ISA_MIPS32R6;
582 def SELNEZ_S : SELNEZ_S_ENC, SELNEZ_S_DESC, ISA_MIPS32R6;
583 def SEL_D : SEL_D_ENC, SEL_D_DESC, ISA_MIPS32R6;
584 def SEL_S : SEL_S_ENC, SEL_S_DESC, ISA_MIPS32R6;