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]
37 // Removed: movf, movt
38 // Removed: movf.fmt, movt.fmt, movn.fmt, movz.fmt
39 // Removed: movn, movz
44 // Rencoded: [ls][wd]c2
46 def brtarget21 : Operand<OtherVT> {
47 let EncoderMethod = "getBranchTarget21OpValue";
48 let OperandType = "OPERAND_PCREL";
49 let DecoderMethod = "DecodeBranchTarget21";
50 let ParserMatchClass = MipsJumpTargetAsmOperand;
53 def brtarget26 : Operand<OtherVT> {
54 let EncoderMethod = "getBranchTarget26OpValue";
55 let OperandType = "OPERAND_PCREL";
56 let DecoderMethod = "DecodeBranchTarget26";
57 let ParserMatchClass = MipsJumpTargetAsmOperand;
60 def jmpoffset16 : Operand<OtherVT> {
61 let EncoderMethod = "getJumpOffset16OpValue";
62 let ParserMatchClass = MipsJumpTargetAsmOperand;
65 def calloffset16 : Operand<iPTR> {
66 let EncoderMethod = "getJumpOffset16OpValue";
67 let ParserMatchClass = MipsJumpTargetAsmOperand;
70 //===----------------------------------------------------------------------===//
72 // Instruction Encodings
74 //===----------------------------------------------------------------------===//
76 class ADDIUPC_ENC : PCREL19_FM<OPCODE2_ADDIUPC>;
77 class ALIGN_ENC : SPECIAL3_ALIGN_FM<OPCODE6_ALIGN>;
78 class ALUIPC_ENC : PCREL16_FM<OPCODE5_ALUIPC>;
79 class AUI_ENC : AUI_FM;
80 class AUIPC_ENC : PCREL16_FM<OPCODE5_AUIPC>;
82 class BALC_ENC : BRANCH_OFF26_FM<0b111010>;
83 class BC_ENC : BRANCH_OFF26_FM<0b110010>;
84 class BEQC_ENC : CMP_BRANCH_2R_OFF16_FM<OPGROUP_ADDI>,
85 DecodeDisambiguates<"AddiGroupBranch">;
86 class BEQZALC_ENC : CMP_BRANCH_1R_RT_OFF16_FM<OPGROUP_ADDI>,
87 DecodeDisambiguatedBy<"DaddiGroupBranch">;
88 class BNEC_ENC : CMP_BRANCH_2R_OFF16_FM<OPGROUP_DADDI>,
89 DecodeDisambiguates<"DaddiGroupBranch">;
90 class BNEZALC_ENC : CMP_BRANCH_1R_RT_OFF16_FM<OPGROUP_DADDI>,
91 DecodeDisambiguatedBy<"DaddiGroupBranch">;
93 class BLTZC_ENC : CMP_BRANCH_1R_BOTH_OFF16_FM<OPGROUP_BGTZL>,
94 DecodeDisambiguates<"BgtzlGroupBranch">;
95 class BGEC_ENC : CMP_BRANCH_2R_OFF16_FM<OPGROUP_BLEZL>,
96 DecodeDisambiguatedBy<"BlezlGroupBranch">;
97 class BGEUC_ENC : CMP_BRANCH_2R_OFF16_FM<OPGROUP_BLEZ>,
98 DecodeDisambiguatedBy<"BlezGroupBranch">;
99 class BGEZC_ENC : CMP_BRANCH_1R_BOTH_OFF16_FM<OPGROUP_BLEZL>,
100 DecodeDisambiguates<"BlezlGroupBranch">;
101 class BGTZALC_ENC : CMP_BRANCH_1R_RT_OFF16_FM<OPGROUP_BGTZ>,
102 DecodeDisambiguatedBy<"BgtzGroupBranch">;
104 class BLEZC_ENC : CMP_BRANCH_1R_RT_OFF16_FM<OPGROUP_BLEZL>,
105 DecodeDisambiguatedBy<"BlezlGroupBranch">;
106 class BLTZALC_ENC : CMP_BRANCH_1R_BOTH_OFF16_FM<OPGROUP_BGTZ>,
107 DecodeDisambiguates<"BgtzGroupBranch">;
108 class BGTZC_ENC : CMP_BRANCH_1R_RT_OFF16_FM<OPGROUP_BGTZL>,
109 DecodeDisambiguatedBy<"BgtzlGroupBranch">;
111 class BEQZC_ENC : CMP_BRANCH_OFF21_FM<0b110110>;
112 class BGEZALC_ENC : CMP_BRANCH_1R_BOTH_OFF16_FM<OPGROUP_BLEZ>,
113 DecodeDisambiguates<"BlezGroupBranch">;
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>;
123 class JR_HB_R6_ENC : JR_HB_R6_FM<OPCODE6_JALR>;
124 class BITSWAP_ENC : SPECIAL3_2R_FM<OPCODE6_BITSWAP>;
125 class BLEZALC_ENC : CMP_BRANCH_1R_RT_OFF16_FM<OPGROUP_BLEZ>,
126 DecodeDisambiguatedBy<"BlezGroupBranch">;
127 class BNVC_ENC : CMP_BRANCH_2R_OFF16_FM<OPGROUP_DADDI>,
128 DecodeDisambiguatedBy<"DaddiGroupBranch">;
129 class BOVC_ENC : CMP_BRANCH_2R_OFF16_FM<OPGROUP_ADDI>,
130 DecodeDisambiguatedBy<"AddiGroupBranch">;
131 class DIV_ENC : SPECIAL_3R_FM<0b00010, 0b011010>;
132 class DIVU_ENC : SPECIAL_3R_FM<0b00010, 0b011011>;
133 class MOD_ENC : SPECIAL_3R_FM<0b00011, 0b011010>;
134 class MODU_ENC : SPECIAL_3R_FM<0b00011, 0b011011>;
135 class MUH_ENC : SPECIAL_3R_FM<0b00011, 0b011000>;
136 class MUHU_ENC : SPECIAL_3R_FM<0b00011, 0b011001>;
137 class MUL_R6_ENC : SPECIAL_3R_FM<0b00010, 0b011000>;
138 class MULU_ENC : SPECIAL_3R_FM<0b00010, 0b011001>;
140 class MADDF_S_ENC : COP1_3R_FM<0b011000, FIELD_FMT_S>;
141 class MADDF_D_ENC : COP1_3R_FM<0b011000, FIELD_FMT_D>;
142 class MSUBF_S_ENC : COP1_3R_FM<0b011001, FIELD_FMT_S>;
143 class MSUBF_D_ENC : COP1_3R_FM<0b011001, FIELD_FMT_D>;
145 class SEL_D_ENC : COP1_3R_FM<0b010000, FIELD_FMT_D>;
146 class SEL_S_ENC : COP1_3R_FM<0b010000, FIELD_FMT_S>;
148 class SELEQZ_ENC : SPECIAL_3R_FM<0b00000, 0b110101>;
149 class SELNEZ_ENC : SPECIAL_3R_FM<0b00000, 0b110111>;
151 class LWPC_ENC : PCREL19_FM<OPCODE2_LWPC>;
152 class LWUPC_ENC : PCREL19_FM<OPCODE2_LWUPC>;
154 class MAX_S_ENC : COP1_3R_FM<0b011101, FIELD_FMT_S>;
155 class MAX_D_ENC : COP1_3R_FM<0b011101, FIELD_FMT_D>;
156 class MIN_S_ENC : COP1_3R_FM<0b011100, FIELD_FMT_S>;
157 class MIN_D_ENC : COP1_3R_FM<0b011100, FIELD_FMT_D>;
159 class MAXA_S_ENC : COP1_3R_FM<0b011111, FIELD_FMT_S>;
160 class MAXA_D_ENC : COP1_3R_FM<0b011111, FIELD_FMT_D>;
161 class MINA_S_ENC : COP1_3R_FM<0b011110, FIELD_FMT_S>;
162 class MINA_D_ENC : COP1_3R_FM<0b011110, FIELD_FMT_D>;
164 class SELEQZ_S_ENC : COP1_3R_FM<0b010100, FIELD_FMT_S>;
165 class SELEQZ_D_ENC : COP1_3R_FM<0b010100, FIELD_FMT_D>;
166 class SELNEZ_S_ENC : COP1_3R_FM<0b010111, FIELD_FMT_S>;
167 class SELNEZ_D_ENC : COP1_3R_FM<0b010111, FIELD_FMT_D>;
169 class RINT_S_ENC : COP1_2R_FM<0b011010, FIELD_FMT_S>;
170 class RINT_D_ENC : COP1_2R_FM<0b011010, FIELD_FMT_D>;
171 class CLASS_S_ENC : COP1_2R_FM<0b011011, FIELD_FMT_S>;
172 class CLASS_D_ENC : COP1_2R_FM<0b011011, FIELD_FMT_D>;
174 class CMP_CONDN_DESC_BASE<string CondStr, string Typestr, RegisterOperand FGROpnd> {
175 dag OutOperandList = (outs FGROpnd:$fd);
176 dag InOperandList = (ins FGROpnd:$fs, FGROpnd:$ft);
177 string AsmString = !strconcat("cmp.", CondStr, ".", Typestr, "\t$fd, $fs, $ft");
178 list<dag> Pattern = [];
181 //===----------------------------------------------------------------------===//
183 // Instruction Multiclasses
185 //===----------------------------------------------------------------------===//
187 multiclass CMP_CC_M <FIELD_CMP_FORMAT Format, string Typestr,
188 RegisterOperand FGROpnd>{
189 def CMP_F_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_F>,
190 CMP_CONDN_DESC_BASE<"f", Typestr, FGROpnd>,
192 def CMP_UN_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_UN>,
193 CMP_CONDN_DESC_BASE<"un", Typestr, FGROpnd>,
195 def CMP_EQ_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_EQ>,
196 CMP_CONDN_DESC_BASE<"eq", Typestr, FGROpnd>,
198 def CMP_UEQ_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_UEQ>,
199 CMP_CONDN_DESC_BASE<"ueq", Typestr, FGROpnd>,
201 def CMP_OLT_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_OLT>,
202 CMP_CONDN_DESC_BASE<"olt", Typestr, FGROpnd>,
204 def CMP_ULT_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_ULT>,
205 CMP_CONDN_DESC_BASE<"ult", Typestr, FGROpnd>,
207 def CMP_OLE_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_OLE>,
208 CMP_CONDN_DESC_BASE<"ole", Typestr, FGROpnd>,
210 def CMP_ULE_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_ULE>,
211 CMP_CONDN_DESC_BASE<"ule", Typestr, FGROpnd>,
213 def CMP_SF_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_SF>,
214 CMP_CONDN_DESC_BASE<"sf", Typestr, FGROpnd>,
216 def CMP_NGLE_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_NGLE>,
217 CMP_CONDN_DESC_BASE<"ngle", Typestr, FGROpnd>,
219 def CMP_SEQ_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_SEQ>,
220 CMP_CONDN_DESC_BASE<"seq", Typestr, FGROpnd>,
222 def CMP_NGL_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_NGL>,
223 CMP_CONDN_DESC_BASE<"ngl", Typestr, FGROpnd>,
225 def CMP_LT_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_LT>,
226 CMP_CONDN_DESC_BASE<"lt", Typestr, FGROpnd>,
228 def CMP_NGE_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_NGE>,
229 CMP_CONDN_DESC_BASE<"nge", Typestr, FGROpnd>,
231 def CMP_LE_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_LE>,
232 CMP_CONDN_DESC_BASE<"le", Typestr, FGROpnd>,
234 def CMP_NGT_#NAME : COP1_CMP_CONDN_FM<Format, FIELD_CMP_COND_NGT>,
235 CMP_CONDN_DESC_BASE<"ngt", Typestr, FGROpnd>,
239 //===----------------------------------------------------------------------===//
241 // Instruction Descriptions
243 //===----------------------------------------------------------------------===//
245 class PCREL_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
247 dag OutOperandList = (outs GPROpnd:$rs);
248 dag InOperandList = (ins ImmOpnd:$imm);
249 string AsmString = !strconcat(instr_asm, "\t$rs, $imm");
250 list<dag> Pattern = [];
253 class ADDIUPC_DESC : PCREL_DESC_BASE<"addiupc", GPR32Opnd, simm19_lsl2>;
254 class LWPC_DESC: PCREL_DESC_BASE<"lwpc", GPR32Opnd, simm19_lsl2>;
255 class LWUPC_DESC: PCREL_DESC_BASE<"lwupc", GPR32Opnd, simm19_lsl2>;
257 class ALIGN_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
259 dag OutOperandList = (outs GPROpnd:$rd);
260 dag InOperandList = (ins GPROpnd:$rs, GPROpnd:$rt, ImmOpnd:$bp);
261 string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt, $bp");
262 list<dag> Pattern = [];
265 class ALIGN_DESC : ALIGN_DESC_BASE<"align", GPR32Opnd, uimm2>;
267 class ALUIPC_DESC_BASE<string instr_asm, RegisterOperand GPROpnd> {
268 dag OutOperandList = (outs GPROpnd:$rs);
269 dag InOperandList = (ins simm16:$imm);
270 string AsmString = !strconcat(instr_asm, "\t$rs, $imm");
271 list<dag> Pattern = [];
274 class ALUIPC_DESC : ALUIPC_DESC_BASE<"aluipc", GPR32Opnd>;
275 class AUIPC_DESC : ALUIPC_DESC_BASE<"auipc", GPR32Opnd>;
277 class AUI_DESC_BASE<string instr_asm, RegisterOperand GPROpnd> {
278 dag OutOperandList = (outs GPROpnd:$rs);
279 dag InOperandList = (ins GPROpnd:$rt, simm16:$imm);
280 string AsmString = !strconcat(instr_asm, "\t$rs, $rt, $imm");
281 list<dag> Pattern = [];
284 class AUI_DESC : AUI_DESC_BASE<"aui", GPR32Opnd>;
286 class BRANCH_DESC_BASE {
288 bit isTerminator = 1;
289 bit hasDelaySlot = 0;
292 class BC_DESC_BASE<string instr_asm, DAGOperand opnd> : BRANCH_DESC_BASE {
293 dag InOperandList = (ins opnd:$offset);
294 dag OutOperandList = (outs);
295 string AsmString = !strconcat(instr_asm, "\t$offset");
299 class CMP_BC_DESC_BASE<string instr_asm, DAGOperand opnd,
300 RegisterOperand GPROpnd> : BRANCH_DESC_BASE {
301 dag InOperandList = (ins GPROpnd:$rs, GPROpnd:$rt, opnd:$offset);
302 dag OutOperandList = (outs);
303 string AsmString = !strconcat(instr_asm, "\t$rs, $rt, $offset");
304 list<Register> Defs = [AT];
307 class CMP_CBR_EQNE_Z_DESC_BASE<string instr_asm, DAGOperand opnd,
308 RegisterOperand GPROpnd> : BRANCH_DESC_BASE {
309 dag InOperandList = (ins GPROpnd:$rs, opnd:$offset);
310 dag OutOperandList = (outs);
311 string AsmString = !strconcat(instr_asm, "\t$rs, $offset");
312 list<Register> Defs = [AT];
315 class CMP_CBR_RT_Z_DESC_BASE<string instr_asm, DAGOperand opnd,
316 RegisterOperand GPROpnd> : BRANCH_DESC_BASE {
317 dag InOperandList = (ins GPROpnd:$rt, opnd:$offset);
318 dag OutOperandList = (outs);
319 string AsmString = !strconcat(instr_asm, "\t$rt, $offset");
320 list<Register> Defs = [AT];
323 class BALC_DESC : BC_DESC_BASE<"balc", brtarget26> {
325 list<Register> Defs = [RA];
328 class BC_DESC : BC_DESC_BASE<"bc", brtarget26>;
329 class BGEC_DESC : CMP_BC_DESC_BASE<"bgec", brtarget, GPR32Opnd>;
330 class BGEUC_DESC : CMP_BC_DESC_BASE<"bgeuc", brtarget, GPR32Opnd>;
331 class BEQC_DESC : CMP_BC_DESC_BASE<"beqc", brtarget, GPR32Opnd>;
332 class BNEC_DESC : CMP_BC_DESC_BASE<"bnec", brtarget, GPR32Opnd>;
334 class BLTZC_DESC : CMP_CBR_RT_Z_DESC_BASE<"bltzc", brtarget, GPR32Opnd>;
335 class BGEZC_DESC : CMP_CBR_RT_Z_DESC_BASE<"bgezc", brtarget, GPR32Opnd>;
337 class BLEZC_DESC : CMP_CBR_RT_Z_DESC_BASE<"blezc", brtarget, GPR32Opnd>;
338 class BGTZC_DESC : CMP_CBR_RT_Z_DESC_BASE<"bgtzc", brtarget, GPR32Opnd>;
340 class BEQZC_DESC : CMP_CBR_EQNE_Z_DESC_BASE<"beqzc", brtarget21, GPR32Opnd>;
341 class BNEZC_DESC : CMP_CBR_EQNE_Z_DESC_BASE<"bnezc", brtarget21, GPR32Opnd>;
343 class COP1_BCCZ_DESC_BASE<string instr_asm> : BRANCH_DESC_BASE {
344 dag InOperandList = (ins FGR64Opnd:$ft, brtarget:$offset);
345 dag OutOperandList = (outs);
346 string AsmString = instr_asm;
347 bit hasDelaySlot = 1;
350 class BC1EQZ_DESC : COP1_BCCZ_DESC_BASE<"bc1eqz $ft, $offset">;
351 class BC1NEZ_DESC : COP1_BCCZ_DESC_BASE<"bc1nez $ft, $offset">;
353 class COP2_BCCZ_DESC_BASE<string instr_asm> : BRANCH_DESC_BASE {
354 dag InOperandList = (ins COP2Opnd:$ct, brtarget:$offset);
355 dag OutOperandList = (outs);
356 string AsmString = instr_asm;
357 bit hasDelaySlot = 1;
360 class BC2EQZ_DESC : COP2_BCCZ_DESC_BASE<"bc2eqz $ct, $offset">;
361 class BC2NEZ_DESC : COP2_BCCZ_DESC_BASE<"bc2nez $ct, $offset">;
363 class BOVC_DESC : CMP_BC_DESC_BASE<"bovc", brtarget, GPR32Opnd>;
364 class BNVC_DESC : CMP_BC_DESC_BASE<"bnvc", brtarget, GPR32Opnd>;
366 class JMP_IDX_COMPACT_DESC_BASE<string opstr, DAGOperand opnd,
367 RegisterOperand GPROpnd> {
368 dag InOperandList = (ins GPROpnd:$rt, opnd:$offset);
369 string AsmString = !strconcat(opstr, "\t$rt, $offset");
370 list<dag> Pattern = [];
371 bit isTerminator = 1;
372 bit hasDelaySlot = 0;
373 string DecoderMethod = "DecodeSimm16";
376 class JIALC_DESC : JMP_IDX_COMPACT_DESC_BASE<"jialc", calloffset16,
379 list<Register> Defs = [RA];
382 class JIC_DESC : JMP_IDX_COMPACT_DESC_BASE<"jic", jmpoffset16, GPR32Opnd> {
384 list<Register> Defs = [AT];
387 class JR_HB_R6_DESC : JR_HB_DESC_BASE<"jr.hb", GPR32Opnd> {
389 bit isIndirectBranch = 1;
390 bit hasDelaySlot = 1;
395 class BITSWAP_DESC_BASE<string instr_asm, RegisterOperand GPROpnd> {
396 dag OutOperandList = (outs GPROpnd:$rd);
397 dag InOperandList = (ins GPROpnd:$rt);
398 string AsmString = !strconcat(instr_asm, "\t$rd, $rt");
399 list<dag> Pattern = [];
402 class BITSWAP_DESC : BITSWAP_DESC_BASE<"bitswap", GPR32Opnd>;
404 class DIVMOD_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
405 SDPatternOperator Op=null_frag> {
406 dag OutOperandList = (outs GPROpnd:$rd);
407 dag InOperandList = (ins GPROpnd:$rs, GPROpnd:$rt);
408 string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt");
409 list<dag> Pattern = [(set GPROpnd:$rd, (Op GPROpnd:$rs, GPROpnd:$rt))];
411 // This instruction doesn't trap division by zero itself. We must insert
412 // teq instructions as well.
413 bit usesCustomInserter = 1;
416 class DIV_DESC : DIVMOD_DESC_BASE<"div", GPR32Opnd, sdiv>;
417 class DIVU_DESC : DIVMOD_DESC_BASE<"divu", GPR32Opnd, udiv>;
418 class MOD_DESC : DIVMOD_DESC_BASE<"mod", GPR32Opnd, srem>;
419 class MODU_DESC : DIVMOD_DESC_BASE<"modu", GPR32Opnd, urem>;
421 class BEQZALC_DESC : CMP_CBR_RT_Z_DESC_BASE<"beqzalc", brtarget, GPR32Opnd> {
422 list<Register> Defs = [RA];
425 class BGEZALC_DESC : CMP_CBR_RT_Z_DESC_BASE<"bgezalc", brtarget, GPR32Opnd> {
426 list<Register> Defs = [RA];
429 class BGTZALC_DESC : CMP_CBR_RT_Z_DESC_BASE<"bgtzalc", brtarget, GPR32Opnd> {
430 list<Register> Defs = [RA];
433 class BLEZALC_DESC : CMP_CBR_RT_Z_DESC_BASE<"blezalc", brtarget, GPR32Opnd> {
434 list<Register> Defs = [RA];
437 class BLTZALC_DESC : CMP_CBR_RT_Z_DESC_BASE<"bltzalc", brtarget, GPR32Opnd> {
438 list<Register> Defs = [RA];
441 class BNEZALC_DESC : CMP_CBR_RT_Z_DESC_BASE<"bnezalc", brtarget, GPR32Opnd> {
442 list<Register> Defs = [RA];
445 class MUL_R6_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
446 SDPatternOperator Op=null_frag> {
447 dag OutOperandList = (outs GPROpnd:$rd);
448 dag InOperandList = (ins GPROpnd:$rs, GPROpnd:$rt);
449 string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt");
450 list<dag> Pattern = [(set GPROpnd:$rd, (Op GPROpnd:$rs, GPROpnd:$rt))];
453 class MUH_DESC : MUL_R6_DESC_BASE<"muh", GPR32Opnd, mulhs>;
454 class MUHU_DESC : MUL_R6_DESC_BASE<"muhu", GPR32Opnd, mulhu>;
455 class MUL_R6_DESC : MUL_R6_DESC_BASE<"mul", GPR32Opnd, mul>;
456 class MULU_DESC : MUL_R6_DESC_BASE<"mulu", GPR32Opnd>;
458 class COP1_4R_DESC_BASE<string instr_asm, RegisterOperand FGROpnd> {
459 dag OutOperandList = (outs FGROpnd:$fd);
460 dag InOperandList = (ins FGROpnd:$fd_in, FGROpnd:$fs, FGROpnd:$ft);
461 string AsmString = !strconcat(instr_asm, "\t$fd, $fs, $ft");
462 list<dag> Pattern = [];
463 string Constraints = "$fd_in = $fd";
466 class SEL_D_DESC : COP1_4R_DESC_BASE<"sel.d", FGR64Opnd>;
467 class SEL_S_DESC : COP1_4R_DESC_BASE<"sel.s", FGR32Opnd>;
469 class SELEQNE_Z_DESC_BASE<string instr_asm, RegisterOperand GPROpnd> {
470 dag OutOperandList = (outs GPROpnd:$rd);
471 dag InOperandList = (ins GPROpnd:$rs, GPROpnd:$rt);
472 string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt");
473 list<dag> Pattern = [];
476 class SELEQZ_DESC : SELEQNE_Z_DESC_BASE<"seleqz", GPR32Opnd>;
477 class SELNEZ_DESC : SELEQNE_Z_DESC_BASE<"selnez", GPR32Opnd>;
479 class MADDF_S_DESC : COP1_4R_DESC_BASE<"maddf.s", FGR32Opnd>;
480 class MADDF_D_DESC : COP1_4R_DESC_BASE<"maddf.d", FGR64Opnd>;
481 class MSUBF_S_DESC : COP1_4R_DESC_BASE<"msubf.s", FGR32Opnd>;
482 class MSUBF_D_DESC : COP1_4R_DESC_BASE<"msubf.d", FGR64Opnd>;
484 class MAX_MIN_DESC_BASE<string instr_asm, RegisterOperand FGROpnd> {
485 dag OutOperandList = (outs FGROpnd:$fd);
486 dag InOperandList = (ins FGROpnd:$fs, FGROpnd:$ft);
487 string AsmString = !strconcat(instr_asm, "\t$fd, $fs, $ft");
488 list<dag> Pattern = [];
491 class MAX_S_DESC : MAX_MIN_DESC_BASE<"max.s", FGR32Opnd>;
492 class MAX_D_DESC : MAX_MIN_DESC_BASE<"max.d", FGR64Opnd>;
493 class MIN_S_DESC : MAX_MIN_DESC_BASE<"min.s", FGR32Opnd>;
494 class MIN_D_DESC : MAX_MIN_DESC_BASE<"min.d", FGR64Opnd>;
496 class MAXA_S_DESC : MAX_MIN_DESC_BASE<"maxa.s", FGR32Opnd>;
497 class MAXA_D_DESC : MAX_MIN_DESC_BASE<"maxa.d", FGR64Opnd>;
498 class MINA_S_DESC : MAX_MIN_DESC_BASE<"mina.s", FGR32Opnd>;
499 class MINA_D_DESC : MAX_MIN_DESC_BASE<"mina.d", FGR64Opnd>;
501 class SELEQNEZ_DESC_BASE<string instr_asm, RegisterOperand FGROpnd> {
502 dag OutOperandList = (outs FGROpnd:$fd);
503 dag InOperandList = (ins FGROpnd:$fs, FGROpnd:$ft);
504 string AsmString = !strconcat(instr_asm, "\t$fd, $fs, $ft");
505 list<dag> Pattern = [];
508 class SELEQZ_S_DESC : SELEQNEZ_DESC_BASE<"seleqz.s", FGR32Opnd>;
509 class SELEQZ_D_DESC : SELEQNEZ_DESC_BASE<"seleqz.d", FGR64Opnd>;
510 class SELNEZ_S_DESC : SELEQNEZ_DESC_BASE<"selnez.s", FGR32Opnd>;
511 class SELNEZ_D_DESC : SELEQNEZ_DESC_BASE<"selnez.d", FGR64Opnd>;
513 class CLASS_RINT_DESC_BASE<string instr_asm, RegisterOperand FGROpnd> {
514 dag OutOperandList = (outs FGROpnd:$fd);
515 dag InOperandList = (ins FGROpnd:$fs);
516 string AsmString = !strconcat(instr_asm, "\t$fd, $fs");
517 list<dag> Pattern = [];
520 class RINT_S_DESC : CLASS_RINT_DESC_BASE<"rint.s", FGR32Opnd>;
521 class RINT_D_DESC : CLASS_RINT_DESC_BASE<"rint.d", FGR64Opnd>;
522 class CLASS_S_DESC : CLASS_RINT_DESC_BASE<"class.s", FGR32Opnd>;
523 class CLASS_D_DESC : CLASS_RINT_DESC_BASE<"class.d", FGR64Opnd>;
525 //===----------------------------------------------------------------------===//
527 // Instruction Definitions
529 //===----------------------------------------------------------------------===//
531 def ADDIUPC : ADDIUPC_ENC, ADDIUPC_DESC, ISA_MIPS32R6;
532 def ALIGN : ALIGN_ENC, ALIGN_DESC, ISA_MIPS32R6;
533 def ALUIPC : ALUIPC_ENC, ALUIPC_DESC, ISA_MIPS32R6;
534 def AUI : AUI_ENC, AUI_DESC, ISA_MIPS32R6;
535 def AUIPC : AUIPC_ENC, AUIPC_DESC, ISA_MIPS32R6;
536 def BALC : BALC_ENC, BALC_DESC, ISA_MIPS32R6;
537 def BC1EQZ : BC1EQZ_ENC, BC1EQZ_DESC, ISA_MIPS32R6;
538 def BC1NEZ : BC1NEZ_ENC, BC1NEZ_DESC, ISA_MIPS32R6;
539 def BC2EQZ : BC2EQZ_ENC, BC2EQZ_DESC, ISA_MIPS32R6;
540 def BC2NEZ : BC2NEZ_ENC, BC2NEZ_DESC, ISA_MIPS32R6;
541 def BC : BC_ENC, BC_DESC, ISA_MIPS32R6;
542 def BEQC : BEQC_ENC, BEQC_DESC, ISA_MIPS32R6;
543 def BEQZALC : BEQZALC_ENC, BEQZALC_DESC, ISA_MIPS32R6;
544 def BEQZC : BEQZC_ENC, BEQZC_DESC, ISA_MIPS32R6;
545 def BGEC : BGEC_ENC, BGEC_DESC, ISA_MIPS32R6;
546 def BGEUC : BGEUC_ENC, BGEUC_DESC, ISA_MIPS32R6;
547 def BGEZALC : BGEZALC_ENC, BGEZALC_DESC, ISA_MIPS32R6;
548 def BGEZC : BGEZC_ENC, BGEZC_DESC, ISA_MIPS32R6;
549 def BGTZALC : BGTZALC_ENC, BGTZALC_DESC, ISA_MIPS32R6;
550 def BGTZC : BGTZC_ENC, BGTZC_DESC, ISA_MIPS32R6;
551 def BITSWAP : BITSWAP_ENC, BITSWAP_DESC, ISA_MIPS32R6;
552 def BLEZALC : BLEZALC_ENC, BLEZALC_DESC, ISA_MIPS32R6;
553 def BLEZC : BLEZC_ENC, BLEZC_DESC, ISA_MIPS32R6;
554 def BLTC; // Also aliased to bgtc with operands swapped
555 def BLTUC; // Also aliased to bgtuc with operands swapped
556 def BLTZALC : BLTZALC_ENC, BLTZALC_DESC, ISA_MIPS32R6;
557 def BLTZC : BLTZC_ENC, BLTZC_DESC, ISA_MIPS32R6;
558 def BNEC : BNEC_ENC, BNEC_DESC, ISA_MIPS32R6;
559 def BNEZALC : BNEZALC_ENC, BNEZALC_DESC, ISA_MIPS32R6;
560 def BNEZC : BNEZC_ENC, BNEZC_DESC, ISA_MIPS32R6;
561 def BNVC : BNVC_ENC, BNVC_DESC, ISA_MIPS32R6;
562 def BOVC : BOVC_ENC, BOVC_DESC, ISA_MIPS32R6;
563 def CLASS_D : CLASS_D_ENC, CLASS_D_DESC, ISA_MIPS32R6;
564 def CLASS_S : CLASS_S_ENC, CLASS_S_DESC, ISA_MIPS32R6;
565 defm S : CMP_CC_M<FIELD_CMP_FORMAT_S, "s", FGR32Opnd>;
566 defm D : CMP_CC_M<FIELD_CMP_FORMAT_D, "d", FGR64Opnd>;
567 def DIV : DIV_ENC, DIV_DESC, ISA_MIPS32R6;
568 def DIVU : DIVU_ENC, DIVU_DESC, ISA_MIPS32R6;
569 def JIALC : JIALC_ENC, JIALC_DESC, ISA_MIPS32R6;
570 def JIC : JIC_ENC, JIC_DESC, ISA_MIPS32R6;
571 def JR_HB_R6 : JR_HB_R6_ENC, JR_HB_R6_DESC, ISA_MIPS32R6;
572 // def LSA; // See MSA
573 def LWPC : LWPC_ENC, LWPC_DESC, ISA_MIPS32R6;
574 def LWUPC : LWUPC_ENC, LWUPC_DESC, ISA_MIPS32R6;
575 def MADDF_S : MADDF_S_ENC, MADDF_S_DESC, ISA_MIPS32R6;
576 def MADDF_D : MADDF_D_ENC, MADDF_D_DESC, ISA_MIPS32R6;
577 def MAXA_D : MAXA_D_ENC, MAXA_D_DESC, ISA_MIPS32R6;
578 def MAXA_S : MAXA_S_ENC, MAXA_S_DESC, ISA_MIPS32R6;
579 def MAX_D : MAX_D_ENC, MAX_D_DESC, ISA_MIPS32R6;
580 def MAX_S : MAX_S_ENC, MAX_S_DESC, ISA_MIPS32R6;
581 def MINA_D : MINA_D_ENC, MINA_D_DESC, ISA_MIPS32R6;
582 def MINA_S : MINA_S_ENC, MINA_S_DESC, ISA_MIPS32R6;
583 def MIN_D : MIN_D_ENC, MIN_D_DESC, ISA_MIPS32R6;
584 def MIN_S : MIN_S_ENC, MIN_S_DESC, ISA_MIPS32R6;
585 def MOD : MOD_ENC, MOD_DESC, ISA_MIPS32R6;
586 def MODU : MODU_ENC, MODU_DESC, ISA_MIPS32R6;
587 def MSUBF_S : MSUBF_S_ENC, MSUBF_S_DESC, ISA_MIPS32R6;
588 def MSUBF_D : MSUBF_D_ENC, MSUBF_D_DESC, ISA_MIPS32R6;
589 def MUH : MUH_ENC, MUH_DESC, ISA_MIPS32R6;
590 def MUHU : MUHU_ENC, MUHU_DESC, ISA_MIPS32R6;
591 def MUL_R6 : MUL_R6_ENC, MUL_R6_DESC, ISA_MIPS32R6;
592 def MULU : MULU_ENC, MULU_DESC, ISA_MIPS32R6;
593 def NAL; // BAL with rd=0
594 def RINT_D : RINT_D_ENC, RINT_D_DESC, ISA_MIPS32R6;
595 def RINT_S : RINT_S_ENC, RINT_S_DESC, ISA_MIPS32R6;
596 def SELEQZ : SELEQZ_ENC, SELEQZ_DESC, ISA_MIPS32R6;
597 def SELEQZ_D : SELEQZ_D_ENC, SELEQZ_D_DESC, ISA_MIPS32R6;
598 def SELEQZ_S : SELEQZ_S_ENC, SELEQZ_S_DESC, ISA_MIPS32R6;
599 def SELNEZ : SELNEZ_ENC, SELNEZ_DESC, ISA_MIPS32R6;
600 def SELNEZ_D : SELNEZ_D_ENC, SELNEZ_D_DESC, ISA_MIPS32R6;
601 def SELNEZ_S : SELNEZ_S_ENC, SELNEZ_S_DESC, ISA_MIPS32R6;
602 def SEL_D : SEL_D_ENC, SEL_D_DESC, ISA_MIPS32R6;
603 def SEL_S : SEL_S_ENC, SEL_S_DESC, ISA_MIPS32R6;