1 //===-- SIInstrInfo.td - SI Instruction Infos -------------*- 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 //===----------------------------------------------------------------------===//
15 class vopc <bits<8> si, bits<8> vi = !add(0x40, si)> : vop {
16 field bits<8> SI = si;
17 field bits<8> VI = vi;
19 field bits<9> SI3 = {0, si{7-0}};
20 field bits<10> VI3 = {0, 0, vi{7-0}};
23 class vop1 <bits<8> si, bits<8> vi = si> : vop {
24 field bits<8> SI = si;
25 field bits<8> VI = vi;
27 field bits<9> SI3 = {1, 1, si{6-0}};
28 field bits<10> VI3 = !add(0x140, vi);
31 class vop2 <bits<6> si, bits<6> vi = si> : vop {
32 field bits<6> SI = si;
33 field bits<6> VI = vi;
35 field bits<9> SI3 = {1, 0, 0, si{5-0}};
36 field bits<10> VI3 = {0, 1, 0, 0, vi{5-0}};
39 // Specify a VOP2 opcode for SI and VOP3 opcode for VI
40 // that doesn't have VOP2 encoding on VI
41 class vop23 <bits<6> si, bits<10> vi> : vop2 <si> {
45 class vop3 <bits<9> si, bits<10> vi = {0, si}> : vop {
50 class sop1 <bits<8> si, bits<8> vi = si> {
51 field bits<8> SI = si;
52 field bits<8> VI = vi;
55 class sop2 <bits<7> si, bits<7> vi = si> {
56 field bits<7> SI = si;
57 field bits<7> VI = vi;
60 class sopk <bits<5> si, bits<5> vi = si> {
61 field bits<5> SI = si;
62 field bits<5> VI = vi;
65 // Execpt for the NONE field, this must be kept in sync with the SISubtarget enum
66 // in AMDGPUInstrInfo.cpp
73 //===----------------------------------------------------------------------===//
75 //===----------------------------------------------------------------------===//
77 def SIload_constant : SDNode<"AMDGPUISD::LOAD_CONSTANT",
78 SDTypeProfile<1, 2, [SDTCisVT<0, f32>, SDTCisVT<1, v4i32>, SDTCisVT<2, i32>]>,
79 [SDNPMayLoad, SDNPMemOperand]
82 def SItbuffer_store : SDNode<"AMDGPUISD::TBUFFER_STORE_FORMAT",
84 [SDTCisVT<0, v4i32>, // rsrc(SGPR)
85 SDTCisVT<1, iAny>, // vdata(VGPR)
86 SDTCisVT<2, i32>, // num_channels(imm)
87 SDTCisVT<3, i32>, // vaddr(VGPR)
88 SDTCisVT<4, i32>, // soffset(SGPR)
89 SDTCisVT<5, i32>, // inst_offset(imm)
90 SDTCisVT<6, i32>, // dfmt(imm)
91 SDTCisVT<7, i32>, // nfmt(imm)
92 SDTCisVT<8, i32>, // offen(imm)
93 SDTCisVT<9, i32>, // idxen(imm)
94 SDTCisVT<10, i32>, // glc(imm)
95 SDTCisVT<11, i32>, // slc(imm)
96 SDTCisVT<12, i32> // tfe(imm)
98 [SDNPMayStore, SDNPMemOperand, SDNPHasChain]
101 def SIload_input : SDNode<"AMDGPUISD::LOAD_INPUT",
102 SDTypeProfile<1, 3, [SDTCisVT<0, v4f32>, SDTCisVT<1, v4i32>, SDTCisVT<2, i16>,
106 class SDSample<string opcode> : SDNode <opcode,
107 SDTypeProfile<1, 4, [SDTCisVT<0, v4f32>, SDTCisVT<2, v32i8>,
108 SDTCisVT<3, v4i32>, SDTCisVT<4, i32>]>
111 def SIsample : SDSample<"AMDGPUISD::SAMPLE">;
112 def SIsampleb : SDSample<"AMDGPUISD::SAMPLEB">;
113 def SIsampled : SDSample<"AMDGPUISD::SAMPLED">;
114 def SIsamplel : SDSample<"AMDGPUISD::SAMPLEL">;
116 def SIconstdata_ptr : SDNode<
117 "AMDGPUISD::CONST_DATA_PTR", SDTypeProfile <1, 0, [SDTCisVT<0, i64>]>
120 // Transformation function, extract the lower 32bit of a 64bit immediate
121 def LO32 : SDNodeXForm<imm, [{
122 return CurDAG->getTargetConstant(N->getZExtValue() & 0xffffffff, MVT::i32);
125 def LO32f : SDNodeXForm<fpimm, [{
126 APInt V = N->getValueAPF().bitcastToAPInt().trunc(32);
127 return CurDAG->getTargetConstantFP(APFloat(APFloat::IEEEsingle, V), MVT::f32);
130 // Transformation function, extract the upper 32bit of a 64bit immediate
131 def HI32 : SDNodeXForm<imm, [{
132 return CurDAG->getTargetConstant(N->getZExtValue() >> 32, MVT::i32);
135 def HI32f : SDNodeXForm<fpimm, [{
136 APInt V = N->getValueAPF().bitcastToAPInt().lshr(32).trunc(32);
137 return CurDAG->getTargetConstantFP(APFloat(APFloat::IEEEsingle, V), MVT::f32);
140 def IMM8bitDWORD : PatLeaf <(imm),
141 [{return (N->getZExtValue() & ~0x3FC) == 0;}]
144 def as_dword_i32imm : SDNodeXForm<imm, [{
145 return CurDAG->getTargetConstant(N->getZExtValue() >> 2, MVT::i32);
148 def as_i1imm : SDNodeXForm<imm, [{
149 return CurDAG->getTargetConstant(N->getZExtValue(), MVT::i1);
152 def as_i8imm : SDNodeXForm<imm, [{
153 return CurDAG->getTargetConstant(N->getZExtValue(), MVT::i8);
156 def as_i16imm : SDNodeXForm<imm, [{
157 return CurDAG->getTargetConstant(N->getSExtValue(), MVT::i16);
160 def as_i32imm: SDNodeXForm<imm, [{
161 return CurDAG->getTargetConstant(N->getSExtValue(), MVT::i32);
164 def as_i64imm: SDNodeXForm<imm, [{
165 return CurDAG->getTargetConstant(N->getSExtValue(), MVT::i64);
168 // Copied from the AArch64 backend:
169 def bitcast_fpimm_to_i32 : SDNodeXForm<fpimm, [{
170 return CurDAG->getTargetConstant(
171 N->getValueAPF().bitcastToAPInt().getZExtValue(), MVT::i32);
174 // Copied from the AArch64 backend:
175 def bitcast_fpimm_to_i64 : SDNodeXForm<fpimm, [{
176 return CurDAG->getTargetConstant(
177 N->getValueAPF().bitcastToAPInt().getZExtValue(), MVT::i64);
180 def IMM8bit : PatLeaf <(imm),
181 [{return isUInt<8>(N->getZExtValue());}]
184 def IMM12bit : PatLeaf <(imm),
185 [{return isUInt<12>(N->getZExtValue());}]
188 def IMM16bit : PatLeaf <(imm),
189 [{return isUInt<16>(N->getZExtValue());}]
192 def IMM20bit : PatLeaf <(imm),
193 [{return isUInt<20>(N->getZExtValue());}]
196 def IMM32bit : PatLeaf <(imm),
197 [{return isUInt<32>(N->getZExtValue());}]
200 def mubuf_vaddr_offset : PatFrag<
201 (ops node:$ptr, node:$offset, node:$imm_offset),
202 (add (add node:$ptr, node:$offset), node:$imm_offset)
205 class InlineImm <ValueType vt> : PatLeaf <(vt imm), [{
206 return isInlineImmediate(N);
209 class InlineFPImm <ValueType vt> : PatLeaf <(vt fpimm), [{
210 return isInlineImmediate(N);
213 class SGPRImm <dag frag> : PatLeaf<frag, [{
214 if (Subtarget->getGeneration() < AMDGPUSubtarget::SOUTHERN_ISLANDS) {
217 const SIRegisterInfo *SIRI =
218 static_cast<const SIRegisterInfo *>(Subtarget->getRegisterInfo());
219 for (SDNode::use_iterator U = N->use_begin(), E = SDNode::use_end();
221 if (SIRI->isSGPRClass(getOperandRegClass(*U, U.getOperandNo()))) {
228 //===----------------------------------------------------------------------===//
230 //===----------------------------------------------------------------------===//
232 def FRAMEri32 : Operand<iPTR> {
233 let MIOperandInfo = (ops i32:$ptr, i32imm:$index);
236 def sopp_brtarget : Operand<OtherVT> {
237 let EncoderMethod = "getSOPPBrEncoding";
238 let OperandType = "OPERAND_PCREL";
241 include "SIInstrFormats.td"
242 include "VIInstrFormats.td"
244 let OperandType = "OPERAND_IMMEDIATE" in {
246 def offen : Operand<i1> {
247 let PrintMethod = "printOffen";
249 def idxen : Operand<i1> {
250 let PrintMethod = "printIdxen";
252 def addr64 : Operand<i1> {
253 let PrintMethod = "printAddr64";
255 def mbuf_offset : Operand<i16> {
256 let PrintMethod = "printMBUFOffset";
258 def ds_offset : Operand<i16> {
259 let PrintMethod = "printDSOffset";
261 def ds_offset0 : Operand<i8> {
262 let PrintMethod = "printDSOffset0";
264 def ds_offset1 : Operand<i8> {
265 let PrintMethod = "printDSOffset1";
267 def gds : Operand <i1> {
268 let PrintMethod = "printGDS";
270 def glc : Operand <i1> {
271 let PrintMethod = "printGLC";
273 def slc : Operand <i1> {
274 let PrintMethod = "printSLC";
276 def tfe : Operand <i1> {
277 let PrintMethod = "printTFE";
280 def omod : Operand <i32> {
281 let PrintMethod = "printOModSI";
284 def ClampMod : Operand <i1> {
285 let PrintMethod = "printClampSI";
288 } // End OperandType = "OPERAND_IMMEDIATE"
290 def VOPDstS64 : VOPDstOperand <SReg_64>;
292 //===----------------------------------------------------------------------===//
294 //===----------------------------------------------------------------------===//
296 def DS1Addr1Offset : ComplexPattern<i32, 2, "SelectDS1Addr1Offset">;
297 def DS64Bit4ByteAligned : ComplexPattern<i32, 3, "SelectDS64Bit4ByteAligned">;
299 def MUBUFAddr32 : ComplexPattern<i64, 9, "SelectMUBUFAddr32">;
300 def MUBUFAddr64 : ComplexPattern<i64, 7, "SelectMUBUFAddr64">;
301 def MUBUFAddr64Atomic : ComplexPattern<i64, 5, "SelectMUBUFAddr64">;
302 def MUBUFScratch : ComplexPattern<i64, 4, "SelectMUBUFScratch">;
303 def MUBUFOffset : ComplexPattern<i64, 6, "SelectMUBUFOffset">;
304 def MUBUFOffsetAtomic : ComplexPattern<i64, 4, "SelectMUBUFOffset">;
306 def VOP3Mods0 : ComplexPattern<untyped, 4, "SelectVOP3Mods0">;
307 def VOP3Mods0Clamp : ComplexPattern<untyped, 3, "SelectVOP3Mods0Clamp">;
308 def VOP3Mods0Clamp0OMod : ComplexPattern<untyped, 4, "SelectVOP3Mods0Clamp0OMod">;
309 def VOP3Mods : ComplexPattern<untyped, 2, "SelectVOP3Mods">;
311 //===----------------------------------------------------------------------===//
312 // SI assembler operands
313 //===----------------------------------------------------------------------===//
333 //===----------------------------------------------------------------------===//
335 // SI Instruction multiclass helpers.
337 // Instructions with _32 take 32-bit operands.
338 // Instructions with _64 take 64-bit operands.
340 // VOP_* instructions can use either a 32-bit or 64-bit encoding. The 32-bit
341 // encoding is the standard encoding, but instruction that make use of
342 // any of the instruction modifiers must use the 64-bit encoding.
344 // Instructions with _e32 use the 32-bit encoding.
345 // Instructions with _e64 use the 64-bit encoding.
347 //===----------------------------------------------------------------------===//
349 class SIMCInstr <string pseudo, int subtarget> {
350 string PseudoInstr = pseudo;
351 int Subtarget = subtarget;
354 //===----------------------------------------------------------------------===//
356 //===----------------------------------------------------------------------===//
358 class EXPCommon : InstSI<
360 (ins i32imm:$en, i32imm:$tgt, i32imm:$compr, i32imm:$done, i32imm:$vm,
361 VGPR_32:$src0, VGPR_32:$src1, VGPR_32:$src2, VGPR_32:$src3),
362 "exp $en, $tgt, $compr, $done, $vm, $src0, $src1, $src2, $src3",
371 let isPseudo = 1, isCodeGenOnly = 1 in {
372 def "" : EXPCommon, SIMCInstr <"exp", SISubtarget.NONE> ;
375 def _si : EXPCommon, SIMCInstr <"exp", SISubtarget.SI>, EXPe;
377 def _vi : EXPCommon, SIMCInstr <"exp", SISubtarget.VI>, EXPe_vi;
380 //===----------------------------------------------------------------------===//
382 //===----------------------------------------------------------------------===//
384 class SOP1_Pseudo <string opName, dag outs, dag ins, list<dag> pattern> :
385 SOP1 <outs, ins, "", pattern>,
386 SIMCInstr<opName, SISubtarget.NONE> {
388 let isCodeGenOnly = 1;
391 class SOP1_Real_si <sop1 op, string opName, dag outs, dag ins, string asm> :
392 SOP1 <outs, ins, asm, []>,
394 SIMCInstr<opName, SISubtarget.SI>;
396 class SOP1_Real_vi <sop1 op, string opName, dag outs, dag ins, string asm> :
397 SOP1 <outs, ins, asm, []>,
399 SIMCInstr<opName, SISubtarget.VI>;
401 multiclass SOP1_m <sop1 op, string opName, dag outs, dag ins, string asm,
404 def "" : SOP1_Pseudo <opName, outs, ins, pattern>;
406 def _si : SOP1_Real_si <op, opName, outs, ins, asm>;
408 def _vi : SOP1_Real_vi <op, opName, outs, ins, asm>;
412 multiclass SOP1_32 <sop1 op, string opName, list<dag> pattern> : SOP1_m <
413 op, opName, (outs SReg_32:$dst), (ins SSrc_32:$src0),
414 opName#" $dst, $src0", pattern
417 multiclass SOP1_64 <sop1 op, string opName, list<dag> pattern> : SOP1_m <
418 op, opName, (outs SReg_64:$dst), (ins SSrc_64:$src0),
419 opName#" $dst, $src0", pattern
422 // no input, 64-bit output.
423 multiclass SOP1_64_0 <sop1 op, string opName, list<dag> pattern> {
424 def "" : SOP1_Pseudo <opName, (outs SReg_64:$dst), (ins), pattern>;
426 def _si : SOP1_Real_si <op, opName, (outs SReg_64:$dst), (ins),
431 def _vi : SOP1_Real_vi <op, opName, (outs SReg_64:$dst), (ins),
437 // 64-bit input, no output
438 multiclass SOP1_1 <sop1 op, string opName, list<dag> pattern> {
439 def "" : SOP1_Pseudo <opName, (outs), (ins SReg_64:$src0), pattern>;
441 def _si : SOP1_Real_si <op, opName, (outs), (ins SReg_64:$src0),
446 def _vi : SOP1_Real_vi <op, opName, (outs), (ins SReg_64:$src0),
452 // 64-bit input, 32-bit output.
453 multiclass SOP1_32_64 <sop1 op, string opName, list<dag> pattern> : SOP1_m <
454 op, opName, (outs SReg_32:$dst), (ins SSrc_64:$src0),
455 opName#" $dst, $src0", pattern
458 class SOP2_Pseudo<string opName, dag outs, dag ins, list<dag> pattern> :
459 SOP2<outs, ins, "", pattern>,
460 SIMCInstr<opName, SISubtarget.NONE> {
462 let isCodeGenOnly = 1;
465 // Pseudo instructions have no encodings, but adding this field here allows
467 // let sdst = xxx in {
468 // for multiclasses that include both real and pseudo instructions.
469 field bits<7> sdst = 0;
472 class SOP2_Real_si<sop2 op, string opName, dag outs, dag ins, string asm> :
473 SOP2<outs, ins, asm, []>,
475 SIMCInstr<opName, SISubtarget.SI>;
477 class SOP2_Real_vi<sop2 op, string opName, dag outs, dag ins, string asm> :
478 SOP2<outs, ins, asm, []>,
480 SIMCInstr<opName, SISubtarget.VI>;
482 multiclass SOP2_SELECT_32 <sop2 op, string opName, list<dag> pattern> {
483 def "" : SOP2_Pseudo <opName, (outs SReg_32:$dst),
484 (ins SSrc_32:$src0, SSrc_32:$src1, SCCReg:$scc), pattern>;
486 def _si : SOP2_Real_si <op, opName, (outs SReg_32:$dst),
487 (ins SSrc_32:$src0, SSrc_32:$src1, SCCReg:$scc),
488 opName#" $dst, $src0, $src1 [$scc]">;
490 def _vi : SOP2_Real_vi <op, opName, (outs SReg_32:$dst),
491 (ins SSrc_32:$src0, SSrc_32:$src1, SCCReg:$scc),
492 opName#" $dst, $src0, $src1 [$scc]">;
495 multiclass SOP2_m <sop2 op, string opName, dag outs, dag ins, string asm,
498 def "" : SOP2_Pseudo <opName, outs, ins, pattern>;
500 def _si : SOP2_Real_si <op, opName, outs, ins, asm>;
502 def _vi : SOP2_Real_vi <op, opName, outs, ins, asm>;
506 multiclass SOP2_32 <sop2 op, string opName, list<dag> pattern> : SOP2_m <
507 op, opName, (outs SReg_32:$dst), (ins SSrc_32:$src0, SSrc_32:$src1),
508 opName#" $dst, $src0, $src1", pattern
511 multiclass SOP2_64 <sop2 op, string opName, list<dag> pattern> : SOP2_m <
512 op, opName, (outs SReg_64:$dst), (ins SSrc_64:$src0, SSrc_64:$src1),
513 opName#" $dst, $src0, $src1", pattern
516 multiclass SOP2_64_32 <sop2 op, string opName, list<dag> pattern> : SOP2_m <
517 op, opName, (outs SReg_64:$dst), (ins SSrc_64:$src0, SSrc_32:$src1),
518 opName#" $dst, $src0, $src1", pattern
521 class SOPC_Helper <bits<7> op, RegisterOperand rc, ValueType vt,
522 string opName, PatLeaf cond> : SOPC <
523 op, (outs SCCReg:$dst), (ins rc:$src0, rc:$src1),
524 opName#" $src0, $src1", []>;
526 class SOPC_32<bits<7> op, string opName, PatLeaf cond = COND_NULL>
527 : SOPC_Helper<op, SSrc_32, i32, opName, cond>;
529 class SOPC_64<bits<7> op, string opName, PatLeaf cond = COND_NULL>
530 : SOPC_Helper<op, SSrc_64, i64, opName, cond>;
532 class SOPK_Pseudo <string opName, dag outs, dag ins, list<dag> pattern> :
533 SOPK <outs, ins, "", pattern>,
534 SIMCInstr<opName, SISubtarget.NONE> {
536 let isCodeGenOnly = 1;
539 class SOPK_Real_si <sopk op, string opName, dag outs, dag ins, string asm> :
540 SOPK <outs, ins, asm, []>,
542 SIMCInstr<opName, SISubtarget.SI>;
544 class SOPK_Real_vi <sopk op, string opName, dag outs, dag ins, string asm> :
545 SOPK <outs, ins, asm, []>,
547 SIMCInstr<opName, SISubtarget.VI>;
549 multiclass SOPK_32 <sopk op, string opName, list<dag> pattern> {
550 def "" : SOPK_Pseudo <opName, (outs SReg_32:$dst), (ins u16imm:$src0),
553 def _si : SOPK_Real_si <op, opName, (outs SReg_32:$dst), (ins u16imm:$src0),
554 opName#" $dst, $src0">;
556 def _vi : SOPK_Real_vi <op, opName, (outs SReg_32:$dst), (ins u16imm:$src0),
557 opName#" $dst, $src0">;
560 multiclass SOPK_SCC <sopk op, string opName, list<dag> pattern> {
561 def "" : SOPK_Pseudo <opName, (outs SCCReg:$dst),
562 (ins SReg_32:$src0, u16imm:$src1), pattern>;
564 def _si : SOPK_Real_si <op, opName, (outs SCCReg:$dst),
565 (ins SReg_32:$src0, u16imm:$src1), opName#" $dst, $src0">;
567 def _vi : SOPK_Real_vi <op, opName, (outs SCCReg:$dst),
568 (ins SReg_32:$src0, u16imm:$src1), opName#" $dst, $src0">;
571 //===----------------------------------------------------------------------===//
573 //===----------------------------------------------------------------------===//
575 class SMRD_Pseudo <string opName, dag outs, dag ins, list<dag> pattern> :
576 SMRD <outs, ins, "", pattern>,
577 SIMCInstr<opName, SISubtarget.NONE> {
579 let isCodeGenOnly = 1;
582 class SMRD_Real_si <bits<5> op, string opName, bit imm, dag outs, dag ins,
584 SMRD <outs, ins, asm, []>,
586 SIMCInstr<opName, SISubtarget.SI>;
588 class SMRD_Real_vi <bits<8> op, string opName, bit imm, dag outs, dag ins,
590 SMRD <outs, ins, asm, []>,
592 SIMCInstr<opName, SISubtarget.VI>;
594 multiclass SMRD_m <bits<5> op, string opName, bit imm, dag outs, dag ins,
595 string asm, list<dag> pattern> {
597 def "" : SMRD_Pseudo <opName, outs, ins, pattern>;
599 def _si : SMRD_Real_si <op, opName, imm, outs, ins, asm>;
601 // glc is only applicable to scalar stores, which are not yet
604 def _vi : SMRD_Real_vi <{0, 0, 0, op}, opName, imm, outs, ins, asm>;
608 multiclass SMRD_Helper <bits<5> op, string opName, RegisterClass baseClass,
609 RegisterClass dstClass> {
611 op, opName#"_IMM", 1, (outs dstClass:$dst),
612 (ins baseClass:$sbase, u32imm:$offset),
613 opName#" $dst, $sbase, $offset", []
616 defm _SGPR : SMRD_m <
617 op, opName#"_SGPR", 0, (outs dstClass:$dst),
618 (ins baseClass:$sbase, SReg_32:$soff),
619 opName#" $dst, $sbase, $soff", []
623 //===----------------------------------------------------------------------===//
624 // Vector ALU classes
625 //===----------------------------------------------------------------------===//
627 // This must always be right before the operand being input modified.
628 def InputMods : OperandWithDefaultOps <i32, (ops (i32 0))> {
629 let PrintMethod = "printOperandAndMods";
631 def InputModsNoDefault : Operand <i32> {
632 let PrintMethod = "printOperandAndMods";
635 class getNumSrcArgs<ValueType Src1, ValueType Src2> {
637 !if (!eq(Src1.Value, untyped.Value), 1, // VOP1
638 !if (!eq(Src2.Value, untyped.Value), 2, // VOP2
642 // Returns the register class to use for the destination of VOP[123C]
643 // instructions for the given VT.
644 class getVALUDstForVT<ValueType VT> {
645 RegisterOperand ret = !if(!eq(VT.Size, 32), VOPDstOperand<VGPR_32>,
646 !if(!eq(VT.Size, 64), VOPDstOperand<VReg_64>,
647 VOPDstOperand<SReg_64>)); // else VT == i1
650 // Returns the register class to use for source 0 of VOP[12C]
651 // instructions for the given VT.
652 class getVOPSrc0ForVT<ValueType VT> {
653 RegisterOperand ret = !if(!eq(VT.Size, 32), VSrc_32, VSrc_64);
656 // Returns the register class to use for source 1 of VOP[12C] for the
658 class getVOPSrc1ForVT<ValueType VT> {
659 RegisterClass ret = !if(!eq(VT.Size, 32), VGPR_32, VReg_64);
662 // Returns the register class to use for sources of VOP3 instructions for the
664 class getVOP3SrcForVT<ValueType VT> {
665 RegisterOperand ret = !if(!eq(VT.Size, 32), VCSrc_32, VCSrc_64);
668 // Returns 1 if the source arguments have modifiers, 0 if they do not.
669 class hasModifiers<ValueType SrcVT> {
670 bit ret = !if(!eq(SrcVT.Value, f32.Value), 1,
671 !if(!eq(SrcVT.Value, f64.Value), 1, 0));
674 // Returns the input arguments for VOP[12C] instructions for the given SrcVT.
675 class getIns32 <RegisterOperand Src0RC, RegisterClass Src1RC, int NumSrcArgs> {
676 dag ret = !if(!eq(NumSrcArgs, 1), (ins Src0RC:$src0), // VOP1
677 !if(!eq(NumSrcArgs, 2), (ins Src0RC:$src0, Src1RC:$src1), // VOP2
681 // Returns the input arguments for VOP3 instructions for the given SrcVT.
682 class getIns64 <RegisterOperand Src0RC, RegisterOperand Src1RC,
683 RegisterOperand Src2RC, int NumSrcArgs,
687 !if (!eq(NumSrcArgs, 1),
688 !if (!eq(HasModifiers, 1),
689 // VOP1 with modifiers
690 (ins InputModsNoDefault:$src0_modifiers, Src0RC:$src0,
691 ClampMod:$clamp, omod:$omod)
693 // VOP1 without modifiers
696 !if (!eq(NumSrcArgs, 2),
697 !if (!eq(HasModifiers, 1),
698 // VOP 2 with modifiers
699 (ins InputModsNoDefault:$src0_modifiers, Src0RC:$src0,
700 InputModsNoDefault:$src1_modifiers, Src1RC:$src1,
701 ClampMod:$clamp, omod:$omod)
703 // VOP2 without modifiers
704 (ins Src0RC:$src0, Src1RC:$src1)
706 /* NumSrcArgs == 3 */,
707 !if (!eq(HasModifiers, 1),
708 // VOP3 with modifiers
709 (ins InputModsNoDefault:$src0_modifiers, Src0RC:$src0,
710 InputModsNoDefault:$src1_modifiers, Src1RC:$src1,
711 InputModsNoDefault:$src2_modifiers, Src2RC:$src2,
712 ClampMod:$clamp, omod:$omod)
714 // VOP3 without modifiers
715 (ins Src0RC:$src0, Src1RC:$src1, Src2RC:$src2)
719 // Returns the assembly string for the inputs and outputs of a VOP[12C]
720 // instruction. This does not add the _e32 suffix, so it can be reused
722 class getAsm32 <int NumSrcArgs> {
723 string src1 = ", $src1";
724 string src2 = ", $src2";
725 string ret = "$dst, $src0"#
726 !if(!eq(NumSrcArgs, 1), "", src1)#
727 !if(!eq(NumSrcArgs, 3), src2, "");
730 // Returns the assembly string for the inputs and outputs of a VOP3
732 class getAsm64 <int NumSrcArgs, bit HasModifiers> {
733 string src0 = !if(!eq(NumSrcArgs, 1), "$src0_modifiers", "$src0_modifiers,");
734 string src1 = !if(!eq(NumSrcArgs, 1), "",
735 !if(!eq(NumSrcArgs, 2), " $src1_modifiers",
736 " $src1_modifiers,"));
737 string src2 = !if(!eq(NumSrcArgs, 3), " $src2_modifiers", "");
739 !if(!eq(HasModifiers, 0),
740 getAsm32<NumSrcArgs>.ret,
741 "$dst, "#src0#src1#src2#"$clamp"#"$omod");
745 class VOPProfile <list<ValueType> _ArgVT> {
747 field list<ValueType> ArgVT = _ArgVT;
749 field ValueType DstVT = ArgVT[0];
750 field ValueType Src0VT = ArgVT[1];
751 field ValueType Src1VT = ArgVT[2];
752 field ValueType Src2VT = ArgVT[3];
753 field RegisterOperand DstRC = getVALUDstForVT<DstVT>.ret;
754 field RegisterOperand Src0RC32 = getVOPSrc0ForVT<Src0VT>.ret;
755 field RegisterClass Src1RC32 = getVOPSrc1ForVT<Src1VT>.ret;
756 field RegisterOperand Src0RC64 = getVOP3SrcForVT<Src0VT>.ret;
757 field RegisterOperand Src1RC64 = getVOP3SrcForVT<Src1VT>.ret;
758 field RegisterOperand Src2RC64 = getVOP3SrcForVT<Src2VT>.ret;
760 field int NumSrcArgs = getNumSrcArgs<Src1VT, Src2VT>.ret;
761 field bit HasModifiers = hasModifiers<Src0VT>.ret;
763 field dag Outs = (outs DstRC:$dst);
765 field dag Ins32 = getIns32<Src0RC32, Src1RC32, NumSrcArgs>.ret;
766 field dag Ins64 = getIns64<Src0RC64, Src1RC64, Src2RC64, NumSrcArgs,
769 field string Asm32 = getAsm32<NumSrcArgs>.ret;
770 field string Asm64 = getAsm64<NumSrcArgs, HasModifiers>.ret;
773 def VOP_F32_F32 : VOPProfile <[f32, f32, untyped, untyped]>;
774 def VOP_F32_F64 : VOPProfile <[f32, f64, untyped, untyped]>;
775 def VOP_F32_I32 : VOPProfile <[f32, i32, untyped, untyped]>;
776 def VOP_F64_F32 : VOPProfile <[f64, f32, untyped, untyped]>;
777 def VOP_F64_F64 : VOPProfile <[f64, f64, untyped, untyped]>;
778 def VOP_F64_I32 : VOPProfile <[f64, i32, untyped, untyped]>;
779 def VOP_I32_F32 : VOPProfile <[i32, f32, untyped, untyped]>;
780 def VOP_I32_F64 : VOPProfile <[i32, f64, untyped, untyped]>;
781 def VOP_I32_I32 : VOPProfile <[i32, i32, untyped, untyped]>;
783 def VOP_F32_F32_F32 : VOPProfile <[f32, f32, f32, untyped]>;
784 def VOP_F32_F32_I32 : VOPProfile <[f32, f32, i32, untyped]>;
785 def VOP_F64_F64_F64 : VOPProfile <[f64, f64, f64, untyped]>;
786 def VOP_F64_F64_I32 : VOPProfile <[f64, f64, i32, untyped]>;
787 def VOP_I32_F32_F32 : VOPProfile <[i32, f32, f32, untyped]>;
788 def VOP_I32_F32_I32 : VOPProfile <[i32, f32, i32, untyped]>;
789 def VOP_I32_I32_I32 : VOPProfile <[i32, i32, i32, untyped]>;
790 def VOP_I32_I32_I32_VCC : VOPProfile <[i32, i32, i32, untyped]> {
791 let Src0RC32 = VCSrc_32;
794 def VOP_I1_F32_I32 : VOPProfile <[i1, f32, i32, untyped]> {
795 let Ins64 = (ins InputModsNoDefault:$src0_modifiers, Src0RC64:$src0, Src1RC64:$src1);
796 let Asm64 = "$dst, $src0_modifiers, $src1";
799 def VOP_I1_F64_I32 : VOPProfile <[i1, f64, i32, untyped]> {
800 let Ins64 = (ins InputModsNoDefault:$src0_modifiers, Src0RC64:$src0, Src1RC64:$src1);
801 let Asm64 = "$dst, $src0_modifiers, $src1";
804 def VOP_I64_I64_I32 : VOPProfile <[i64, i64, i32, untyped]>;
805 def VOP_I64_I32_I64 : VOPProfile <[i64, i32, i64, untyped]>;
806 def VOP_I64_I64_I64 : VOPProfile <[i64, i64, i64, untyped]>;
807 def VOP_CNDMASK : VOPProfile <[i32, i32, i32, untyped]> {
808 let Ins32 = (ins Src0RC32:$src0, Src1RC32:$src1, VCCReg:$src2);
809 let Ins64 = (ins Src0RC64:$src0, Src1RC64:$src1, SSrc_64:$src2);
810 let Asm64 = "$dst, $src0, $src1, $src2";
813 def VOP_F32_F32_F32_F32 : VOPProfile <[f32, f32, f32, f32]>;
814 def VOP_MADK : VOPProfile <[f32, f32, f32, f32]> {
815 field dag Ins = (ins VCSrc_32:$src0, VGPR_32:$vsrc1, u32imm:$src2);
816 field string Asm = "$dst, $src0, $vsrc1, $src2";
818 def VOP_F64_F64_F64_F64 : VOPProfile <[f64, f64, f64, f64]>;
819 def VOP_I32_I32_I32_I32 : VOPProfile <[i32, i32, i32, i32]>;
820 def VOP_I64_I32_I32_I64 : VOPProfile <[i64, i32, i32, i64]>;
823 class VOP <string opName> {
824 string OpName = opName;
827 class VOP2_REV <string revOp, bit isOrig> {
828 string RevOp = revOp;
832 class AtomicNoRet <string noRetOp, bit isRet> {
833 string NoRetOp = noRetOp;
837 class VOP1_Pseudo <dag outs, dag ins, list<dag> pattern, string opName> :
838 VOP1Common <outs, ins, "", pattern>,
840 SIMCInstr <opName#"_e32", SISubtarget.NONE> {
842 let isCodeGenOnly = 1;
848 class VOP1_Real_si <string opName, vop1 op, dag outs, dag ins, string asm> :
849 VOP1<op.SI, outs, ins, asm, []>,
850 SIMCInstr <opName#"_e32", SISubtarget.SI>;
852 class VOP1_Real_vi <string opName, vop1 op, dag outs, dag ins, string asm> :
853 VOP1<op.VI, outs, ins, asm, []>,
854 SIMCInstr <opName#"_e32", SISubtarget.VI>;
856 multiclass VOP1_m <vop1 op, dag outs, dag ins, string asm, list<dag> pattern,
858 def "" : VOP1_Pseudo <outs, ins, pattern, opName>;
860 def _si : VOP1_Real_si <opName, op, outs, ins, asm>;
862 def _vi : VOP1_Real_vi <opName, op, outs, ins, asm>;
865 multiclass VOP1SI_m <vop1 op, dag outs, dag ins, string asm, list<dag> pattern,
867 def "" : VOP1_Pseudo <outs, ins, pattern, opName>;
869 def _si : VOP1_Real_si <opName, op, outs, ins, asm>;
872 class VOP2_Pseudo <dag outs, dag ins, list<dag> pattern, string opName> :
873 VOP2Common <outs, ins, "", pattern>,
875 SIMCInstr<opName#"_e32", SISubtarget.NONE> {
877 let isCodeGenOnly = 1;
880 class VOP2_Real_si <string opName, vop2 op, dag outs, dag ins, string asm> :
881 VOP2 <op.SI, outs, ins, opName#asm, []>,
882 SIMCInstr <opName#"_e32", SISubtarget.SI>;
884 class VOP2_Real_vi <string opName, vop2 op, dag outs, dag ins, string asm> :
885 VOP2 <op.SI, outs, ins, opName#asm, []>,
886 SIMCInstr <opName#"_e32", SISubtarget.VI>;
888 multiclass VOP2SI_m <vop2 op, dag outs, dag ins, string asm, list<dag> pattern,
889 string opName, string revOp> {
890 def "" : VOP2_Pseudo <outs, ins, pattern, opName>,
891 VOP2_REV<revOp#"_e32", !eq(revOp, opName)>;
893 def _si : VOP2_Real_si <opName, op, outs, ins, asm>;
896 multiclass VOP2_m <vop2 op, dag outs, dag ins, string asm, list<dag> pattern,
897 string opName, string revOp> {
898 def "" : VOP2_Pseudo <outs, ins, pattern, opName>,
899 VOP2_REV<revOp#"_e32", !eq(revOp, opName)>;
901 def _si : VOP2_Real_si <opName, op, outs, ins, asm>;
903 def _vi : VOP2_Real_vi <opName, op, outs, ins, asm>;
907 class VOP3DisableFields <bit HasSrc1, bit HasSrc2, bit HasModifiers> {
909 bits<2> src0_modifiers = !if(HasModifiers, ?, 0);
910 bits<2> src1_modifiers = !if(HasModifiers, !if(HasSrc1, ?, 0), 0);
911 bits<2> src2_modifiers = !if(HasModifiers, !if(HasSrc2, ?, 0), 0);
912 bits<2> omod = !if(HasModifiers, ?, 0);
913 bits<1> clamp = !if(HasModifiers, ?, 0);
914 bits<9> src1 = !if(HasSrc1, ?, 0);
915 bits<9> src2 = !if(HasSrc2, ?, 0);
918 class VOP3DisableModFields <bit HasSrc0Mods,
921 bit HasOutputMods = 0> {
922 bits<2> src0_modifiers = !if(HasSrc0Mods, ?, 0);
923 bits<2> src1_modifiers = !if(HasSrc1Mods, ?, 0);
924 bits<2> src2_modifiers = !if(HasSrc2Mods, ?, 0);
925 bits<2> omod = !if(HasOutputMods, ?, 0);
926 bits<1> clamp = !if(HasOutputMods, ?, 0);
929 class VOP3_Pseudo <dag outs, dag ins, list<dag> pattern, string opName> :
930 VOP3Common <outs, ins, "", pattern>,
932 SIMCInstr<opName#"_e64", SISubtarget.NONE> {
934 let isCodeGenOnly = 1;
937 class VOP3_Real_si <bits<9> op, dag outs, dag ins, string asm, string opName> :
938 VOP3Common <outs, ins, asm, []>,
940 SIMCInstr<opName#"_e64", SISubtarget.SI>;
942 class VOP3_Real_vi <bits<10> op, dag outs, dag ins, string asm, string opName> :
943 VOP3Common <outs, ins, asm, []>,
945 SIMCInstr <opName#"_e64", SISubtarget.VI>;
947 class VOP3b_Real_si <bits<9> op, dag outs, dag ins, string asm, string opName> :
948 VOP3Common <outs, ins, asm, []>,
950 SIMCInstr<opName#"_e64", SISubtarget.SI>;
952 class VOP3b_Real_vi <bits<10> op, dag outs, dag ins, string asm, string opName> :
953 VOP3Common <outs, ins, asm, []>,
955 SIMCInstr <opName#"_e64", SISubtarget.VI>;
957 multiclass VOP3_m <vop op, dag outs, dag ins, string asm, list<dag> pattern,
958 string opName, int NumSrcArgs, bit HasMods = 1> {
960 def "" : VOP3_Pseudo <outs, ins, pattern, opName>;
962 def _si : VOP3_Real_si <op.SI3, outs, ins, asm, opName>,
963 VOP3DisableFields<!if(!eq(NumSrcArgs, 1), 0, 1),
964 !if(!eq(NumSrcArgs, 2), 0, 1),
966 def _vi : VOP3_Real_vi <op.VI3, outs, ins, asm, opName>,
967 VOP3DisableFields<!if(!eq(NumSrcArgs, 1), 0, 1),
968 !if(!eq(NumSrcArgs, 2), 0, 1),
972 // VOP3_m without source modifiers
973 multiclass VOP3_m_nomods <vop op, dag outs, dag ins, string asm, list<dag> pattern,
974 string opName, int NumSrcArgs, bit HasMods = 1> {
976 def "" : VOP3_Pseudo <outs, ins, pattern, opName>;
978 let src0_modifiers = 0,
983 def _si : VOP3_Real_si <op.SI3, outs, ins, asm, opName>;
984 def _vi : VOP3_Real_vi <op.VI3, outs, ins, asm, opName>;
988 multiclass VOP3_1_m <vop op, dag outs, dag ins, string asm,
989 list<dag> pattern, string opName, bit HasMods = 1> {
991 def "" : VOP3_Pseudo <outs, ins, pattern, opName>;
993 def _si : VOP3_Real_si <op.SI3, outs, ins, asm, opName>,
994 VOP3DisableFields<0, 0, HasMods>;
996 def _vi : VOP3_Real_vi <op.VI3, outs, ins, asm, opName>,
997 VOP3DisableFields<0, 0, HasMods>;
1000 multiclass VOP3SI_1_m <vop op, dag outs, dag ins, string asm,
1001 list<dag> pattern, string opName, bit HasMods = 1> {
1003 def "" : VOP3_Pseudo <outs, ins, pattern, opName>;
1005 def _si : VOP3_Real_si <op.SI3, outs, ins, asm, opName>,
1006 VOP3DisableFields<0, 0, HasMods>;
1007 // No VI instruction. This class is for SI only.
1010 multiclass VOP3_2_m <vop op, dag outs, dag ins, string asm,
1011 list<dag> pattern, string opName, string revOp,
1012 bit HasMods = 1, bit UseFullOp = 0> {
1014 def "" : VOP3_Pseudo <outs, ins, pattern, opName>,
1015 VOP2_REV<revOp#"_e64", !eq(revOp, opName)>;
1017 def _si : VOP3_Real_si <op.SI3, outs, ins, asm, opName>,
1018 VOP3DisableFields<1, 0, HasMods>;
1020 def _vi : VOP3_Real_vi <op.VI3, outs, ins, asm, opName>,
1021 VOP3DisableFields<1, 0, HasMods>;
1024 multiclass VOP3SI_2_m <vop op, dag outs, dag ins, string asm,
1025 list<dag> pattern, string opName, string revOp,
1026 bit HasMods = 1, bit UseFullOp = 0> {
1028 def "" : VOP3_Pseudo <outs, ins, pattern, opName>,
1029 VOP2_REV<revOp#"_e64", !eq(revOp, opName)>;
1031 def _si : VOP3_Real_si <op.SI3, outs, ins, asm, opName>,
1032 VOP3DisableFields<1, 0, HasMods>;
1034 // No VI instruction. This class is for SI only.
1037 // XXX - Is v_div_scale_{f32|f64} only available in vop3b without
1038 // option of implicit vcc use?
1039 multiclass VOP3b_2_m <vop op, dag outs, dag ins, string asm,
1040 list<dag> pattern, string opName, string revOp,
1041 bit HasMods = 1, bit UseFullOp = 0> {
1042 def "" : VOP3_Pseudo <outs, ins, pattern, opName>,
1043 VOP2_REV<revOp#"_e64", !eq(revOp, opName)>;
1045 // The VOP2 variant puts the carry out into VCC, the VOP3 variant
1046 // can write it into any SGPR. We currently don't use the carry out,
1047 // so for now hardcode it to VCC as well.
1048 let sdst = SIOperand.VCC, Defs = [VCC] in {
1049 def _si : VOP3b_Real_si <op.SI3, outs, ins, asm, opName>,
1050 VOP3DisableFields<1, 0, HasMods>;
1052 def _vi : VOP3b_Real_vi <op.VI3, outs, ins, asm, opName>,
1053 VOP3DisableFields<1, 0, HasMods>;
1054 } // End sdst = SIOperand.VCC, Defs = [VCC]
1057 multiclass VOP3b_3_m <vop op, dag outs, dag ins, string asm,
1058 list<dag> pattern, string opName, string revOp,
1059 bit HasMods = 1, bit UseFullOp = 0> {
1060 def "" : VOP3_Pseudo <outs, ins, pattern, opName>;
1063 def _si : VOP3b_Real_si <op.SI3, outs, ins, asm, opName>,
1064 VOP3DisableFields<1, 1, HasMods>;
1066 def _vi : VOP3b_Real_vi <op.VI3, outs, ins, asm, opName>,
1067 VOP3DisableFields<1, 1, HasMods>;
1070 multiclass VOP3_C_m <vop op, dag outs, dag ins, string asm,
1071 list<dag> pattern, string opName,
1072 bit HasMods, bit defExec, string revOp> {
1074 def "" : VOP3_Pseudo <outs, ins, pattern, opName>,
1075 VOP2_REV<revOp#"_e64", !eq(revOp, opName)>;
1077 def _si : VOP3_Real_si <op.SI3, outs, ins, asm, opName>,
1078 VOP3DisableFields<1, 0, HasMods> {
1079 let Defs = !if(defExec, [EXEC], []);
1082 def _vi : VOP3_Real_vi <op.VI3, outs, ins, asm, opName>,
1083 VOP3DisableFields<1, 0, HasMods> {
1084 let Defs = !if(defExec, [EXEC], []);
1088 // An instruction that is VOP2 on SI and VOP3 on VI, no modifiers.
1089 multiclass VOP2SI_3VI_m <vop3 op, string opName, dag outs, dag ins,
1090 string asm, list<dag> pattern = []> {
1091 let isPseudo = 1, isCodeGenOnly = 1 in {
1092 def "" : VOPAnyCommon <outs, ins, "", pattern>,
1093 SIMCInstr<opName, SISubtarget.NONE>;
1096 def _si : VOP2 <op.SI3{5-0}, outs, ins, asm, []>,
1097 SIMCInstr <opName, SISubtarget.SI>;
1099 def _vi : VOP3Common <outs, ins, asm, []>,
1101 VOP3DisableFields <1, 0, 0>,
1102 SIMCInstr <opName, SISubtarget.VI>;
1105 multiclass VOP1_Helper <vop1 op, string opName, dag outs,
1106 dag ins32, string asm32, list<dag> pat32,
1107 dag ins64, string asm64, list<dag> pat64,
1110 defm _e32 : VOP1_m <op, outs, ins32, opName#asm32, pat32, opName>;
1112 defm _e64 : VOP3_1_m <op, outs, ins64, opName#asm64, pat64, opName, HasMods>;
1115 multiclass VOP1Inst <vop1 op, string opName, VOPProfile P,
1116 SDPatternOperator node = null_frag> : VOP1_Helper <
1118 P.Ins32, P.Asm32, [],
1121 [(set P.DstVT:$dst, (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0,
1122 i32:$src0_modifiers, i1:$clamp, i32:$omod))))],
1123 [(set P.DstVT:$dst, (node P.Src0VT:$src0))]),
1127 multiclass VOP1InstSI <vop1 op, string opName, VOPProfile P,
1128 SDPatternOperator node = null_frag> {
1130 defm _e32 : VOP1SI_m <op, P.Outs, P.Ins32, opName#P.Asm32, [], opName>;
1132 defm _e64 : VOP3SI_1_m <op, P.Outs, P.Ins64, opName#P.Asm64,
1134 [(set P.DstVT:$dst, (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0,
1135 i32:$src0_modifiers, i1:$clamp, i32:$omod))))],
1136 [(set P.DstVT:$dst, (node P.Src0VT:$src0))]),
1137 opName, P.HasModifiers>;
1140 multiclass VOP2_Helper <vop2 op, string opName, dag outs,
1141 dag ins32, string asm32, list<dag> pat32,
1142 dag ins64, string asm64, list<dag> pat64,
1143 string revOp, bit HasMods> {
1144 defm _e32 : VOP2_m <op, outs, ins32, asm32, pat32, opName, revOp>;
1146 defm _e64 : VOP3_2_m <op,
1147 outs, ins64, opName#asm64, pat64, opName, revOp, HasMods
1151 multiclass VOP2Inst <vop2 op, string opName, VOPProfile P,
1152 SDPatternOperator node = null_frag,
1153 string revOp = opName> : VOP2_Helper <
1155 P.Ins32, P.Asm32, [],
1159 (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
1160 i1:$clamp, i32:$omod)),
1161 (P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers))))],
1162 [(set P.DstVT:$dst, (node P.Src0VT:$src0, P.Src1VT:$src1))]),
1163 revOp, P.HasModifiers
1166 multiclass VOP2InstSI <vop2 op, string opName, VOPProfile P,
1167 SDPatternOperator node = null_frag,
1168 string revOp = opName> {
1169 defm _e32 : VOP2SI_m <op, P.Outs, P.Ins32, P.Asm32, [], opName, revOp>;
1171 defm _e64 : VOP3SI_2_m <op, P.Outs, P.Ins64, opName#P.Asm64,
1174 (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
1175 i1:$clamp, i32:$omod)),
1176 (P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers))))],
1177 [(set P.DstVT:$dst, (node P.Src0VT:$src0, P.Src1VT:$src1))]),
1178 opName, revOp, P.HasModifiers>;
1181 multiclass VOP2b_Helper <vop2 op, string opName, dag outs,
1182 dag ins32, string asm32, list<dag> pat32,
1183 dag ins64, string asm64, list<dag> pat64,
1184 string revOp, bit HasMods> {
1186 defm _e32 : VOP2_m <op, outs, ins32, asm32, pat32, opName, revOp>;
1188 defm _e64 : VOP3b_2_m <op,
1189 outs, ins64, opName#asm64, pat64, opName, revOp, HasMods
1193 multiclass VOP2bInst <vop2 op, string opName, VOPProfile P,
1194 SDPatternOperator node = null_frag,
1195 string revOp = opName> : VOP2b_Helper <
1197 P.Ins32, P.Asm32, [],
1201 (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
1202 i1:$clamp, i32:$omod)),
1203 (P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers))))],
1204 [(set P.DstVT:$dst, (node P.Src0VT:$src0, P.Src1VT:$src1))]),
1205 revOp, P.HasModifiers
1208 // A VOP2 instruction that is VOP3-only on VI.
1209 multiclass VOP2_VI3_Helper <vop23 op, string opName, dag outs,
1210 dag ins32, string asm32, list<dag> pat32,
1211 dag ins64, string asm64, list<dag> pat64,
1212 string revOp, bit HasMods> {
1213 defm _e32 : VOP2SI_m <op, outs, ins32, asm32, pat32, opName, revOp>;
1215 defm _e64 : VOP3_2_m <op, outs, ins64, opName#asm64, pat64, opName,
1219 multiclass VOP2_VI3_Inst <vop23 op, string opName, VOPProfile P,
1220 SDPatternOperator node = null_frag,
1221 string revOp = opName>
1224 P.Ins32, P.Asm32, [],
1228 (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
1229 i1:$clamp, i32:$omod)),
1230 (P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers))))],
1231 [(set P.DstVT:$dst, (node P.Src0VT:$src0, P.Src1VT:$src1))]),
1232 revOp, P.HasModifiers
1235 multiclass VOP2MADK <vop2 op, string opName, list<dag> pattern = []> {
1237 def "" : VOP2_Pseudo <VOP_MADK.Outs, VOP_MADK.Ins, pattern, opName>;
1239 let isCodeGenOnly = 0 in {
1240 def _si : VOP2Common <VOP_MADK.Outs, VOP_MADK.Ins,
1241 !strconcat(opName, VOP_MADK.Asm), []>,
1242 SIMCInstr <opName#"_e32", SISubtarget.SI>,
1245 def _vi : VOP2Common <VOP_MADK.Outs, VOP_MADK.Ins,
1246 !strconcat(opName, VOP_MADK.Asm), []>,
1247 SIMCInstr <opName#"_e32", SISubtarget.VI>,
1249 } // End isCodeGenOnly = 0
1252 class VOPC_Pseudo <dag outs, dag ins, list<dag> pattern, string opName> :
1253 VOPCCommon <ins, "", pattern>,
1255 SIMCInstr<opName#"_e32", SISubtarget.NONE> {
1257 let isCodeGenOnly = 1;
1260 multiclass VOPC_m <vopc op, dag outs, dag ins, string asm, list<dag> pattern,
1261 string opName, bit DefExec, string revOpName = ""> {
1262 def "" : VOPC_Pseudo <outs, ins, pattern, opName>;
1264 def _si : VOPC<op.SI, ins, asm, []>,
1265 SIMCInstr <opName#"_e32", SISubtarget.SI> {
1266 let Defs = !if(DefExec, [EXEC], []);
1267 let hasSideEffects = DefExec;
1270 def _vi : VOPC<op.VI, ins, asm, []>,
1271 SIMCInstr <opName#"_e32", SISubtarget.VI> {
1272 let Defs = !if(DefExec, [EXEC], []);
1273 let hasSideEffects = DefExec;
1277 multiclass VOPC_Helper <vopc op, string opName,
1278 dag ins32, string asm32, list<dag> pat32,
1279 dag out64, dag ins64, string asm64, list<dag> pat64,
1280 bit HasMods, bit DefExec, string revOp> {
1281 defm _e32 : VOPC_m <op, (outs), ins32, opName#asm32, pat32, opName, DefExec>;
1283 defm _e64 : VOP3_C_m <op, out64, ins64, opName#asm64, pat64,
1284 opName, HasMods, DefExec, revOp>;
1287 // Special case for class instructions which only have modifiers on
1288 // the 1st source operand.
1289 multiclass VOPC_Class_Helper <vopc op, string opName,
1290 dag ins32, string asm32, list<dag> pat32,
1291 dag out64, dag ins64, string asm64, list<dag> pat64,
1292 bit HasMods, bit DefExec, string revOp> {
1293 defm _e32 : VOPC_m <op, (outs), ins32, opName#asm32, pat32, opName, DefExec>;
1295 defm _e64 : VOP3_C_m <op, out64, ins64, opName#asm64, pat64,
1296 opName, HasMods, DefExec, revOp>,
1297 VOP3DisableModFields<1, 0, 0>;
1300 multiclass VOPCInst <vopc op, string opName,
1301 VOPProfile P, PatLeaf cond = COND_NULL,
1302 string revOp = opName,
1303 bit DefExec = 0> : VOPC_Helper <
1305 P.Ins32, P.Asm32, [],
1306 (outs VOPDstS64:$dst), P.Ins64, P.Asm64,
1309 (setcc (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
1310 i1:$clamp, i32:$omod)),
1311 (P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers)),
1313 [(set i1:$dst, (setcc P.Src0VT:$src0, P.Src1VT:$src1, cond))]),
1314 P.HasModifiers, DefExec, revOp
1317 multiclass VOPCClassInst <vopc op, string opName, VOPProfile P,
1318 bit DefExec = 0> : VOPC_Class_Helper <
1320 P.Ins32, P.Asm32, [],
1321 (outs VOPDstS64:$dst), P.Ins64, P.Asm64,
1324 (AMDGPUfp_class (P.Src0VT (VOP3Mods0Clamp0OMod P.Src0VT:$src0, i32:$src0_modifiers)), P.Src1VT:$src1))],
1325 [(set i1:$dst, (AMDGPUfp_class P.Src0VT:$src0, P.Src1VT:$src1))]),
1326 P.HasModifiers, DefExec, opName
1330 multiclass VOPC_F32 <vopc op, string opName, PatLeaf cond = COND_NULL, string revOp = opName> :
1331 VOPCInst <op, opName, VOP_F32_F32_F32, cond, revOp>;
1333 multiclass VOPC_F64 <vopc op, string opName, PatLeaf cond = COND_NULL, string revOp = opName> :
1334 VOPCInst <op, opName, VOP_F64_F64_F64, cond, revOp>;
1336 multiclass VOPC_I32 <vopc op, string opName, PatLeaf cond = COND_NULL, string revOp = opName> :
1337 VOPCInst <op, opName, VOP_I32_I32_I32, cond, revOp>;
1339 multiclass VOPC_I64 <vopc op, string opName, PatLeaf cond = COND_NULL, string revOp = opName> :
1340 VOPCInst <op, opName, VOP_I64_I64_I64, cond, revOp>;
1343 multiclass VOPCX <vopc op, string opName, VOPProfile P,
1344 PatLeaf cond = COND_NULL,
1346 : VOPCInst <op, opName, P, cond, revOp, 1>;
1348 multiclass VOPCX_F32 <vopc op, string opName, string revOp = opName> :
1349 VOPCX <op, opName, VOP_F32_F32_F32, COND_NULL, revOp>;
1351 multiclass VOPCX_F64 <vopc op, string opName, string revOp = opName> :
1352 VOPCX <op, opName, VOP_F64_F64_F64, COND_NULL, revOp>;
1354 multiclass VOPCX_I32 <vopc op, string opName, string revOp = opName> :
1355 VOPCX <op, opName, VOP_I32_I32_I32, COND_NULL, revOp>;
1357 multiclass VOPCX_I64 <vopc op, string opName, string revOp = opName> :
1358 VOPCX <op, opName, VOP_I64_I64_I64, COND_NULL, revOp>;
1360 multiclass VOP3_Helper <vop3 op, string opName, dag outs, dag ins, string asm,
1361 list<dag> pat, int NumSrcArgs, bit HasMods> : VOP3_m <
1362 op, outs, ins, opName#" "#asm, pat, opName, NumSrcArgs, HasMods
1365 multiclass VOPC_CLASS_F32 <vopc op, string opName> :
1366 VOPCClassInst <op, opName, VOP_I1_F32_I32, 0>;
1368 multiclass VOPCX_CLASS_F32 <vopc op, string opName> :
1369 VOPCClassInst <op, opName, VOP_I1_F32_I32, 1>;
1371 multiclass VOPC_CLASS_F64 <vopc op, string opName> :
1372 VOPCClassInst <op, opName, VOP_I1_F64_I32, 0>;
1374 multiclass VOPCX_CLASS_F64 <vopc op, string opName> :
1375 VOPCClassInst <op, opName, VOP_I1_F64_I32, 1>;
1377 multiclass VOP3Inst <vop3 op, string opName, VOPProfile P,
1378 SDPatternOperator node = null_frag> : VOP3_Helper <
1379 op, opName, (outs P.DstRC.RegClass:$dst), P.Ins64, P.Asm64,
1380 !if(!eq(P.NumSrcArgs, 3),
1383 (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
1384 i1:$clamp, i32:$omod)),
1385 (P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers)),
1386 (P.Src2VT (VOP3Mods P.Src2VT:$src2, i32:$src2_modifiers))))],
1387 [(set P.DstVT:$dst, (node P.Src0VT:$src0, P.Src1VT:$src1,
1389 !if(!eq(P.NumSrcArgs, 2),
1392 (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
1393 i1:$clamp, i32:$omod)),
1394 (P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers))))],
1395 [(set P.DstVT:$dst, (node P.Src0VT:$src0, P.Src1VT:$src1))])
1396 /* P.NumSrcArgs == 1 */,
1399 (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
1400 i1:$clamp, i32:$omod))))],
1401 [(set P.DstVT:$dst, (node P.Src0VT:$src0))]))),
1402 P.NumSrcArgs, P.HasModifiers
1405 // Special case for v_div_fmas_{f32|f64}, since it seems to be the
1406 // only VOP instruction that implicitly reads VCC.
1407 multiclass VOP3_VCC_Inst <vop3 op, string opName,
1409 SDPatternOperator node = null_frag> : VOP3_Helper <
1411 (outs P.DstRC.RegClass:$dst),
1412 (ins InputModsNoDefault:$src0_modifiers, P.Src0RC64:$src0,
1413 InputModsNoDefault:$src1_modifiers, P.Src1RC64:$src1,
1414 InputModsNoDefault:$src2_modifiers, P.Src2RC64:$src2,
1417 " $dst, $src0_modifiers, $src1_modifiers, $src2_modifiers"#"$clamp"#"$omod",
1419 (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
1420 i1:$clamp, i32:$omod)),
1421 (P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers)),
1422 (P.Src2VT (VOP3Mods P.Src2VT:$src2, i32:$src2_modifiers)),
1427 multiclass VOP3b_Helper <vop op, RegisterClass vrc, RegisterOperand arc,
1428 string opName, list<dag> pattern> :
1430 op, (outs vrc:$vdst, SReg_64:$sdst),
1431 (ins InputModsNoDefault:$src0_modifiers, arc:$src0,
1432 InputModsNoDefault:$src1_modifiers, arc:$src1,
1433 InputModsNoDefault:$src2_modifiers, arc:$src2,
1434 ClampMod:$clamp, omod:$omod),
1435 opName#" $vdst, $sdst, $src0_modifiers, $src1_modifiers, $src2_modifiers"#"$clamp"#"$omod", pattern,
1436 opName, opName, 1, 1
1439 multiclass VOP3b_64 <vop3 op, string opName, list<dag> pattern> :
1440 VOP3b_Helper <op, VReg_64, VSrc_64, opName, pattern>;
1442 multiclass VOP3b_32 <vop3 op, string opName, list<dag> pattern> :
1443 VOP3b_Helper <op, VGPR_32, VSrc_32, opName, pattern>;
1446 class Vop3ModPat<Instruction Inst, VOPProfile P, SDPatternOperator node> : Pat<
1447 (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers, i1:$clamp, i32:$omod)),
1448 (P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers)),
1449 (P.Src2VT (VOP3Mods P.Src2VT:$src2, i32:$src2_modifiers))),
1450 (Inst i32:$src0_modifiers, P.Src0VT:$src0,
1451 i32:$src1_modifiers, P.Src1VT:$src1,
1452 i32:$src2_modifiers, P.Src2VT:$src2,
1456 //===----------------------------------------------------------------------===//
1457 // Interpolation opcodes
1458 //===----------------------------------------------------------------------===//
1460 class VINTRP_Pseudo <string opName, dag outs, dag ins, list<dag> pattern> :
1461 VINTRPCommon <outs, ins, "", pattern>,
1462 SIMCInstr<opName, SISubtarget.NONE> {
1464 let isCodeGenOnly = 1;
1467 class VINTRP_Real_si <bits <2> op, string opName, dag outs, dag ins,
1469 VINTRPCommon <outs, ins, asm, []>,
1471 SIMCInstr<opName, SISubtarget.SI>;
1473 class VINTRP_Real_vi <bits <2> op, string opName, dag outs, dag ins,
1475 VINTRPCommon <outs, ins, asm, []>,
1477 SIMCInstr<opName, SISubtarget.VI>;
1479 multiclass VINTRP_m <bits <2> op, string opName, dag outs, dag ins, string asm,
1480 string disableEncoding = "", string constraints = "",
1481 list<dag> pattern = []> {
1482 let DisableEncoding = disableEncoding,
1483 Constraints = constraints in {
1484 def "" : VINTRP_Pseudo <opName, outs, ins, pattern>;
1486 def _si : VINTRP_Real_si <op, opName, outs, ins, asm>;
1488 def _vi : VINTRP_Real_vi <op, opName, outs, ins, asm>;
1492 //===----------------------------------------------------------------------===//
1493 // Vector I/O classes
1494 //===----------------------------------------------------------------------===//
1496 class DS_Pseudo <string opName, dag outs, dag ins, list<dag> pattern> :
1497 DS <outs, ins, "", pattern>,
1498 SIMCInstr <opName, SISubtarget.NONE> {
1500 let isCodeGenOnly = 1;
1503 class DS_Real_si <bits<8> op, string opName, dag outs, dag ins, string asm> :
1504 DS <outs, ins, asm, []>,
1506 SIMCInstr <opName, SISubtarget.SI>;
1508 class DS_Real_vi <bits<8> op, string opName, dag outs, dag ins, string asm> :
1509 DS <outs, ins, asm, []>,
1511 SIMCInstr <opName, SISubtarget.VI>;
1513 class DS_Off16_Real_si <bits<8> op, string opName, dag outs, dag ins, string asm> :
1514 DS_Real_si <op,opName, outs, ins, asm> {
1516 // Single load interpret the 2 i8imm operands as a single i16 offset.
1518 let offset0 = offset{7-0};
1519 let offset1 = offset{15-8};
1522 class DS_Off16_Real_vi <bits<8> op, string opName, dag outs, dag ins, string asm> :
1523 DS_Real_vi <op, opName, outs, ins, asm> {
1525 // Single load interpret the 2 i8imm operands as a single i16 offset.
1527 let offset0 = offset{7-0};
1528 let offset1 = offset{15-8};
1531 multiclass DS_1A_RET <bits<8> op, string opName, RegisterClass rc,
1532 dag outs = (outs rc:$vdst),
1533 dag ins = (ins VGPR_32:$addr, ds_offset:$offset, gds:$gds, M0Reg:$m0),
1534 string asm = opName#" $vdst, $addr"#"$offset$gds"> {
1536 def "" : DS_Pseudo <opName, outs, ins, []>;
1538 let data0 = 0, data1 = 0 in {
1539 def _si : DS_Off16_Real_si <op, opName, outs, ins, asm>;
1540 def _vi : DS_Off16_Real_vi <op, opName, outs, ins, asm>;
1544 multiclass DS_1A_Off8_RET <bits<8> op, string opName, RegisterClass rc,
1545 dag outs = (outs rc:$vdst),
1546 dag ins = (ins VGPR_32:$addr, ds_offset0:$offset0, ds_offset1:$offset1,
1547 gds:$gds, M0Reg:$m0),
1548 string asm = opName#" $vdst, $addr"#"$offset0"#"$offset1$gds"> {
1550 def "" : DS_Pseudo <opName, outs, ins, []>;
1552 let data0 = 0, data1 = 0 in {
1553 def _si : DS_Real_si <op, opName, outs, ins, asm>;
1554 def _vi : DS_Real_vi <op, opName, outs, ins, asm>;
1558 multiclass DS_1A1D_NORET <bits<8> op, string opName, RegisterClass rc,
1560 dag ins = (ins VGPR_32:$addr, rc:$data0, ds_offset:$offset, gds:$gds,
1562 string asm = opName#" $addr, $data0"#"$offset$gds"> {
1564 def "" : DS_Pseudo <opName, outs, ins, []>,
1565 AtomicNoRet<opName, 0>;
1567 let data1 = 0, vdst = 0 in {
1568 def _si : DS_Off16_Real_si <op, opName, outs, ins, asm>;
1569 def _vi : DS_Off16_Real_vi <op, opName, outs, ins, asm>;
1573 multiclass DS_1A1D_Off8_NORET <bits<8> op, string opName, RegisterClass rc,
1575 dag ins = (ins VGPR_32:$addr, rc:$data0, rc:$data1,
1576 ds_offset0:$offset0, ds_offset1:$offset1, gds:$gds, M0Reg:$m0),
1577 string asm = opName#" $addr, $data0, $data1"#"$offset0"#"$offset1"#"$gds"> {
1579 def "" : DS_Pseudo <opName, outs, ins, []>;
1582 def _si : DS_Real_si <op, opName, outs, ins, asm>;
1583 def _vi : DS_Real_vi <op, opName, outs, ins, asm>;
1587 multiclass DS_1A1D_RET <bits<8> op, string opName, RegisterClass rc,
1588 string noRetOp = "",
1589 dag outs = (outs rc:$vdst),
1590 dag ins = (ins VGPR_32:$addr, rc:$data0, ds_offset:$offset, gds:$gds,
1592 string asm = opName#" $vdst, $addr, $data0"#"$offset$gds"> {
1594 def "" : DS_Pseudo <opName, outs, ins, []>,
1595 AtomicNoRet<noRetOp, 1>;
1598 def _si : DS_Off16_Real_si <op, opName, outs, ins, asm>;
1599 def _vi : DS_Off16_Real_vi <op, opName, outs, ins, asm>;
1603 multiclass DS_1A2D_RET_m <bits<8> op, string opName, RegisterClass rc,
1604 string noRetOp = "", dag ins,
1605 dag outs = (outs rc:$vdst),
1606 string asm = opName#" $vdst, $addr, $data0, $data1"#"$offset"#"$gds"> {
1608 def "" : DS_Pseudo <opName, outs, ins, []>,
1609 AtomicNoRet<noRetOp, 1>;
1611 def _si : DS_Off16_Real_si <op, opName, outs, ins, asm>;
1612 def _vi : DS_Off16_Real_vi <op, opName, outs, ins, asm>;
1615 multiclass DS_1A2D_RET <bits<8> op, string asm, RegisterClass rc,
1616 string noRetOp = "", RegisterClass src = rc> :
1617 DS_1A2D_RET_m <op, asm, rc, noRetOp,
1618 (ins VGPR_32:$addr, src:$data0, src:$data1,
1619 ds_offset:$offset, gds:$gds, M0Reg:$m0)
1622 multiclass DS_1A2D_NORET <bits<8> op, string opName, RegisterClass rc,
1623 string noRetOp = opName,
1625 dag ins = (ins VGPR_32:$addr, rc:$data0, rc:$data1,
1626 ds_offset:$offset, gds:$gds, M0Reg:$m0),
1627 string asm = opName#" $addr, $data0, $data1"#"$offset"#"$gds"> {
1629 def "" : DS_Pseudo <opName, outs, ins, []>,
1630 AtomicNoRet<noRetOp, 0>;
1633 def _si : DS_Off16_Real_si <op, opName, outs, ins, asm>;
1634 def _vi : DS_Off16_Real_vi <op, opName, outs, ins, asm>;
1638 multiclass DS_0A_RET <bits<8> op, string opName,
1639 dag outs = (outs VGPR_32:$vdst),
1640 dag ins = (ins ds_offset:$offset, gds:$gds, M0Reg:$m0),
1641 string asm = opName#" $vdst"#"$offset"#"$gds"> {
1643 let mayLoad = 1, mayStore = 1 in {
1644 def "" : DS_Pseudo <opName, outs, ins, []>;
1646 let addr = 0, data0 = 0, data1 = 0 in {
1647 def _si : DS_Off16_Real_si <op, opName, outs, ins, asm>;
1648 def _vi : DS_Off16_Real_vi <op, opName, outs, ins, asm>;
1649 } // end addr = 0, data0 = 0, data1 = 0
1650 } // end mayLoad = 1, mayStore = 1
1653 multiclass DS_1A_RET_GDS <bits<8> op, string opName,
1654 dag outs = (outs VGPR_32:$vdst),
1655 dag ins = (ins VGPR_32:$addr, ds_offset:$offset, M0Reg:$m0),
1656 string asm = opName#" $vdst, $addr"#"$offset gds"> {
1658 def "" : DS_Pseudo <opName, outs, ins, []>;
1660 let data0 = 0, data1 = 0, gds = 1 in {
1661 def _si : DS_Off16_Real_si <op, opName, outs, ins, asm>;
1662 def _vi : DS_Off16_Real_vi <op, opName, outs, ins, asm>;
1663 } // end data0 = 0, data1 = 0, gds = 1
1666 multiclass DS_1A_GDS <bits<8> op, string opName,
1668 dag ins = (ins VGPR_32:$addr, M0Reg:$m0),
1669 string asm = opName#" $addr gds"> {
1671 def "" : DS_Pseudo <opName, outs, ins, []>;
1673 let vdst = 0, data0 = 0, data1 = 0, offset0 = 0, offset1 = 0, gds = 1 in {
1674 def _si : DS_Real_si <op, opName, outs, ins, asm>;
1675 def _vi : DS_Real_vi <op, opName, outs, ins, asm>;
1676 } // end vdst = 0, data = 0, data1 = 0, gds = 1
1679 multiclass DS_1A <bits<8> op, string opName,
1681 dag ins = (ins VGPR_32:$addr, ds_offset:$offset, M0Reg:$m0, gds:$gds),
1682 string asm = opName#" $addr"#"$offset"#"$gds"> {
1684 let mayLoad = 1, mayStore = 1 in {
1685 def "" : DS_Pseudo <opName, outs, ins, []>;
1687 let vdst = 0, data0 = 0, data1 = 0 in {
1688 def _si : DS_Off16_Real_si <op, opName, outs, ins, asm>;
1689 def _vi : DS_Off16_Real_vi <op, opName, outs, ins, asm>;
1690 } // let vdst = 0, data0 = 0, data1 = 0
1691 } // end mayLoad = 1, mayStore = 1
1694 //===----------------------------------------------------------------------===//
1696 //===----------------------------------------------------------------------===//
1698 class MTBUF_Pseudo <string opName, dag outs, dag ins, list<dag> pattern> :
1699 MTBUF <outs, ins, "", pattern>,
1700 SIMCInstr<opName, SISubtarget.NONE> {
1702 let isCodeGenOnly = 1;
1705 class MTBUF_Real_si <bits<3> op, string opName, dag outs, dag ins,
1707 MTBUF <outs, ins, asm, []>,
1709 SIMCInstr<opName, SISubtarget.SI>;
1711 class MTBUF_Real_vi <bits<4> op, string opName, dag outs, dag ins, string asm> :
1712 MTBUF <outs, ins, asm, []>,
1714 SIMCInstr <opName, SISubtarget.VI>;
1716 multiclass MTBUF_m <bits<3> op, string opName, dag outs, dag ins, string asm,
1717 list<dag> pattern> {
1719 def "" : MTBUF_Pseudo <opName, outs, ins, pattern>;
1721 def _si : MTBUF_Real_si <op, opName, outs, ins, asm>;
1723 def _vi : MTBUF_Real_vi <{0, op{2}, op{1}, op{0}}, opName, outs, ins, asm>;
1727 let mayStore = 1, mayLoad = 0 in {
1729 multiclass MTBUF_Store_Helper <bits<3> op, string opName,
1730 RegisterClass regClass> : MTBUF_m <
1732 (ins regClass:$vdata, u16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc,
1733 i1imm:$addr64, i8imm:$dfmt, i8imm:$nfmt, VGPR_32:$vaddr,
1734 SReg_128:$srsrc, i1imm:$slc, i1imm:$tfe, SCSrc_32:$soffset),
1735 opName#" $vdata, $offset, $offen, $idxen, $glc, $addr64, $dfmt,"
1736 #" $nfmt, $vaddr, $srsrc, $slc, $tfe, $soffset", []
1739 } // mayStore = 1, mayLoad = 0
1741 let mayLoad = 1, mayStore = 0 in {
1743 multiclass MTBUF_Load_Helper <bits<3> op, string opName,
1744 RegisterClass regClass> : MTBUF_m <
1745 op, opName, (outs regClass:$dst),
1746 (ins u16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc, i1imm:$addr64,
1747 i8imm:$dfmt, i8imm:$nfmt, VGPR_32:$vaddr, SReg_128:$srsrc,
1748 i1imm:$slc, i1imm:$tfe, SCSrc_32:$soffset),
1749 opName#" $dst, $offset, $offen, $idxen, $glc, $addr64, $dfmt,"
1750 #" $nfmt, $vaddr, $srsrc, $slc, $tfe, $soffset", []
1753 } // mayLoad = 1, mayStore = 0
1755 //===----------------------------------------------------------------------===//
1757 //===----------------------------------------------------------------------===//
1759 class mubuf <bits<7> si, bits<7> vi = si> {
1760 field bits<7> SI = si;
1761 field bits<7> VI = vi;
1764 class MUBUFAddr64Table <bit is_addr64, string suffix = ""> {
1765 bit IsAddr64 = is_addr64;
1766 string OpName = NAME # suffix;
1769 class MUBUF_Pseudo <string opName, dag outs, dag ins, list<dag> pattern> :
1770 MUBUF <outs, ins, "", pattern>,
1771 SIMCInstr<opName, SISubtarget.NONE> {
1773 let isCodeGenOnly = 1;
1775 // dummy fields, so that we can use let statements around multiclasses
1785 class MUBUF_Real_si <mubuf op, string opName, dag outs, dag ins,
1787 MUBUF <outs, ins, asm, []>,
1789 SIMCInstr<opName, SISubtarget.SI> {
1793 class MUBUF_Real_vi <mubuf op, string opName, dag outs, dag ins,
1795 MUBUF <outs, ins, asm, []>,
1797 SIMCInstr<opName, SISubtarget.VI> {
1801 multiclass MUBUF_m <mubuf op, string opName, dag outs, dag ins, string asm,
1802 list<dag> pattern> {
1804 def "" : MUBUF_Pseudo <opName, outs, ins, pattern>,
1805 MUBUFAddr64Table <0>;
1808 def _si : MUBUF_Real_si <op, opName, outs, ins, asm>;
1811 def _vi : MUBUF_Real_vi <op, opName, outs, ins, asm>;
1814 multiclass MUBUFAddr64_m <mubuf op, string opName, dag outs,
1815 dag ins, string asm, list<dag> pattern> {
1817 def "" : MUBUF_Pseudo <opName, outs, ins, pattern>,
1818 MUBUFAddr64Table <1>;
1821 def _si : MUBUF_Real_si <op, opName, outs, ins, asm>;
1824 // There is no VI version. If the pseudo is selected, it should be lowered
1825 // for VI appropriately.
1828 class MUBUF_si <bits<7> op, dag outs, dag ins, string asm, list<dag> pattern> :
1829 MUBUF <outs, ins, asm, pattern>, MUBUFe <op> {
1833 multiclass MUBUFAtomicOffset_m <mubuf op, string opName, dag outs, dag ins,
1834 string asm, list<dag> pattern, bit is_return> {
1836 def "" : MUBUF_Pseudo <opName, outs, ins, pattern>,
1837 MUBUFAddr64Table <0, !if(is_return, "_RTN", "")>,
1838 AtomicNoRet<NAME#"_OFFSET", is_return>;
1840 let offen = 0, idxen = 0, tfe = 0, vaddr = 0 in {
1842 def _si : MUBUF_Real_si <op, opName, outs, ins, asm>;
1845 def _vi : MUBUF_Real_vi <op, opName, outs, ins, asm>;
1849 multiclass MUBUFAtomicAddr64_m <mubuf op, string opName, dag outs, dag ins,
1850 string asm, list<dag> pattern, bit is_return> {
1852 def "" : MUBUF_Pseudo <opName, outs, ins, pattern>,
1853 MUBUFAddr64Table <1, !if(is_return, "_RTN", "")>,
1854 AtomicNoRet<NAME#"_ADDR64", is_return>;
1856 let offen = 0, idxen = 0, addr64 = 1, tfe = 0 in {
1857 def _si : MUBUF_Real_si <op, opName, outs, ins, asm>;
1860 // There is no VI version. If the pseudo is selected, it should be lowered
1861 // for VI appropriately.
1864 multiclass MUBUF_Atomic <mubuf op, string name, RegisterClass rc,
1865 ValueType vt, SDPatternOperator atomic> {
1867 let mayStore = 1, mayLoad = 1, hasPostISelHook = 1 in {
1869 // No return variants
1872 defm _ADDR64 : MUBUFAtomicAddr64_m <
1873 op, name#"_addr64", (outs),
1874 (ins rc:$vdata, SReg_128:$srsrc, VReg_64:$vaddr,
1875 SCSrc_32:$soffset, mbuf_offset:$offset, slc:$slc),
1876 name#" $vdata, $vaddr, $srsrc, $soffset addr64"#"$offset"#"$slc", [], 0
1879 defm _OFFSET : MUBUFAtomicOffset_m <
1880 op, name#"_offset", (outs),
1881 (ins rc:$vdata, SReg_128:$srsrc, SCSrc_32:$soffset, mbuf_offset:$offset,
1883 name#" $vdata, $srsrc, $soffset"#"$offset"#"$slc", [], 0
1887 // Variant that return values
1888 let glc = 1, Constraints = "$vdata = $vdata_in",
1889 DisableEncoding = "$vdata_in" in {
1891 defm _RTN_ADDR64 : MUBUFAtomicAddr64_m <
1892 op, name#"_rtn_addr64", (outs rc:$vdata),
1893 (ins rc:$vdata_in, SReg_128:$srsrc, VReg_64:$vaddr,
1894 SCSrc_32:$soffset, mbuf_offset:$offset, slc:$slc),
1895 name#" $vdata, $vaddr, $srsrc, $soffset addr64"#"$offset"#" glc"#"$slc",
1897 (atomic (MUBUFAddr64Atomic v4i32:$srsrc, i64:$vaddr, i32:$soffset,
1898 i16:$offset, i1:$slc), vt:$vdata_in))], 1
1901 defm _RTN_OFFSET : MUBUFAtomicOffset_m <
1902 op, name#"_rtn_offset", (outs rc:$vdata),
1903 (ins rc:$vdata_in, SReg_128:$srsrc, SCSrc_32:$soffset,
1904 mbuf_offset:$offset, slc:$slc),
1905 name#" $vdata, $srsrc, $soffset"#"$offset"#" glc $slc",
1907 (atomic (MUBUFOffsetAtomic v4i32:$srsrc, i32:$soffset, i16:$offset,
1908 i1:$slc), vt:$vdata_in))], 1
1913 } // mayStore = 1, mayLoad = 1, hasPostISelHook = 1
1916 multiclass MUBUF_Load_Helper <mubuf op, string name, RegisterClass regClass,
1917 ValueType load_vt = i32,
1918 SDPatternOperator ld = null_frag> {
1920 let mayLoad = 1, mayStore = 0 in {
1921 let offen = 0, idxen = 0, vaddr = 0 in {
1922 defm _OFFSET : MUBUF_m <op, name#"_offset", (outs regClass:$vdata),
1923 (ins SReg_128:$srsrc, SCSrc_32:$soffset,
1924 mbuf_offset:$offset, glc:$glc, slc:$slc, tfe:$tfe),
1925 name#" $vdata, $srsrc, $soffset"#"$offset"#"$glc"#"$slc"#"$tfe",
1926 [(set load_vt:$vdata, (ld (MUBUFOffset v4i32:$srsrc,
1927 i32:$soffset, i16:$offset,
1928 i1:$glc, i1:$slc, i1:$tfe)))]>;
1931 let offen = 1, idxen = 0 in {
1932 defm _OFFEN : MUBUF_m <op, name#"_offen", (outs regClass:$vdata),
1933 (ins VGPR_32:$vaddr, SReg_128:$srsrc,
1934 SCSrc_32:$soffset, mbuf_offset:$offset, glc:$glc, slc:$slc,
1936 name#" $vdata, $vaddr, $srsrc, $soffset offen"#"$offset"#"$glc"#"$slc"#"$tfe", []>;
1939 let offen = 0, idxen = 1 in {
1940 defm _IDXEN : MUBUF_m <op, name#"_idxen", (outs regClass:$vdata),
1941 (ins VGPR_32:$vaddr, SReg_128:$srsrc,
1942 SCSrc_32:$soffset, mbuf_offset:$offset, glc:$glc,
1943 slc:$slc, tfe:$tfe),
1944 name#" $vdata, $vaddr, $srsrc, $soffset idxen"#"$offset"#"$glc"#"$slc"#"$tfe", []>;
1947 let offen = 1, idxen = 1 in {
1948 defm _BOTHEN : MUBUF_m <op, name#"_bothen", (outs regClass:$vdata),
1949 (ins VReg_64:$vaddr, SReg_128:$srsrc, SCSrc_32:$soffset,
1950 mbuf_offset:$offset, glc:$glc, slc:$slc, tfe:$tfe),
1951 name#" $vdata, $vaddr, $srsrc, $soffset idxen offen"#"$offset"#"$glc"#"$slc"#"$tfe", []>;
1954 let offen = 0, idxen = 0 in {
1955 defm _ADDR64 : MUBUFAddr64_m <op, name#"_addr64", (outs regClass:$vdata),
1956 (ins VReg_64:$vaddr, SReg_128:$srsrc,
1957 SCSrc_32:$soffset, mbuf_offset:$offset,
1958 glc:$glc, slc:$slc, tfe:$tfe),
1959 name#" $vdata, $vaddr, $srsrc, $soffset addr64"#"$offset"#
1960 "$glc"#"$slc"#"$tfe",
1961 [(set load_vt:$vdata, (ld (MUBUFAddr64 v4i32:$srsrc,
1962 i64:$vaddr, i32:$soffset,
1963 i16:$offset, i1:$glc, i1:$slc,
1969 multiclass MUBUF_Store_Helper <mubuf op, string name, RegisterClass vdataClass,
1970 ValueType store_vt = i32, SDPatternOperator st = null_frag> {
1971 let mayLoad = 0, mayStore = 1 in {
1972 defm : MUBUF_m <op, name, (outs),
1973 (ins vdataClass:$vdata, VGPR_32:$vaddr, SReg_128:$srsrc, SCSrc_32:$soffset,
1974 mbuf_offset:$offset, offen:$offen, idxen:$idxen, glc:$glc, slc:$slc,
1976 name#" $vdata, $vaddr, $srsrc, $soffset"#"$offen"#"$idxen"#"$offset"#
1977 "$glc"#"$slc"#"$tfe", []>;
1979 let offen = 0, idxen = 0, vaddr = 0 in {
1980 defm _OFFSET : MUBUF_m <op, name#"_offset",(outs),
1981 (ins vdataClass:$vdata, SReg_128:$srsrc, SCSrc_32:$soffset,
1982 mbuf_offset:$offset, glc:$glc, slc:$slc, tfe:$tfe),
1983 name#" $vdata, $srsrc, $soffset"#"$offset"#"$glc"#"$slc"#"$tfe",
1984 [(st store_vt:$vdata, (MUBUFOffset v4i32:$srsrc, i32:$soffset,
1985 i16:$offset, i1:$glc, i1:$slc, i1:$tfe))]>;
1986 } // offen = 0, idxen = 0, vaddr = 0
1988 let offen = 1, idxen = 0 in {
1989 defm _OFFEN : MUBUF_m <op, name#"_offen", (outs),
1990 (ins vdataClass:$vdata, VGPR_32:$vaddr, SReg_128:$srsrc,
1991 SCSrc_32:$soffset, mbuf_offset:$offset, glc:$glc,
1992 slc:$slc, tfe:$tfe),
1993 name#" $vdata, $vaddr, $srsrc, $soffset offen"#"$offset"#
1994 "$glc"#"$slc"#"$tfe", []>;
1995 } // end offen = 1, idxen = 0
1997 let offen = 0, idxen = 1 in {
1998 defm _IDXEN : MUBUF_m <op, name#"_idxen", (outs),
1999 (ins vdataClass:$vdata, VGPR_32:$vaddr, SReg_128:$srsrc,
2000 SCSrc_32:$soffset, mbuf_offset:$offset, glc:$glc,
2001 slc:$slc, tfe:$tfe),
2002 name#" $vdata, $vaddr, $srsrc, $soffset idxen"#"$offset"#"$glc"#"$slc"#"$tfe", []>;
2005 let offen = 1, idxen = 1 in {
2006 defm _BOTHEN : MUBUF_m <op, name#"_bothen", (outs),
2007 (ins vdataClass:$vdata, VReg_64:$vaddr, SReg_128:$srsrc, SCSrc_32:$soffset,
2008 mbuf_offset:$offset, glc:$glc, slc:$slc, tfe:$tfe),
2009 name#" $vdata, $vaddr, $srsrc, $soffset idxen offen"#"$offset"#"$glc"#"$slc"#"$tfe", []>;
2012 let offen = 0, idxen = 0 in {
2013 defm _ADDR64 : MUBUFAddr64_m <op, name#"_addr64", (outs),
2014 (ins vdataClass:$vdata, VReg_64:$vaddr, SReg_128:$srsrc,
2016 mbuf_offset:$offset, glc:$glc, slc:$slc,
2018 name#" $vdata, $vaddr, $srsrc, $soffset addr64"#
2019 "$offset"#"$glc"#"$slc"#"$tfe",
2020 [(st store_vt:$vdata,
2021 (MUBUFAddr64 v4i32:$srsrc, i64:$vaddr,
2022 i32:$soffset, i16:$offset,
2023 i1:$glc, i1:$slc, i1:$tfe))]>;
2025 } // End mayLoad = 0, mayStore = 1
2028 class FLAT_Load_Helper <bits<7> op, string asm, RegisterClass regClass> :
2029 FLAT <op, (outs regClass:$vdst),
2030 (ins VReg_64:$addr),
2031 asm#" $vdst, $addr, [M0, FLAT_SCRATCH]", []> {
2039 class FLAT_Store_Helper <bits<7> op, string name, RegisterClass vdataClass> :
2040 FLAT <op, (outs), (ins vdataClass:$data, VReg_64:$addr),
2041 name#" $data, $addr, [M0, FLAT_SCRATCH]",
2054 class MIMG_Mask <string op, int channels> {
2056 int Channels = channels;
2059 class MIMG_NoSampler_Helper <bits<7> op, string asm,
2060 RegisterClass dst_rc,
2061 RegisterClass src_rc> : MIMG <
2063 (outs dst_rc:$vdata),
2064 (ins i32imm:$dmask, i1imm:$unorm, i1imm:$glc, i1imm:$da, i1imm:$r128,
2065 i1imm:$tfe, i1imm:$lwe, i1imm:$slc, src_rc:$vaddr,
2067 asm#" $vdata, $dmask, $unorm, $glc, $da, $r128,"
2068 #" $tfe, $lwe, $slc, $vaddr, $srsrc",
2073 let hasPostISelHook = 1;
2076 multiclass MIMG_NoSampler_Src_Helper <bits<7> op, string asm,
2077 RegisterClass dst_rc,
2079 def _V1 : MIMG_NoSampler_Helper <op, asm, dst_rc, VGPR_32>,
2080 MIMG_Mask<asm#"_V1", channels>;
2081 def _V2 : MIMG_NoSampler_Helper <op, asm, dst_rc, VReg_64>,
2082 MIMG_Mask<asm#"_V2", channels>;
2083 def _V4 : MIMG_NoSampler_Helper <op, asm, dst_rc, VReg_128>,
2084 MIMG_Mask<asm#"_V4", channels>;
2087 multiclass MIMG_NoSampler <bits<7> op, string asm> {
2088 defm _V1 : MIMG_NoSampler_Src_Helper <op, asm, VGPR_32, 1>;
2089 defm _V2 : MIMG_NoSampler_Src_Helper <op, asm, VReg_64, 2>;
2090 defm _V3 : MIMG_NoSampler_Src_Helper <op, asm, VReg_96, 3>;
2091 defm _V4 : MIMG_NoSampler_Src_Helper <op, asm, VReg_128, 4>;
2094 class MIMG_Sampler_Helper <bits<7> op, string asm,
2095 RegisterClass dst_rc,
2096 RegisterClass src_rc, int wqm> : MIMG <
2098 (outs dst_rc:$vdata),
2099 (ins i32imm:$dmask, i1imm:$unorm, i1imm:$glc, i1imm:$da, i1imm:$r128,
2100 i1imm:$tfe, i1imm:$lwe, i1imm:$slc, src_rc:$vaddr,
2101 SReg_256:$srsrc, SReg_128:$ssamp),
2102 asm#" $vdata, $dmask, $unorm, $glc, $da, $r128,"
2103 #" $tfe, $lwe, $slc, $vaddr, $srsrc, $ssamp",
2107 let hasPostISelHook = 1;
2111 multiclass MIMG_Sampler_Src_Helper <bits<7> op, string asm,
2112 RegisterClass dst_rc,
2113 int channels, int wqm> {
2114 def _V1 : MIMG_Sampler_Helper <op, asm, dst_rc, VGPR_32, wqm>,
2115 MIMG_Mask<asm#"_V1", channels>;
2116 def _V2 : MIMG_Sampler_Helper <op, asm, dst_rc, VReg_64, wqm>,
2117 MIMG_Mask<asm#"_V2", channels>;
2118 def _V4 : MIMG_Sampler_Helper <op, asm, dst_rc, VReg_128, wqm>,
2119 MIMG_Mask<asm#"_V4", channels>;
2120 def _V8 : MIMG_Sampler_Helper <op, asm, dst_rc, VReg_256, wqm>,
2121 MIMG_Mask<asm#"_V8", channels>;
2122 def _V16 : MIMG_Sampler_Helper <op, asm, dst_rc, VReg_512, wqm>,
2123 MIMG_Mask<asm#"_V16", channels>;
2126 multiclass MIMG_Sampler <bits<7> op, string asm> {
2127 defm _V1 : MIMG_Sampler_Src_Helper<op, asm, VGPR_32, 1, 0>;
2128 defm _V2 : MIMG_Sampler_Src_Helper<op, asm, VReg_64, 2, 0>;
2129 defm _V3 : MIMG_Sampler_Src_Helper<op, asm, VReg_96, 3, 0>;
2130 defm _V4 : MIMG_Sampler_Src_Helper<op, asm, VReg_128, 4, 0>;
2133 multiclass MIMG_Sampler_WQM <bits<7> op, string asm> {
2134 defm _V1 : MIMG_Sampler_Src_Helper<op, asm, VGPR_32, 1, 1>;
2135 defm _V2 : MIMG_Sampler_Src_Helper<op, asm, VReg_64, 2, 1>;
2136 defm _V3 : MIMG_Sampler_Src_Helper<op, asm, VReg_96, 3, 1>;
2137 defm _V4 : MIMG_Sampler_Src_Helper<op, asm, VReg_128, 4, 1>;
2140 class MIMG_Gather_Helper <bits<7> op, string asm,
2141 RegisterClass dst_rc,
2142 RegisterClass src_rc, int wqm> : MIMG <
2144 (outs dst_rc:$vdata),
2145 (ins i32imm:$dmask, i1imm:$unorm, i1imm:$glc, i1imm:$da, i1imm:$r128,
2146 i1imm:$tfe, i1imm:$lwe, i1imm:$slc, src_rc:$vaddr,
2147 SReg_256:$srsrc, SReg_128:$ssamp),
2148 asm#" $vdata, $dmask, $unorm, $glc, $da, $r128,"
2149 #" $tfe, $lwe, $slc, $vaddr, $srsrc, $ssamp",
2154 // DMASK was repurposed for GATHER4. 4 components are always
2155 // returned and DMASK works like a swizzle - it selects
2156 // the component to fetch. The only useful DMASK values are
2157 // 1=red, 2=green, 4=blue, 8=alpha. (e.g. 1 returns
2158 // (red,red,red,red) etc.) The ISA document doesn't mention
2160 // Therefore, disable all code which updates DMASK by setting these two:
2162 let hasPostISelHook = 0;
2166 multiclass MIMG_Gather_Src_Helper <bits<7> op, string asm,
2167 RegisterClass dst_rc,
2168 int channels, int wqm> {
2169 def _V1 : MIMG_Gather_Helper <op, asm, dst_rc, VGPR_32, wqm>,
2170 MIMG_Mask<asm#"_V1", channels>;
2171 def _V2 : MIMG_Gather_Helper <op, asm, dst_rc, VReg_64, wqm>,
2172 MIMG_Mask<asm#"_V2", channels>;
2173 def _V4 : MIMG_Gather_Helper <op, asm, dst_rc, VReg_128, wqm>,
2174 MIMG_Mask<asm#"_V4", channels>;
2175 def _V8 : MIMG_Gather_Helper <op, asm, dst_rc, VReg_256, wqm>,
2176 MIMG_Mask<asm#"_V8", channels>;
2177 def _V16 : MIMG_Gather_Helper <op, asm, dst_rc, VReg_512, wqm>,
2178 MIMG_Mask<asm#"_V16", channels>;
2181 multiclass MIMG_Gather <bits<7> op, string asm> {
2182 defm _V1 : MIMG_Gather_Src_Helper<op, asm, VGPR_32, 1, 0>;
2183 defm _V2 : MIMG_Gather_Src_Helper<op, asm, VReg_64, 2, 0>;
2184 defm _V3 : MIMG_Gather_Src_Helper<op, asm, VReg_96, 3, 0>;
2185 defm _V4 : MIMG_Gather_Src_Helper<op, asm, VReg_128, 4, 0>;
2188 multiclass MIMG_Gather_WQM <bits<7> op, string asm> {
2189 defm _V1 : MIMG_Gather_Src_Helper<op, asm, VGPR_32, 1, 1>;
2190 defm _V2 : MIMG_Gather_Src_Helper<op, asm, VReg_64, 2, 1>;
2191 defm _V3 : MIMG_Gather_Src_Helper<op, asm, VReg_96, 3, 1>;
2192 defm _V4 : MIMG_Gather_Src_Helper<op, asm, VReg_128, 4, 1>;
2195 //===----------------------------------------------------------------------===//
2196 // Vector instruction mappings
2197 //===----------------------------------------------------------------------===//
2199 // Maps an opcode in e32 form to its e64 equivalent
2200 def getVOPe64 : InstrMapping {
2201 let FilterClass = "VOP";
2202 let RowFields = ["OpName"];
2203 let ColFields = ["Size"];
2205 let ValueCols = [["8"]];
2208 // Maps an opcode in e64 form to its e32 equivalent
2209 def getVOPe32 : InstrMapping {
2210 let FilterClass = "VOP";
2211 let RowFields = ["OpName"];
2212 let ColFields = ["Size"];
2214 let ValueCols = [["4"]];
2217 def getMaskedMIMGOp : InstrMapping {
2218 let FilterClass = "MIMG_Mask";
2219 let RowFields = ["Op"];
2220 let ColFields = ["Channels"];
2222 let ValueCols = [["1"], ["2"], ["3"] ];
2225 // Maps an commuted opcode to its original version
2226 def getCommuteOrig : InstrMapping {
2227 let FilterClass = "VOP2_REV";
2228 let RowFields = ["RevOp"];
2229 let ColFields = ["IsOrig"];
2231 let ValueCols = [["1"]];
2234 // Maps an original opcode to its commuted version
2235 def getCommuteRev : InstrMapping {
2236 let FilterClass = "VOP2_REV";
2237 let RowFields = ["RevOp"];
2238 let ColFields = ["IsOrig"];
2240 let ValueCols = [["0"]];
2243 def getCommuteCmpOrig : InstrMapping {
2244 let FilterClass = "VOP2_REV";
2245 let RowFields = ["RevOp"];
2246 let ColFields = ["IsOrig"];
2248 let ValueCols = [["1"]];
2251 // Maps an original opcode to its commuted version
2252 def getCommuteCmpRev : InstrMapping {
2253 let FilterClass = "VOP2_REV";
2254 let RowFields = ["RevOp"];
2255 let ColFields = ["IsOrig"];
2257 let ValueCols = [["0"]];
2261 def getMCOpcodeGen : InstrMapping {
2262 let FilterClass = "SIMCInstr";
2263 let RowFields = ["PseudoInstr"];
2264 let ColFields = ["Subtarget"];
2265 let KeyCol = [!cast<string>(SISubtarget.NONE)];
2266 let ValueCols = [[!cast<string>(SISubtarget.SI)],[!cast<string>(SISubtarget.VI)]];
2269 def getAddr64Inst : InstrMapping {
2270 let FilterClass = "MUBUFAddr64Table";
2271 let RowFields = ["OpName"];
2272 let ColFields = ["IsAddr64"];
2274 let ValueCols = [["1"]];
2277 // Maps an atomic opcode to its version with a return value.
2278 def getAtomicRetOp : InstrMapping {
2279 let FilterClass = "AtomicNoRet";
2280 let RowFields = ["NoRetOp"];
2281 let ColFields = ["IsRet"];
2283 let ValueCols = [["1"]];
2286 // Maps an atomic opcode to its returnless version.
2287 def getAtomicNoRetOp : InstrMapping {
2288 let FilterClass = "AtomicNoRet";
2289 let RowFields = ["NoRetOp"];
2290 let ColFields = ["IsRet"];
2292 let ValueCols = [["0"]];
2295 include "SIInstructions.td"
2296 include "CIInstructions.td"
2297 include "VIInstructions.td"