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 //===----------------------------------------------------------------------===//
9 def isCI : Predicate<"Subtarget->getGeneration() "
10 ">= AMDGPUSubtarget::SEA_ISLANDS">;
11 def isCIOnly : Predicate<"Subtarget->getGeneration() =="
12 "AMDGPUSubtarget::SEA_ISLANDS">,
13 AssemblerPredicate <"FeatureSeaIslands">;
14 def isVI : Predicate <
15 "Subtarget->getGeneration() >= AMDGPUSubtarget::VOLCANIC_ISLANDS">,
16 AssemblerPredicate<"FeatureGCN3Encoding">;
18 def DisableInst : Predicate <"false">, AssemblerPredicate<"FeatureDisable">;
25 class vopc <bits<8> si, bits<8> vi = !add(0x40, si)> : vop {
26 field bits<8> SI = si;
27 field bits<8> VI = vi;
29 field bits<9> SI3 = {0, si{7-0}};
30 field bits<10> VI3 = {0, 0, vi{7-0}};
33 class vop1 <bits<8> si, bits<8> vi = si> : vop {
34 field bits<8> SI = si;
35 field bits<8> VI = vi;
37 field bits<9> SI3 = {1, 1, si{6-0}};
38 field bits<10> VI3 = !add(0x140, vi);
41 class vop2 <bits<6> si, bits<6> vi = si> : vop {
42 field bits<6> SI = si;
43 field bits<6> VI = vi;
45 field bits<9> SI3 = {1, 0, 0, si{5-0}};
46 field bits<10> VI3 = {0, 1, 0, 0, vi{5-0}};
49 // Specify a VOP2 opcode for SI and VOP3 opcode for VI
50 // that doesn't have VOP2 encoding on VI
51 class vop23 <bits<6> si, bits<10> vi> : vop2 <si> {
55 class vop3 <bits<9> si, bits<10> vi = {0, si}> : vop {
60 class sop1 <bits<8> si, bits<8> vi = si> {
61 field bits<8> SI = si;
62 field bits<8> VI = vi;
65 class sop2 <bits<7> si, bits<7> vi = si> {
66 field bits<7> SI = si;
67 field bits<7> VI = vi;
70 class sopk <bits<5> si, bits<5> vi = si> {
71 field bits<5> SI = si;
72 field bits<5> VI = vi;
75 // Specify an SMRD opcode for SI and SMEM opcode for VI
77 // FIXME: This should really be bits<5> si, Tablegen crashes if
78 // parameter default value is other parameter with different bit size
79 class smrd<bits<8> si, bits<8> vi = si> {
80 field bits<5> SI = si{4-0};
81 field bits<8> VI = vi;
84 // Execpt for the NONE field, this must be kept in sync with the SISubtarget enum
85 // in AMDGPUInstrInfo.cpp
92 //===----------------------------------------------------------------------===//
94 //===----------------------------------------------------------------------===//
96 def SIload_constant : SDNode<"AMDGPUISD::LOAD_CONSTANT",
97 SDTypeProfile<1, 2, [SDTCisVT<0, f32>, SDTCisVT<1, v4i32>, SDTCisVT<2, i32>]>,
98 [SDNPMayLoad, SDNPMemOperand]
101 def SItbuffer_store : SDNode<"AMDGPUISD::TBUFFER_STORE_FORMAT",
103 [SDTCisVT<0, v4i32>, // rsrc(SGPR)
104 SDTCisVT<1, iAny>, // vdata(VGPR)
105 SDTCisVT<2, i32>, // num_channels(imm)
106 SDTCisVT<3, i32>, // vaddr(VGPR)
107 SDTCisVT<4, i32>, // soffset(SGPR)
108 SDTCisVT<5, i32>, // inst_offset(imm)
109 SDTCisVT<6, i32>, // dfmt(imm)
110 SDTCisVT<7, i32>, // nfmt(imm)
111 SDTCisVT<8, i32>, // offen(imm)
112 SDTCisVT<9, i32>, // idxen(imm)
113 SDTCisVT<10, i32>, // glc(imm)
114 SDTCisVT<11, i32>, // slc(imm)
115 SDTCisVT<12, i32> // tfe(imm)
117 [SDNPMayStore, SDNPMemOperand, SDNPHasChain]
120 def SIload_input : SDNode<"AMDGPUISD::LOAD_INPUT",
121 SDTypeProfile<1, 3, [SDTCisVT<0, v4f32>, SDTCisVT<1, v4i32>, SDTCisVT<2, i16>,
125 class SDSample<string opcode> : SDNode <opcode,
126 SDTypeProfile<1, 4, [SDTCisVT<0, v4f32>, SDTCisVT<2, v32i8>,
127 SDTCisVT<3, v4i32>, SDTCisVT<4, i32>]>
130 def SIsample : SDSample<"AMDGPUISD::SAMPLE">;
131 def SIsampleb : SDSample<"AMDGPUISD::SAMPLEB">;
132 def SIsampled : SDSample<"AMDGPUISD::SAMPLED">;
133 def SIsamplel : SDSample<"AMDGPUISD::SAMPLEL">;
135 def SIconstdata_ptr : SDNode<
136 "AMDGPUISD::CONST_DATA_PTR", SDTypeProfile <1, 1, [SDTCisVT<0, i64>,
140 //===----------------------------------------------------------------------===//
141 // SDNodes and PatFrag for local loads and stores to enable s_mov_b32 m0, -1
142 // to be glued to the memory instructions.
143 //===----------------------------------------------------------------------===//
145 def SIld_local : SDNode <"ISD::LOAD", SDTLoad,
146 [SDNPHasChain, SDNPMayLoad, SDNPMemOperand, SDNPInGlue]
149 def si_ld_local : PatFrag <(ops node:$ptr), (SIld_local node:$ptr), [{
150 return isLocalLoad(cast<LoadSDNode>(N));
153 def si_load_local : PatFrag <(ops node:$ptr), (si_ld_local node:$ptr), [{
154 return cast<LoadSDNode>(N)->getAddressingMode() == ISD::UNINDEXED &&
155 cast<LoadSDNode>(N)->getExtensionType() == ISD::NON_EXTLOAD;
158 def si_load_local_align8 : Aligned8Bytes <
159 (ops node:$ptr), (si_load_local node:$ptr)
162 def si_sextload_local : PatFrag <(ops node:$ptr), (si_ld_local node:$ptr), [{
163 return cast<LoadSDNode>(N)->getExtensionType() == ISD::SEXTLOAD;
165 def si_az_extload_local : AZExtLoadBase <si_ld_local>;
167 multiclass SIExtLoadLocal <PatFrag ld_node> {
169 def _i8 : PatFrag <(ops node:$ptr), (ld_node node:$ptr),
170 [{return cast<LoadSDNode>(N)->getMemoryVT() == MVT::i8;}]
173 def _i16 : PatFrag <(ops node:$ptr), (ld_node node:$ptr),
174 [{return cast<LoadSDNode>(N)->getMemoryVT() == MVT::i16;}]
178 defm si_sextload_local : SIExtLoadLocal <si_sextload_local>;
179 defm si_az_extload_local : SIExtLoadLocal <si_az_extload_local>;
181 def SIst_local : SDNode <"ISD::STORE", SDTStore,
182 [SDNPHasChain, SDNPMayStore, SDNPMemOperand, SDNPInGlue]
185 def si_st_local : PatFrag <
186 (ops node:$val, node:$ptr), (SIst_local node:$val, node:$ptr), [{
187 return isLocalStore(cast<StoreSDNode>(N));
190 def si_store_local : PatFrag <
191 (ops node:$val, node:$ptr), (si_st_local node:$val, node:$ptr), [{
192 return cast<StoreSDNode>(N)->getAddressingMode() == ISD::UNINDEXED &&
193 !cast<StoreSDNode>(N)->isTruncatingStore();
196 def si_store_local_align8 : Aligned8Bytes <
197 (ops node:$val, node:$ptr), (si_store_local node:$val, node:$ptr)
200 def si_truncstore_local : PatFrag <
201 (ops node:$val, node:$ptr), (si_st_local node:$val, node:$ptr), [{
202 return cast<StoreSDNode>(N)->isTruncatingStore();
205 def si_truncstore_local_i8 : PatFrag <
206 (ops node:$val, node:$ptr), (si_truncstore_local node:$val, node:$ptr), [{
207 return cast<StoreSDNode>(N)->getMemoryVT() == MVT::i8;
210 def si_truncstore_local_i16 : PatFrag <
211 (ops node:$val, node:$ptr), (si_truncstore_local node:$val, node:$ptr), [{
212 return cast<StoreSDNode>(N)->getMemoryVT() == MVT::i16;
215 multiclass SIAtomicM0Glue2 <string op_name> {
217 def _glue : SDNode <"ISD::ATOMIC_"#op_name, SDTAtomic2,
218 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand, SDNPInGlue]
221 def _local : local_binary_atomic_op <!cast<SDNode>(NAME#"_glue")>;
224 defm si_atomic_load_add : SIAtomicM0Glue2 <"LOAD_ADD">;
225 defm si_atomic_load_and : SIAtomicM0Glue2 <"LOAD_AND">;
226 defm si_atomic_load_min : SIAtomicM0Glue2 <"LOAD_MIN">;
227 defm si_atomic_load_max : SIAtomicM0Glue2 <"LOAD_MAX">;
228 defm si_atomic_load_or : SIAtomicM0Glue2 <"LOAD_OR">;
229 defm si_atomic_load_sub : SIAtomicM0Glue2 <"LOAD_SUB">;
230 defm si_atomic_load_xor : SIAtomicM0Glue2 <"LOAD_XOR">;
231 defm si_atomic_load_umin : SIAtomicM0Glue2 <"LOAD_UMIN">;
232 defm si_atomic_load_umax : SIAtomicM0Glue2 <"LOAD_UMAX">;
233 defm si_atomic_swap : SIAtomicM0Glue2 <"SWAP">;
235 def si_atomic_cmp_swap_glue : SDNode <"ISD::ATOMIC_CMP_SWAP", SDTAtomic3,
236 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand, SDNPInGlue]
239 defm si_atomic_cmp_swap : AtomicCmpSwapLocal <si_atomic_cmp_swap_glue>;
241 // Transformation function, extract the lower 32bit of a 64bit immediate
242 def LO32 : SDNodeXForm<imm, [{
243 return CurDAG->getTargetConstant(N->getZExtValue() & 0xffffffff, SDLoc(N),
247 def LO32f : SDNodeXForm<fpimm, [{
248 APInt V = N->getValueAPF().bitcastToAPInt().trunc(32);
249 return CurDAG->getTargetConstantFP(APFloat(APFloat::IEEEsingle, V), MVT::f32);
252 // Transformation function, extract the upper 32bit of a 64bit immediate
253 def HI32 : SDNodeXForm<imm, [{
254 return CurDAG->getTargetConstant(N->getZExtValue() >> 32, SDLoc(N), MVT::i32);
257 def HI32f : SDNodeXForm<fpimm, [{
258 APInt V = N->getValueAPF().bitcastToAPInt().lshr(32).trunc(32);
259 return CurDAG->getTargetConstantFP(APFloat(APFloat::IEEEsingle, V), SDLoc(N),
263 def IMM8bitDWORD : PatLeaf <(imm),
264 [{return (N->getZExtValue() & ~0x3FC) == 0;}]
267 def as_dword_i32imm : SDNodeXForm<imm, [{
268 return CurDAG->getTargetConstant(N->getZExtValue() >> 2, SDLoc(N), MVT::i32);
271 def as_i1imm : SDNodeXForm<imm, [{
272 return CurDAG->getTargetConstant(N->getZExtValue(), SDLoc(N), MVT::i1);
275 def as_i8imm : SDNodeXForm<imm, [{
276 return CurDAG->getTargetConstant(N->getZExtValue(), SDLoc(N), MVT::i8);
279 def as_i16imm : SDNodeXForm<imm, [{
280 return CurDAG->getTargetConstant(N->getSExtValue(), SDLoc(N), MVT::i16);
283 def as_i32imm: SDNodeXForm<imm, [{
284 return CurDAG->getTargetConstant(N->getSExtValue(), SDLoc(N), MVT::i32);
287 def as_i64imm: SDNodeXForm<imm, [{
288 return CurDAG->getTargetConstant(N->getSExtValue(), SDLoc(N), MVT::i64);
291 // Copied from the AArch64 backend:
292 def bitcast_fpimm_to_i32 : SDNodeXForm<fpimm, [{
293 return CurDAG->getTargetConstant(
294 N->getValueAPF().bitcastToAPInt().getZExtValue(), SDLoc(N), MVT::i32);
297 // Copied from the AArch64 backend:
298 def bitcast_fpimm_to_i64 : SDNodeXForm<fpimm, [{
299 return CurDAG->getTargetConstant(
300 N->getValueAPF().bitcastToAPInt().getZExtValue(), SDLoc(N), MVT::i64);
303 def IMM8bit : PatLeaf <(imm),
304 [{return isUInt<8>(N->getZExtValue());}]
307 def IMM12bit : PatLeaf <(imm),
308 [{return isUInt<12>(N->getZExtValue());}]
311 def IMM16bit : PatLeaf <(imm),
312 [{return isUInt<16>(N->getZExtValue());}]
315 def IMM20bit : PatLeaf <(imm),
316 [{return isUInt<20>(N->getZExtValue());}]
319 def IMM32bit : PatLeaf <(imm),
320 [{return isUInt<32>(N->getZExtValue());}]
323 def mubuf_vaddr_offset : PatFrag<
324 (ops node:$ptr, node:$offset, node:$imm_offset),
325 (add (add node:$ptr, node:$offset), node:$imm_offset)
328 class InlineImm <ValueType vt> : PatLeaf <(vt imm), [{
329 return isInlineImmediate(N);
332 class InlineFPImm <ValueType vt> : PatLeaf <(vt fpimm), [{
333 return isInlineImmediate(N);
336 class SGPRImm <dag frag> : PatLeaf<frag, [{
337 if (Subtarget->getGeneration() < AMDGPUSubtarget::SOUTHERN_ISLANDS) {
340 const SIRegisterInfo *SIRI =
341 static_cast<const SIRegisterInfo *>(Subtarget->getRegisterInfo());
342 for (SDNode::use_iterator U = N->use_begin(), E = SDNode::use_end();
344 const TargetRegisterClass *RC = getOperandRegClass(*U, U.getOperandNo());
345 if (RC && SIRI->isSGPRClass(RC))
351 //===----------------------------------------------------------------------===//
353 //===----------------------------------------------------------------------===//
355 def FRAMEri32 : Operand<iPTR> {
356 let MIOperandInfo = (ops i32:$ptr, i32imm:$index);
359 def SoppBrTarget : AsmOperandClass {
360 let Name = "SoppBrTarget";
361 let ParserMethod = "parseSOppBrTarget";
364 def sopp_brtarget : Operand<OtherVT> {
365 let EncoderMethod = "getSOPPBrEncoding";
366 let OperandType = "OPERAND_PCREL";
367 let ParserMatchClass = SoppBrTarget;
370 def const_ga : Operand<iPTR>;
372 include "SIInstrFormats.td"
373 include "VIInstrFormats.td"
375 def MubufOffsetMatchClass : AsmOperandClass {
376 let Name = "MubufOffset";
377 let ParserMethod = "parseMubufOptionalOps";
378 let RenderMethod = "addImmOperands";
381 class DSOffsetBaseMatchClass <string parser> : AsmOperandClass {
382 let Name = "DSOffset"#parser;
383 let ParserMethod = parser;
384 let RenderMethod = "addImmOperands";
385 let PredicateMethod = "isDSOffset";
388 def DSOffsetMatchClass : DSOffsetBaseMatchClass <"parseDSOptionalOps">;
389 def DSOffsetGDSMatchClass : DSOffsetBaseMatchClass <"parseDSOffsetOptional">;
391 def DSOffset01MatchClass : AsmOperandClass {
392 let Name = "DSOffset1";
393 let ParserMethod = "parseDSOff01OptionalOps";
394 let RenderMethod = "addImmOperands";
395 let PredicateMethod = "isDSOffset01";
398 class GDSBaseMatchClass <string parser> : AsmOperandClass {
399 let Name = "GDS"#parser;
400 let PredicateMethod = "isImm";
401 let ParserMethod = parser;
402 let RenderMethod = "addImmOperands";
405 def GDSMatchClass : GDSBaseMatchClass <"parseDSOptionalOps">;
406 def GDS01MatchClass : GDSBaseMatchClass <"parseDSOff01OptionalOps">;
408 class GLCBaseMatchClass <string parser> : AsmOperandClass {
409 let Name = "GLC"#parser;
410 let PredicateMethod = "isImm";
411 let ParserMethod = parser;
412 let RenderMethod = "addImmOperands";
415 def GLCMubufMatchClass : GLCBaseMatchClass <"parseMubufOptionalOps">;
416 def GLCFlatMatchClass : GLCBaseMatchClass <"parseFlatOptionalOps">;
418 class SLCBaseMatchClass <string parser> : AsmOperandClass {
419 let Name = "SLC"#parser;
420 let PredicateMethod = "isImm";
421 let ParserMethod = parser;
422 let RenderMethod = "addImmOperands";
425 def SLCMubufMatchClass : SLCBaseMatchClass <"parseMubufOptionalOps">;
426 def SLCFlatMatchClass : SLCBaseMatchClass <"parseFlatOptionalOps">;
427 def SLCFlatAtomicMatchClass : SLCBaseMatchClass <"parseFlatAtomicOptionalOps">;
429 class TFEBaseMatchClass <string parser> : AsmOperandClass {
430 let Name = "TFE"#parser;
431 let PredicateMethod = "isImm";
432 let ParserMethod = parser;
433 let RenderMethod = "addImmOperands";
436 def TFEMubufMatchClass : TFEBaseMatchClass <"parseMubufOptionalOps">;
437 def TFEFlatMatchClass : TFEBaseMatchClass <"parseFlatOptionalOps">;
438 def TFEFlatAtomicMatchClass : TFEBaseMatchClass <"parseFlatAtomicOptionalOps">;
440 def OModMatchClass : AsmOperandClass {
442 let PredicateMethod = "isImm";
443 let ParserMethod = "parseVOP3OptionalOps";
444 let RenderMethod = "addImmOperands";
447 def ClampMatchClass : AsmOperandClass {
449 let PredicateMethod = "isImm";
450 let ParserMethod = "parseVOP3OptionalOps";
451 let RenderMethod = "addImmOperands";
454 class SMRDOffsetBaseMatchClass <string predicate> : AsmOperandClass {
455 let Name = "SMRDOffset"#predicate;
456 let PredicateMethod = predicate;
457 let RenderMethod = "addImmOperands";
460 def SMRDOffsetMatchClass : SMRDOffsetBaseMatchClass <"isSMRDOffset">;
461 def SMRDLiteralOffsetMatchClass : SMRDOffsetBaseMatchClass <
462 "isSMRDLiteralOffset"
465 let OperandType = "OPERAND_IMMEDIATE" in {
467 def offen : Operand<i1> {
468 let PrintMethod = "printOffen";
470 def idxen : Operand<i1> {
471 let PrintMethod = "printIdxen";
473 def addr64 : Operand<i1> {
474 let PrintMethod = "printAddr64";
476 def mbuf_offset : Operand<i16> {
477 let PrintMethod = "printMBUFOffset";
478 let ParserMatchClass = MubufOffsetMatchClass;
480 class ds_offset_base <AsmOperandClass mc> : Operand<i16> {
481 let PrintMethod = "printDSOffset";
482 let ParserMatchClass = mc;
484 def ds_offset : ds_offset_base <DSOffsetMatchClass>;
485 def ds_offset_gds : ds_offset_base <DSOffsetGDSMatchClass>;
487 def ds_offset0 : Operand<i8> {
488 let PrintMethod = "printDSOffset0";
489 let ParserMatchClass = DSOffset01MatchClass;
491 def ds_offset1 : Operand<i8> {
492 let PrintMethod = "printDSOffset1";
493 let ParserMatchClass = DSOffset01MatchClass;
495 class gds_base <AsmOperandClass mc> : Operand <i1> {
496 let PrintMethod = "printGDS";
497 let ParserMatchClass = mc;
499 def gds : gds_base <GDSMatchClass>;
501 def gds01 : gds_base <GDS01MatchClass>;
503 class glc_base <AsmOperandClass mc> : Operand <i1> {
504 let PrintMethod = "printGLC";
505 let ParserMatchClass = mc;
508 def glc : glc_base <GLCMubufMatchClass>;
509 def glc_flat : glc_base <GLCFlatMatchClass>;
511 class slc_base <AsmOperandClass mc> : Operand <i1> {
512 let PrintMethod = "printSLC";
513 let ParserMatchClass = mc;
516 def slc : slc_base <SLCMubufMatchClass>;
517 def slc_flat : slc_base <SLCFlatMatchClass>;
518 def slc_flat_atomic : slc_base <SLCFlatAtomicMatchClass>;
520 class tfe_base <AsmOperandClass mc> : Operand <i1> {
521 let PrintMethod = "printTFE";
522 let ParserMatchClass = mc;
525 def tfe : tfe_base <TFEMubufMatchClass>;
526 def tfe_flat : tfe_base <TFEFlatMatchClass>;
527 def tfe_flat_atomic : tfe_base <TFEFlatAtomicMatchClass>;
529 def omod : Operand <i32> {
530 let PrintMethod = "printOModSI";
531 let ParserMatchClass = OModMatchClass;
534 def ClampMod : Operand <i1> {
535 let PrintMethod = "printClampSI";
536 let ParserMatchClass = ClampMatchClass;
539 def smrd_offset : Operand <i32> {
540 let PrintMethod = "printU32ImmOperand";
541 let ParserMatchClass = SMRDOffsetMatchClass;
544 def smrd_literal_offset : Operand <i32> {
545 let PrintMethod = "printU32ImmOperand";
546 let ParserMatchClass = SMRDLiteralOffsetMatchClass;
549 } // End OperandType = "OPERAND_IMMEDIATE"
551 def VOPDstS64 : VOPDstOperand <SReg_64>;
553 //===----------------------------------------------------------------------===//
555 //===----------------------------------------------------------------------===//
557 def DS1Addr1Offset : ComplexPattern<i32, 2, "SelectDS1Addr1Offset">;
558 def DS64Bit4ByteAligned : ComplexPattern<i32, 3, "SelectDS64Bit4ByteAligned">;
560 def MUBUFAddr32 : ComplexPattern<i64, 9, "SelectMUBUFAddr32">;
561 def MUBUFAddr64 : ComplexPattern<i64, 7, "SelectMUBUFAddr64">;
562 def MUBUFAddr64Atomic : ComplexPattern<i64, 5, "SelectMUBUFAddr64">;
563 def MUBUFScratch : ComplexPattern<i64, 4, "SelectMUBUFScratch">;
564 def MUBUFOffset : ComplexPattern<i64, 6, "SelectMUBUFOffset">;
565 def MUBUFOffsetAtomic : ComplexPattern<i64, 4, "SelectMUBUFOffset">;
567 def SMRDImm : ComplexPattern<i64, 2, "SelectSMRDImm">;
568 def SMRDImm32 : ComplexPattern<i64, 2, "SelectSMRDImm32">;
569 def SMRDSgpr : ComplexPattern<i64, 2, "SelectSMRDSgpr">;
570 def SMRDBufferImm : ComplexPattern<i32, 1, "SelectSMRDBufferImm">;
571 def SMRDBufferImm32 : ComplexPattern<i32, 1, "SelectSMRDBufferImm32">;
572 def SMRDBufferSgpr : ComplexPattern<i32, 1, "SelectSMRDBufferSgpr">;
574 def VOP3Mods0 : ComplexPattern<untyped, 4, "SelectVOP3Mods0">;
575 def VOP3NoMods0 : ComplexPattern<untyped, 4, "SelectVOP3NoMods0">;
576 def VOP3Mods0Clamp : ComplexPattern<untyped, 3, "SelectVOP3Mods0Clamp">;
577 def VOP3Mods0Clamp0OMod : ComplexPattern<untyped, 4, "SelectVOP3Mods0Clamp0OMod">;
578 def VOP3Mods : ComplexPattern<untyped, 2, "SelectVOP3Mods">;
579 def VOP3NoMods : ComplexPattern<untyped, 2, "SelectVOP3NoMods">;
581 //===----------------------------------------------------------------------===//
582 // SI assembler operands
583 //===----------------------------------------------------------------------===//
604 //===----------------------------------------------------------------------===//
606 // SI Instruction multiclass helpers.
608 // Instructions with _32 take 32-bit operands.
609 // Instructions with _64 take 64-bit operands.
611 // VOP_* instructions can use either a 32-bit or 64-bit encoding. The 32-bit
612 // encoding is the standard encoding, but instruction that make use of
613 // any of the instruction modifiers must use the 64-bit encoding.
615 // Instructions with _e32 use the 32-bit encoding.
616 // Instructions with _e64 use the 64-bit encoding.
618 //===----------------------------------------------------------------------===//
620 class SIMCInstr <string pseudo, int subtarget> {
621 string PseudoInstr = pseudo;
622 int Subtarget = subtarget;
625 //===----------------------------------------------------------------------===//
627 //===----------------------------------------------------------------------===//
629 class EXPCommon : InstSI<
631 (ins i32imm:$en, i32imm:$tgt, i32imm:$compr, i32imm:$done, i32imm:$vm,
632 VGPR_32:$src0, VGPR_32:$src1, VGPR_32:$src2, VGPR_32:$src3),
633 "exp $en, $tgt, $compr, $done, $vm, $src0, $src1, $src2, $src3",
642 let isPseudo = 1, isCodeGenOnly = 1 in {
643 def "" : EXPCommon, SIMCInstr <"exp", SISubtarget.NONE> ;
646 def _si : EXPCommon, SIMCInstr <"exp", SISubtarget.SI>, EXPe;
648 def _vi : EXPCommon, SIMCInstr <"exp", SISubtarget.VI>, EXPe_vi;
651 //===----------------------------------------------------------------------===//
653 //===----------------------------------------------------------------------===//
655 class SOP1_Pseudo <string opName, dag outs, dag ins, list<dag> pattern> :
656 SOP1 <outs, ins, "", pattern>,
657 SIMCInstr<opName, SISubtarget.NONE> {
659 let isCodeGenOnly = 1;
662 class SOP1_Real_si <sop1 op, string opName, dag outs, dag ins, string asm> :
663 SOP1 <outs, ins, asm, []>,
665 SIMCInstr<opName, SISubtarget.SI> {
666 let isCodeGenOnly = 0;
667 let AssemblerPredicates = [isSICI];
670 class SOP1_Real_vi <sop1 op, string opName, dag outs, dag ins, string asm> :
671 SOP1 <outs, ins, asm, []>,
673 SIMCInstr<opName, SISubtarget.VI> {
674 let isCodeGenOnly = 0;
675 let AssemblerPredicates = [isVI];
678 multiclass SOP1_m <sop1 op, string opName, dag outs, dag ins, string asm,
681 def "" : SOP1_Pseudo <opName, outs, ins, pattern>;
683 def _si : SOP1_Real_si <op, opName, outs, ins, asm>;
685 def _vi : SOP1_Real_vi <op, opName, outs, ins, asm>;
689 multiclass SOP1_32 <sop1 op, string opName, list<dag> pattern> : SOP1_m <
690 op, opName, (outs SReg_32:$dst), (ins SSrc_32:$src0),
691 opName#" $dst, $src0", pattern
694 multiclass SOP1_64 <sop1 op, string opName, list<dag> pattern> : SOP1_m <
695 op, opName, (outs SReg_64:$dst), (ins SSrc_64:$src0),
696 opName#" $dst, $src0", pattern
699 // no input, 64-bit output.
700 multiclass SOP1_64_0 <sop1 op, string opName, list<dag> pattern> {
701 def "" : SOP1_Pseudo <opName, (outs SReg_64:$dst), (ins), pattern>;
703 def _si : SOP1_Real_si <op, opName, (outs SReg_64:$dst), (ins),
708 def _vi : SOP1_Real_vi <op, opName, (outs SReg_64:$dst), (ins),
714 // 64-bit input, no output
715 multiclass SOP1_1 <sop1 op, string opName, list<dag> pattern> {
716 def "" : SOP1_Pseudo <opName, (outs), (ins SReg_64:$src0), pattern>;
718 def _si : SOP1_Real_si <op, opName, (outs), (ins SReg_64:$src0),
723 def _vi : SOP1_Real_vi <op, opName, (outs), (ins SReg_64:$src0),
729 // 64-bit input, 32-bit output.
730 multiclass SOP1_32_64 <sop1 op, string opName, list<dag> pattern> : SOP1_m <
731 op, opName, (outs SReg_32:$dst), (ins SSrc_64:$src0),
732 opName#" $dst, $src0", pattern
735 class SOP2_Pseudo<string opName, dag outs, dag ins, list<dag> pattern> :
736 SOP2<outs, ins, "", pattern>,
737 SIMCInstr<opName, SISubtarget.NONE> {
739 let isCodeGenOnly = 1;
742 // Pseudo instructions have no encodings, but adding this field here allows
744 // let sdst = xxx in {
745 // for multiclasses that include both real and pseudo instructions.
746 field bits<7> sdst = 0;
749 class SOP2_Real_si<sop2 op, string opName, dag outs, dag ins, string asm> :
750 SOP2<outs, ins, asm, []>,
752 SIMCInstr<opName, SISubtarget.SI> {
753 let AssemblerPredicates = [isSICI];
756 class SOP2_Real_vi<sop2 op, string opName, dag outs, dag ins, string asm> :
757 SOP2<outs, ins, asm, []>,
759 SIMCInstr<opName, SISubtarget.VI> {
760 let AssemblerPredicates = [isVI];
763 multiclass SOP2_m <sop2 op, string opName, dag outs, dag ins, string asm,
766 def "" : SOP2_Pseudo <opName, outs, ins, pattern>;
768 def _si : SOP2_Real_si <op, opName, outs, ins, asm>;
770 def _vi : SOP2_Real_vi <op, opName, outs, ins, asm>;
774 multiclass SOP2_32 <sop2 op, string opName, list<dag> pattern> : SOP2_m <
775 op, opName, (outs SReg_32:$dst), (ins SSrc_32:$src0, SSrc_32:$src1),
776 opName#" $dst, $src0, $src1", pattern
779 multiclass SOP2_64 <sop2 op, string opName, list<dag> pattern> : SOP2_m <
780 op, opName, (outs SReg_64:$dst), (ins SSrc_64:$src0, SSrc_64:$src1),
781 opName#" $dst, $src0, $src1", pattern
784 multiclass SOP2_64_32 <sop2 op, string opName, list<dag> pattern> : SOP2_m <
785 op, opName, (outs SReg_64:$dst), (ins SSrc_64:$src0, SSrc_32:$src1),
786 opName#" $dst, $src0, $src1", pattern
789 class SOPC_Helper <bits<7> op, RegisterOperand rc, ValueType vt,
790 string opName, PatLeaf cond> : SOPC <
791 op, (outs), (ins rc:$src0, rc:$src1),
792 opName#" $src0, $src1", []> {
796 class SOPC_32<bits<7> op, string opName, PatLeaf cond = COND_NULL>
797 : SOPC_Helper<op, SSrc_32, i32, opName, cond>;
799 class SOPC_64<bits<7> op, string opName, PatLeaf cond = COND_NULL>
800 : SOPC_Helper<op, SSrc_64, i64, opName, cond>;
802 class SOPK_Pseudo <string opName, dag outs, dag ins, list<dag> pattern> :
803 SOPK <outs, ins, "", pattern>,
804 SIMCInstr<opName, SISubtarget.NONE> {
806 let isCodeGenOnly = 1;
809 class SOPK_Real_si <sopk op, string opName, dag outs, dag ins, string asm> :
810 SOPK <outs, ins, asm, []>,
812 SIMCInstr<opName, SISubtarget.SI> {
813 let AssemblerPredicates = [isSICI];
814 let isCodeGenOnly = 0;
817 class SOPK_Real_vi <sopk op, string opName, dag outs, dag ins, string asm> :
818 SOPK <outs, ins, asm, []>,
820 SIMCInstr<opName, SISubtarget.VI> {
821 let AssemblerPredicates = [isVI];
822 let isCodeGenOnly = 0;
825 multiclass SOPK_m <sopk op, string opName, dag outs, dag ins, string opAsm,
826 string asm = opName#opAsm> {
827 def "" : SOPK_Pseudo <opName, outs, ins, []>;
829 def _si : SOPK_Real_si <op, opName, outs, ins, asm>;
831 def _vi : SOPK_Real_vi <op, opName, outs, ins, asm>;
835 multiclass SOPK_32 <sopk op, string opName, list<dag> pattern> {
836 def "" : SOPK_Pseudo <opName, (outs SReg_32:$dst), (ins u16imm:$src0),
839 def _si : SOPK_Real_si <op, opName, (outs SReg_32:$dst), (ins u16imm:$src0),
840 opName#" $dst, $src0">;
842 def _vi : SOPK_Real_vi <op, opName, (outs SReg_32:$dst), (ins u16imm:$src0),
843 opName#" $dst, $src0">;
846 multiclass SOPK_SCC <sopk op, string opName, list<dag> pattern> {
847 def "" : SOPK_Pseudo <opName, (outs),
848 (ins SReg_32:$src0, u16imm:$src1), pattern> {
853 def _si : SOPK_Real_si <op, opName, (outs),
854 (ins SReg_32:$sdst, u16imm:$simm16), opName#" $sdst, $simm16"> {
858 def _vi : SOPK_Real_vi <op, opName, (outs),
859 (ins SReg_32:$sdst, u16imm:$simm16), opName#" $sdst, $simm16"> {
864 multiclass SOPK_32TIE <sopk op, string opName, list<dag> pattern> : SOPK_m <
865 op, opName, (outs SReg_32:$sdst), (ins SReg_32:$src0, u16imm:$simm16),
869 multiclass SOPK_IMM32 <sopk op, string opName, dag outs, dag ins,
870 string argAsm, string asm = opName#argAsm> {
872 def "" : SOPK_Pseudo <opName, outs, ins, []>;
874 def _si : SOPK <outs, ins, asm, []>,
876 SIMCInstr<opName, SISubtarget.SI> {
877 let AssemblerPredicates = [isSICI];
878 let isCodeGenOnly = 0;
881 def _vi : SOPK <outs, ins, asm, []>,
883 SIMCInstr<opName, SISubtarget.VI> {
884 let AssemblerPredicates = [isVI];
885 let isCodeGenOnly = 0;
888 //===----------------------------------------------------------------------===//
890 //===----------------------------------------------------------------------===//
892 class SMRD_Pseudo <string opName, dag outs, dag ins, list<dag> pattern> :
893 SMRD <outs, ins, "", pattern>,
894 SIMCInstr<opName, SISubtarget.NONE> {
896 let isCodeGenOnly = 1;
899 class SMRD_Real_si <bits<5> op, string opName, bit imm, dag outs, dag ins,
901 SMRD <outs, ins, asm, []>,
903 SIMCInstr<opName, SISubtarget.SI> {
904 let AssemblerPredicates = [isSICI];
907 class SMRD_Real_vi <bits<8> op, string opName, bit imm, dag outs, dag ins,
908 string asm, list<dag> pattern = []> :
909 SMRD <outs, ins, asm, pattern>,
911 SIMCInstr<opName, SISubtarget.VI> {
912 let AssemblerPredicates = [isVI];
915 multiclass SMRD_m <smrd op, string opName, bit imm, dag outs, dag ins,
916 string asm, list<dag> pattern> {
918 def "" : SMRD_Pseudo <opName, outs, ins, pattern>;
920 def _si : SMRD_Real_si <op.SI, opName, imm, outs, ins, asm>;
922 // glc is only applicable to scalar stores, which are not yet
925 def _vi : SMRD_Real_vi <op.VI, opName, imm, outs, ins, asm>;
929 multiclass SMRD_Inval <smrd op, string opName,
930 SDPatternOperator node> {
931 let hasSideEffects = 1, mayStore = 1 in {
932 def "" : SMRD_Pseudo <opName, (outs), (ins), [(node)]>;
934 let sbase = 0, offset = 0 in {
936 def _si : SMRD_Real_si <op.SI, opName, 0, (outs), (ins), opName>;
939 let glc = 0, sdata = 0 in {
940 def _vi : SMRD_Real_vi <op.VI, opName, 0, (outs), (ins), opName>;
946 class SMEM_Inval <bits<8> op, string opName, SDPatternOperator node> :
947 SMRD_Real_vi<op, opName, 0, (outs), (ins), opName, [(node)]> {
948 let hasSideEffects = 1;
956 multiclass SMRD_Helper <smrd op, string opName, RegisterClass baseClass,
957 RegisterClass dstClass> {
959 op, opName#"_IMM", 1, (outs dstClass:$dst),
960 (ins baseClass:$sbase, smrd_offset:$offset),
961 opName#" $dst, $sbase, $offset", []
965 (outs dstClass:$dst), (ins baseClass:$sbase, smrd_literal_offset:$offset),
966 opName#" $dst, $sbase, $offset", []>, SMRD_IMMe_ci <op.SI> {
967 let AssemblerPredicates = [isCIOnly];
970 defm _SGPR : SMRD_m <
971 op, opName#"_SGPR", 0, (outs dstClass:$dst),
972 (ins baseClass:$sbase, SReg_32:$soff),
973 opName#" $dst, $sbase, $soff", []
977 //===----------------------------------------------------------------------===//
978 // Vector ALU classes
979 //===----------------------------------------------------------------------===//
981 // This must always be right before the operand being input modified.
982 def InputMods : OperandWithDefaultOps <i32, (ops (i32 0))> {
983 let PrintMethod = "printOperandAndMods";
986 def InputModsMatchClass : AsmOperandClass {
987 let Name = "RegWithInputMods";
990 def InputModsNoDefault : Operand <i32> {
991 let PrintMethod = "printOperandAndMods";
992 let ParserMatchClass = InputModsMatchClass;
995 class getNumSrcArgs<ValueType Src0, ValueType Src1, ValueType Src2> {
997 !if (!eq(Src0.Value, untyped.Value), 0,
998 !if (!eq(Src1.Value, untyped.Value), 1, // VOP1
999 !if (!eq(Src2.Value, untyped.Value), 2, // VOP2
1003 // Returns the register class to use for the destination of VOP[123C]
1004 // instructions for the given VT.
1005 class getVALUDstForVT<ValueType VT> {
1006 RegisterOperand ret = !if(!eq(VT.Size, 32), VOPDstOperand<VGPR_32>,
1007 !if(!eq(VT.Size, 64), VOPDstOperand<VReg_64>,
1008 !if(!eq(VT.Size, 16), VOPDstOperand<VGPR_32>,
1009 VOPDstOperand<SReg_64>))); // else VT == i1
1012 // Returns the register class to use for source 0 of VOP[12C]
1013 // instructions for the given VT.
1014 class getVOPSrc0ForVT<ValueType VT> {
1015 RegisterOperand ret = !if(!eq(VT.Size, 64), VSrc_64, VSrc_32);
1018 // Returns the register class to use for source 1 of VOP[12C] for the
1020 class getVOPSrc1ForVT<ValueType VT> {
1021 RegisterClass ret = !if(!eq(VT.Size, 64), VReg_64, VGPR_32);
1024 // Returns the register class to use for sources of VOP3 instructions for the
1026 class getVOP3SrcForVT<ValueType VT> {
1027 RegisterOperand ret =
1028 !if(!eq(VT.Size, 64),
1030 !if(!eq(VT.Value, i1.Value),
1037 // Returns 1 if the source arguments have modifiers, 0 if they do not.
1038 // XXX - do f16 instructions?
1039 class hasModifiers<ValueType SrcVT> {
1040 bit ret = !if(!eq(SrcVT.Value, f32.Value), 1,
1041 !if(!eq(SrcVT.Value, f64.Value), 1, 0));
1044 // Returns the input arguments for VOP[12C] instructions for the given SrcVT.
1045 class getIns32 <RegisterOperand Src0RC, RegisterClass Src1RC, int NumSrcArgs> {
1046 dag ret = !if(!eq(NumSrcArgs, 1), (ins Src0RC:$src0), // VOP1
1047 !if(!eq(NumSrcArgs, 2), (ins Src0RC:$src0, Src1RC:$src1), // VOP2
1051 // Returns the input arguments for VOP3 instructions for the given SrcVT.
1052 class getIns64 <RegisterOperand Src0RC, RegisterOperand Src1RC,
1053 RegisterOperand Src2RC, int NumSrcArgs,
1057 !if (!eq(NumSrcArgs, 1),
1058 !if (!eq(HasModifiers, 1),
1059 // VOP1 with modifiers
1060 (ins InputModsNoDefault:$src0_modifiers, Src0RC:$src0,
1061 ClampMod:$clamp, omod:$omod)
1063 // VOP1 without modifiers
1066 !if (!eq(NumSrcArgs, 2),
1067 !if (!eq(HasModifiers, 1),
1068 // VOP 2 with modifiers
1069 (ins InputModsNoDefault:$src0_modifiers, Src0RC:$src0,
1070 InputModsNoDefault:$src1_modifiers, Src1RC:$src1,
1071 ClampMod:$clamp, omod:$omod)
1073 // VOP2 without modifiers
1074 (ins Src0RC:$src0, Src1RC:$src1)
1076 /* NumSrcArgs == 3 */,
1077 !if (!eq(HasModifiers, 1),
1078 // VOP3 with modifiers
1079 (ins InputModsNoDefault:$src0_modifiers, Src0RC:$src0,
1080 InputModsNoDefault:$src1_modifiers, Src1RC:$src1,
1081 InputModsNoDefault:$src2_modifiers, Src2RC:$src2,
1082 ClampMod:$clamp, omod:$omod)
1084 // VOP3 without modifiers
1085 (ins Src0RC:$src0, Src1RC:$src1, Src2RC:$src2)
1089 // Returns the assembly string for the inputs and outputs of a VOP[12C]
1090 // instruction. This does not add the _e32 suffix, so it can be reused
1092 class getAsm32 <bit HasDst, int NumSrcArgs> {
1093 string dst = "$dst";
1094 string src0 = ", $src0";
1095 string src1 = ", $src1";
1096 string src2 = ", $src2";
1097 string ret = !if(HasDst, dst, "") #
1098 !if(!eq(NumSrcArgs, 1), src0, "") #
1099 !if(!eq(NumSrcArgs, 2), src0#src1, "") #
1100 !if(!eq(NumSrcArgs, 3), src0#src1#src2, "");
1103 // Returns the assembly string for the inputs and outputs of a VOP3
1105 class getAsm64 <bit HasDst, int NumSrcArgs, bit HasModifiers> {
1106 string src0 = !if(!eq(NumSrcArgs, 1), "$src0_modifiers", "$src0_modifiers,");
1107 string src1 = !if(!eq(NumSrcArgs, 1), "",
1108 !if(!eq(NumSrcArgs, 2), " $src1_modifiers",
1109 " $src1_modifiers,"));
1110 string src2 = !if(!eq(NumSrcArgs, 3), " $src2_modifiers", "");
1112 !if(!eq(HasModifiers, 0),
1113 getAsm32<HasDst, NumSrcArgs>.ret,
1114 "$dst, "#src0#src1#src2#"$clamp"#"$omod");
1117 class VOPProfile <list<ValueType> _ArgVT> {
1119 field list<ValueType> ArgVT = _ArgVT;
1121 field ValueType DstVT = ArgVT[0];
1122 field ValueType Src0VT = ArgVT[1];
1123 field ValueType Src1VT = ArgVT[2];
1124 field ValueType Src2VT = ArgVT[3];
1125 field RegisterOperand DstRC = getVALUDstForVT<DstVT>.ret;
1126 field RegisterOperand Src0RC32 = getVOPSrc0ForVT<Src0VT>.ret;
1127 field RegisterClass Src1RC32 = getVOPSrc1ForVT<Src1VT>.ret;
1128 field RegisterOperand Src0RC64 = getVOP3SrcForVT<Src0VT>.ret;
1129 field RegisterOperand Src1RC64 = getVOP3SrcForVT<Src1VT>.ret;
1130 field RegisterOperand Src2RC64 = getVOP3SrcForVT<Src2VT>.ret;
1132 field bit HasDst = !if(!eq(DstVT.Value, untyped.Value), 0, 1);
1133 field bit HasDst32 = HasDst;
1134 field int NumSrcArgs = getNumSrcArgs<Src0VT, Src1VT, Src2VT>.ret;
1135 field bit HasModifiers = hasModifiers<Src0VT>.ret;
1137 field dag Outs = !if(HasDst,(outs DstRC:$dst),(outs));
1139 // VOP3b instructions are a special case with a second explicit
1140 // output. This is manually overridden for them.
1141 field dag Outs32 = Outs;
1142 field dag Outs64 = Outs;
1144 field dag Ins32 = getIns32<Src0RC32, Src1RC32, NumSrcArgs>.ret;
1145 field dag Ins64 = getIns64<Src0RC64, Src1RC64, Src2RC64, NumSrcArgs,
1148 field string Asm32 = getAsm32<HasDst, NumSrcArgs>.ret;
1149 field string Asm64 = getAsm64<HasDst, NumSrcArgs, HasModifiers>.ret;
1152 // FIXME: I think these F16/I16 profiles will need to use f16/i16 types in order
1153 // for the instruction patterns to work.
1154 def VOP_F16_F16 : VOPProfile <[f16, f16, untyped, untyped]>;
1155 def VOP_F16_I16 : VOPProfile <[f16, i32, untyped, untyped]>;
1156 def VOP_I16_F16 : VOPProfile <[i32, f16, untyped, untyped]>;
1158 def VOP_F16_F16_F16 : VOPProfile <[f16, f16, f16, untyped]>;
1159 def VOP_F16_F16_I16 : VOPProfile <[f16, f16, i32, untyped]>;
1160 def VOP_I16_I16_I16 : VOPProfile <[i32, i32, i32, untyped]>;
1162 def VOP_NONE : VOPProfile <[untyped, untyped, untyped, untyped]>;
1164 def VOP_F32_F32 : VOPProfile <[f32, f32, untyped, untyped]>;
1165 def VOP_F32_F64 : VOPProfile <[f32, f64, untyped, untyped]>;
1166 def VOP_F32_I32 : VOPProfile <[f32, i32, untyped, untyped]>;
1167 def VOP_F64_F32 : VOPProfile <[f64, f32, untyped, untyped]>;
1168 def VOP_F64_F64 : VOPProfile <[f64, f64, untyped, untyped]>;
1169 def VOP_F64_I32 : VOPProfile <[f64, i32, untyped, untyped]>;
1170 def VOP_I32_F32 : VOPProfile <[i32, f32, untyped, untyped]>;
1171 def VOP_I32_F64 : VOPProfile <[i32, f64, untyped, untyped]>;
1172 def VOP_I32_I32 : VOPProfile <[i32, i32, untyped, untyped]>;
1174 def VOP_F32_F32_F32 : VOPProfile <[f32, f32, f32, untyped]>;
1175 def VOP_F32_F32_I32 : VOPProfile <[f32, f32, i32, untyped]>;
1176 def VOP_F64_F64_F64 : VOPProfile <[f64, f64, f64, untyped]>;
1177 def VOP_F64_F64_I32 : VOPProfile <[f64, f64, i32, untyped]>;
1178 def VOP_I32_F32_F32 : VOPProfile <[i32, f32, f32, untyped]>;
1179 def VOP_I32_F32_I32 : VOPProfile <[i32, f32, i32, untyped]>;
1180 def VOP_I32_I32_I32 : VOPProfile <[i32, i32, i32, untyped]>;
1182 // Write out to vcc or arbitrary SGPR.
1183 def VOP2b_I32_I1_I32_I32 : VOPProfile<[i32, i32, i32, untyped]> {
1184 let Asm32 = "$dst, vcc, $src0, $src1";
1185 let Asm64 = "$dst, $sdst, $src0, $src1";
1186 let Outs32 = (outs DstRC:$dst);
1187 let Outs64 = (outs DstRC:$dst, SReg_64:$sdst);
1190 // Write out to vcc or arbitrary SGPR and read in from vcc or
1192 def VOP2b_I32_I1_I32_I32_I1 : VOPProfile<[i32, i32, i32, i1]> {
1193 // We use VCSrc_32 to exclude literal constants, even though the
1194 // encoding normally allows them since the implicit VCC use means
1195 // using one would always violate the constant bus
1196 // restriction. SGPRs are still allowed because it should
1197 // technically be possible to use VCC again as src0.
1198 let Src0RC32 = VCSrc_32;
1199 let Asm32 = "$dst, vcc, $src0, $src1, vcc";
1200 let Asm64 = "$dst, $sdst, $src0, $src1, $src2";
1201 let Outs32 = (outs DstRC:$dst);
1202 let Outs64 = (outs DstRC:$dst, SReg_64:$sdst);
1204 // Suppress src2 implied by type since the 32-bit encoding uses an
1205 // implicit VCC use.
1206 let Ins32 = (ins Src0RC32:$src0, Src1RC32:$src1);
1209 class VOP3b_Profile<ValueType vt> : VOPProfile<[vt, vt, vt, vt]> {
1210 let Outs64 = (outs DstRC:$vdst, SReg_64:$sdst);
1211 let Asm64 = "$vdst, $sdst, $src0_modifiers, $src1_modifiers, $src2_modifiers"#"$clamp"#"$omod";
1214 def VOP3b_F32_I1_F32_F32_F32 : VOP3b_Profile<f32> {
1215 // FIXME: Hack to stop printing _e64
1216 let DstRC = RegisterOperand<VGPR_32>;
1219 def VOP3b_F64_I1_F64_F64_F64 : VOP3b_Profile<f64> {
1220 // FIXME: Hack to stop printing _e64
1221 let DstRC = RegisterOperand<VReg_64>;
1224 // VOPC instructions are a special case because for the 32-bit
1225 // encoding, we want to display the implicit vcc write as if it were
1226 // an explicit $dst.
1227 class VOPC_Profile<ValueType vt0, ValueType vt1 = vt0> : VOPProfile <[i1, vt0, vt1, untyped]> {
1228 let Asm32 = "vcc, $src0, $src1";
1229 // The destination for 32-bit encoding is implicit.
1233 class VOPC_Class_Profile<ValueType vt> : VOPC_Profile<vt, i32> {
1234 let Ins64 = (ins InputModsNoDefault:$src0_modifiers, Src0RC64:$src0, Src1RC64:$src1);
1235 let Asm64 = "$dst, $src0_modifiers, $src1";
1238 def VOPC_I1_F32_F32 : VOPC_Profile<f32>;
1239 def VOPC_I1_F64_F64 : VOPC_Profile<f64>;
1240 def VOPC_I1_I32_I32 : VOPC_Profile<i32>;
1241 def VOPC_I1_I64_I64 : VOPC_Profile<i64>;
1243 def VOPC_I1_F32_I32 : VOPC_Class_Profile<f32>;
1244 def VOPC_I1_F64_I32 : VOPC_Class_Profile<f64>;
1246 def VOP_I64_I64_I32 : VOPProfile <[i64, i64, i32, untyped]>;
1247 def VOP_I64_I32_I64 : VOPProfile <[i64, i32, i64, untyped]>;
1248 def VOP_I64_I64_I64 : VOPProfile <[i64, i64, i64, untyped]>;
1249 def VOP_CNDMASK : VOPProfile <[i32, i32, i32, untyped]> {
1250 let Ins32 = (ins Src0RC32:$src0, Src1RC32:$src1);
1251 let Ins64 = (ins Src0RC64:$src0, Src1RC64:$src1, SSrc_64:$src2);
1252 let Asm64 = "$dst, $src0, $src1, $src2";
1255 def VOP_F32_F32_F32_F32 : VOPProfile <[f32, f32, f32, f32]>;
1256 def VOP_MADK : VOPProfile <[f32, f32, f32, f32]> {
1257 field dag Ins = (ins VCSrc_32:$src0, VGPR_32:$vsrc1, u32imm:$src2);
1258 field string Asm = "$dst, $src0, $vsrc1, $src2";
1260 def VOP_MAC : VOPProfile <[f32, f32, f32, f32]> {
1261 let Ins32 = (ins Src0RC32:$src0, Src1RC32:$src1, VGPR_32:$src2);
1262 let Ins64 = getIns64<Src0RC64, Src1RC64, RegisterOperand<VGPR_32>, 3,
1264 let Asm32 = getAsm32<1, 2>.ret;
1265 let Asm64 = getAsm64<1, 2, HasModifiers>.ret;
1267 def VOP_F64_F64_F64_F64 : VOPProfile <[f64, f64, f64, f64]>;
1268 def VOP_I32_I32_I32_I32 : VOPProfile <[i32, i32, i32, i32]>;
1269 def VOP_I64_I32_I32_I64 : VOPProfile <[i64, i32, i32, i64]>;
1271 class SIInstAlias <string asm, Instruction inst, VOPProfile p> :
1272 InstAlias <asm, (inst)>, PredicateControl {
1274 field bit isCompare;
1275 field bit isCommutable;
1279 !if (!eq(p.NumSrcArgs, 0),
1281 (inst p.DstRC:$dst),
1282 !if (!eq(p.NumSrcArgs, 1),
1284 (inst p.DstRC:$dst, p.Src0RC32:$src0),
1285 !if (!eq(p.NumSrcArgs, 2),
1287 (inst p.DstRC:$dst, p.Src0RC32:$src0, p.Src1RC32:$src1),
1288 // else - unreachable
1291 !if (!eq(p.NumSrcArgs, 2),
1293 (inst p.Src0RC32:$src0, p.Src1RC32:$src1),
1294 !if (!eq(p.NumSrcArgs, 1),
1296 (inst p.Src0RC32:$src1),
1302 class SIInstAliasSI <string asm, string op_name, VOPProfile p> :
1303 SIInstAlias <asm, !cast<Instruction>(op_name#"_e32_si"), p> {
1304 let AssemblerPredicate = SIAssemblerPredicate;
1307 class SIInstAliasVI <string asm, string op_name, VOPProfile p> :
1308 SIInstAlias <asm, !cast<Instruction>(op_name#"_e32_vi"), p> {
1309 let AssemblerPredicates = [isVI];
1312 multiclass SIInstAliasBuilder <string asm, VOPProfile p> {
1314 def : SIInstAliasSI <asm, NAME, p>;
1316 def : SIInstAliasVI <asm, NAME, p>;
1319 class VOP <string opName> {
1320 string OpName = opName;
1323 class VOP2_REV <string revOp, bit isOrig> {
1324 string RevOp = revOp;
1325 bit IsOrig = isOrig;
1328 class AtomicNoRet <string noRetOp, bit isRet> {
1329 string NoRetOp = noRetOp;
1333 class VOP1_Pseudo <dag outs, dag ins, list<dag> pattern, string opName> :
1334 VOP1Common <outs, ins, "", pattern>,
1336 SIMCInstr <opName#"_e32", SISubtarget.NONE>,
1337 MnemonicAlias<opName#"_e32", opName> {
1339 let isCodeGenOnly = 1;
1345 class VOP1_Real_si <string opName, vop1 op, dag outs, dag ins, string asm> :
1346 VOP1<op.SI, outs, ins, asm, []>,
1347 SIMCInstr <opName#"_e32", SISubtarget.SI> {
1348 let AssemblerPredicate = SIAssemblerPredicate;
1351 class VOP1_Real_vi <string opName, vop1 op, dag outs, dag ins, string asm> :
1352 VOP1<op.VI, outs, ins, asm, []>,
1353 SIMCInstr <opName#"_e32", SISubtarget.VI> {
1354 let AssemblerPredicates = [isVI];
1357 multiclass VOP1_m <vop1 op, string opName, VOPProfile p, list<dag> pattern,
1358 string asm = opName#p.Asm32> {
1359 def "" : VOP1_Pseudo <p.Outs, p.Ins32, pattern, opName>;
1361 def _si : VOP1_Real_si <opName, op, p.Outs, p.Ins32, asm>;
1363 def _vi : VOP1_Real_vi <opName, op, p.Outs, p.Ins32, asm>;
1367 multiclass VOP1SI_m <vop1 op, string opName, VOPProfile p, list<dag> pattern,
1368 string asm = opName#p.Asm32> {
1370 def "" : VOP1_Pseudo <p.Outs, p.Ins32, pattern, opName>;
1372 def _si : VOP1_Real_si <opName, op, p.Outs, p.Ins32, asm>;
1375 class VOP2_Pseudo <dag outs, dag ins, list<dag> pattern, string opName> :
1376 VOP2Common <outs, ins, "", pattern>,
1378 SIMCInstr<opName#"_e32", SISubtarget.NONE>,
1379 MnemonicAlias<opName#"_e32", opName> {
1381 let isCodeGenOnly = 1;
1384 class VOP2_Real_si <string opName, vop2 op, dag outs, dag ins, string asm> :
1385 VOP2 <op.SI, outs, ins, opName#asm, []>,
1386 SIMCInstr <opName#"_e32", SISubtarget.SI> {
1387 let AssemblerPredicates = [isSICI];
1390 class VOP2_Real_vi <string opName, vop2 op, dag outs, dag ins, string asm> :
1391 VOP2 <op.VI, outs, ins, opName#asm, []>,
1392 SIMCInstr <opName#"_e32", SISubtarget.VI> {
1393 let AssemblerPredicates = [isVI];
1396 multiclass VOP2SI_m <vop2 op, string opName, VOPProfile p, list<dag> pattern,
1399 def "" : VOP2_Pseudo <p.Outs32, p.Ins32, pattern, opName>,
1400 VOP2_REV<revOp#"_e32", !eq(revOp, opName)>;
1402 def _si : VOP2_Real_si <opName, op, p.Outs32, p.Ins32, p.Asm32>;
1405 multiclass VOP2_m <vop2 op, string opName, VOPProfile p, list <dag> pattern,
1408 def "" : VOP2_Pseudo <p.Outs32, p.Ins32, pattern, opName>,
1409 VOP2_REV<revOp#"_e32", !eq(revOp, opName)>;
1411 def _si : VOP2_Real_si <opName, op, p.Outs32, p.Ins32, p.Asm32>;
1413 def _vi : VOP2_Real_vi <opName, op, p.Outs32, p.Ins32, p.Asm32>;
1417 class VOP3DisableFields <bit HasSrc1, bit HasSrc2, bit HasModifiers> {
1419 bits<2> src0_modifiers = !if(HasModifiers, ?, 0);
1420 bits<2> src1_modifiers = !if(HasModifiers, !if(HasSrc1, ?, 0), 0);
1421 bits<2> src2_modifiers = !if(HasModifiers, !if(HasSrc2, ?, 0), 0);
1422 bits<2> omod = !if(HasModifiers, ?, 0);
1423 bits<1> clamp = !if(HasModifiers, ?, 0);
1424 bits<9> src1 = !if(HasSrc1, ?, 0);
1425 bits<9> src2 = !if(HasSrc2, ?, 0);
1428 class VOP3DisableModFields <bit HasSrc0Mods,
1429 bit HasSrc1Mods = 0,
1430 bit HasSrc2Mods = 0,
1431 bit HasOutputMods = 0> {
1432 bits<2> src0_modifiers = !if(HasSrc0Mods, ?, 0);
1433 bits<2> src1_modifiers = !if(HasSrc1Mods, ?, 0);
1434 bits<2> src2_modifiers = !if(HasSrc2Mods, ?, 0);
1435 bits<2> omod = !if(HasOutputMods, ?, 0);
1436 bits<1> clamp = !if(HasOutputMods, ?, 0);
1439 class VOP3_Pseudo <dag outs, dag ins, list<dag> pattern, string opName> :
1440 VOP3Common <outs, ins, "", pattern>,
1442 SIMCInstr<opName#"_e64", SISubtarget.NONE>,
1443 MnemonicAlias<opName#"_e64", opName> {
1445 let isCodeGenOnly = 1;
1451 class VOP3_Real_si <bits<9> op, dag outs, dag ins, string asm, string opName> :
1452 VOP3Common <outs, ins, asm, []>,
1454 SIMCInstr<opName#"_e64", SISubtarget.SI> {
1455 let AssemblerPredicates = [isSICI];
1458 class VOP3_Real_vi <bits<10> op, dag outs, dag ins, string asm, string opName> :
1459 VOP3Common <outs, ins, asm, []>,
1461 SIMCInstr <opName#"_e64", SISubtarget.VI> {
1462 let AssemblerPredicates = [isVI];
1465 class VOP3b_Real_si <bits<9> op, dag outs, dag ins, string asm, string opName> :
1466 VOP3Common <outs, ins, asm, []>,
1468 SIMCInstr<opName#"_e64", SISubtarget.SI> {
1469 let AssemblerPredicates = [isSICI];
1472 class VOP3b_Real_vi <bits<10> op, dag outs, dag ins, string asm, string opName> :
1473 VOP3Common <outs, ins, asm, []>,
1475 SIMCInstr <opName#"_e64", SISubtarget.VI> {
1476 let AssemblerPredicates = [isVI];
1479 multiclass VOP3_m <vop op, dag outs, dag ins, string asm, list<dag> pattern,
1480 string opName, int NumSrcArgs, bit HasMods = 1> {
1482 def "" : VOP3_Pseudo <outs, ins, pattern, opName>;
1484 def _si : VOP3_Real_si <op.SI3, outs, ins, asm, opName>,
1485 VOP3DisableFields<!if(!eq(NumSrcArgs, 1), 0, 1),
1486 !if(!eq(NumSrcArgs, 2), 0, 1),
1488 def _vi : VOP3_Real_vi <op.VI3, outs, ins, asm, opName>,
1489 VOP3DisableFields<!if(!eq(NumSrcArgs, 1), 0, 1),
1490 !if(!eq(NumSrcArgs, 2), 0, 1),
1494 multiclass VOP3_1_m <vop op, dag outs, dag ins, string asm,
1495 list<dag> pattern, string opName, bit HasMods = 1> {
1497 def "" : VOP3_Pseudo <outs, ins, pattern, opName>;
1499 def _si : VOP3_Real_si <op.SI3, outs, ins, asm, opName>,
1500 VOP3DisableFields<0, 0, HasMods>;
1502 def _vi : VOP3_Real_vi <op.VI3, outs, ins, asm, opName>,
1503 VOP3DisableFields<0, 0, HasMods>;
1506 multiclass VOP3SI_1_m <vop op, dag outs, dag ins, string asm,
1507 list<dag> pattern, string opName, bit HasMods = 1> {
1509 def "" : VOP3_Pseudo <outs, ins, pattern, opName>;
1511 def _si : VOP3_Real_si <op.SI3, outs, ins, asm, opName>,
1512 VOP3DisableFields<0, 0, HasMods>;
1513 // No VI instruction. This class is for SI only.
1516 multiclass VOP3_2_m <vop op, dag outs, dag ins, string asm,
1517 list<dag> pattern, string opName, string revOp,
1520 def "" : VOP3_Pseudo <outs, ins, pattern, opName>,
1521 VOP2_REV<revOp#"_e64", !eq(revOp, opName)>;
1523 def _si : VOP3_Real_si <op.SI3, outs, ins, asm, opName>,
1524 VOP3DisableFields<1, 0, HasMods>;
1526 def _vi : VOP3_Real_vi <op.VI3, outs, ins, asm, opName>,
1527 VOP3DisableFields<1, 0, HasMods>;
1530 multiclass VOP3SI_2_m <vop op, dag outs, dag ins, string asm,
1531 list<dag> pattern, string opName, string revOp,
1534 def "" : VOP3_Pseudo <outs, ins, pattern, opName>,
1535 VOP2_REV<revOp#"_e64", !eq(revOp, opName)>;
1537 def _si : VOP3_Real_si <op.SI3, outs, ins, asm, opName>,
1538 VOP3DisableFields<1, 0, HasMods>;
1540 // No VI instruction. This class is for SI only.
1543 // Two operand VOP3b instruction that may have a 3rd SGPR bool operand
1544 // instead of an implicit VCC as in the VOP2b format.
1545 multiclass VOP3b_2_3_m <vop op, dag outs, dag ins, string asm,
1546 list<dag> pattern, string opName, string revOp,
1547 bit HasMods = 1, bit useSrc2Input = 0> {
1548 def "" : VOP3_Pseudo <outs, ins, pattern, opName>;
1550 def _si : VOP3b_Real_si <op.SI3, outs, ins, asm, opName>,
1551 VOP3DisableFields<1, useSrc2Input, HasMods>;
1553 def _vi : VOP3b_Real_vi <op.VI3, outs, ins, asm, opName>,
1554 VOP3DisableFields<1, useSrc2Input, HasMods>;
1557 multiclass VOP3_C_m <vop op, dag outs, dag ins, string asm,
1558 list<dag> pattern, string opName,
1559 bit HasMods, bit defExec,
1560 string revOp, list<SchedReadWrite> sched> {
1562 def "" : VOP3_Pseudo <outs, ins, pattern, opName>,
1563 VOP2_REV<revOp#"_e64", !eq(revOp, opName)> {
1564 let Defs = !if(defExec, [EXEC], []);
1565 let SchedRW = sched;
1568 def _si : VOP3_Real_si <op.SI3, outs, ins, asm, opName>,
1569 VOP3DisableFields<1, 0, HasMods> {
1570 let Defs = !if(defExec, [EXEC], []);
1571 let SchedRW = sched;
1574 def _vi : VOP3_Real_vi <op.VI3, outs, ins, asm, opName>,
1575 VOP3DisableFields<1, 0, HasMods> {
1576 let Defs = !if(defExec, [EXEC], []);
1577 let SchedRW = sched;
1581 // An instruction that is VOP2 on SI and VOP3 on VI, no modifiers.
1582 multiclass VOP2SI_3VI_m <vop3 op, string opName, dag outs, dag ins,
1583 string asm, list<dag> pattern = []> {
1584 let isPseudo = 1, isCodeGenOnly = 1 in {
1585 def "" : VOPAnyCommon <outs, ins, "", pattern>,
1586 SIMCInstr<opName, SISubtarget.NONE>;
1589 def _si : VOP2 <op.SI3{5-0}, outs, ins, asm, []>,
1590 SIMCInstr <opName, SISubtarget.SI> {
1591 let AssemblerPredicates = [isSICI];
1594 def _vi : VOP3Common <outs, ins, asm, []>,
1596 VOP3DisableFields <1, 0, 0>,
1597 SIMCInstr <opName, SISubtarget.VI> {
1598 let AssemblerPredicates = [isVI];
1602 multiclass VOP1_Helper <vop1 op, string opName, VOPProfile p, list<dag> pat32,
1605 defm _e32 : VOP1_m <op, opName, p, pat32>;
1607 defm _e64 : VOP3_1_m <op, p.Outs, p.Ins64, opName#p.Asm64, pat64, opName,
1611 multiclass VOP1Inst <vop1 op, string opName, VOPProfile P,
1612 SDPatternOperator node = null_frag> : VOP1_Helper <
1615 [(set P.DstVT:$dst, (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0,
1616 i32:$src0_modifiers, i1:$clamp, i32:$omod))))],
1617 [(set P.DstVT:$dst, (node P.Src0VT:$src0))])
1620 multiclass VOP1InstSI <vop1 op, string opName, VOPProfile P,
1621 SDPatternOperator node = null_frag> {
1623 defm _e32 : VOP1SI_m <op, opName, P, []>;
1625 defm _e64 : VOP3SI_1_m <op, P.Outs, P.Ins64, opName#P.Asm64,
1627 [(set P.DstVT:$dst, (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0,
1628 i32:$src0_modifiers, i1:$clamp, i32:$omod))))],
1629 [(set P.DstVT:$dst, (node P.Src0VT:$src0))]),
1630 opName, P.HasModifiers>;
1633 multiclass VOP2_Helper <vop2 op, string opName, VOPProfile p, list<dag> pat32,
1634 list<dag> pat64, string revOp> {
1636 defm _e32 : VOP2_m <op, opName, p, pat32, revOp>;
1638 defm _e64 : VOP3_2_m <op, p.Outs, p.Ins64, opName#p.Asm64, pat64, opName,
1639 revOp, p.HasModifiers>;
1642 multiclass VOP2Inst <vop2 op, string opName, VOPProfile P,
1643 SDPatternOperator node = null_frag,
1644 string revOp = opName> : VOP2_Helper <
1648 (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
1649 i1:$clamp, i32:$omod)),
1650 (P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers))))],
1651 [(set P.DstVT:$dst, (node P.Src0VT:$src0, P.Src1VT:$src1))]),
1655 multiclass VOP2InstSI <vop2 op, string opName, VOPProfile P,
1656 SDPatternOperator node = null_frag,
1657 string revOp = opName> {
1659 defm _e32 : VOP2SI_m <op, opName, P, [], revOp>;
1661 defm _e64 : VOP3SI_2_m <op, P.Outs, P.Ins64, opName#P.Asm64,
1664 (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
1665 i1:$clamp, i32:$omod)),
1666 (P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers))))],
1667 [(set P.DstVT:$dst, (node P.Src0VT:$src0, P.Src1VT:$src1))]),
1668 opName, revOp, P.HasModifiers>;
1671 multiclass VOP2b_Helper <vop2 op, string opName, VOPProfile p,
1672 list<dag> pat32, list<dag> pat64,
1673 string revOp, bit useSGPRInput> {
1675 let SchedRW = [Write32Bit, WriteSALU] in {
1676 let Uses = !if(useSGPRInput, [VCC, EXEC], [EXEC]), Defs = [VCC] in {
1677 defm _e32 : VOP2_m <op, opName, p, pat32, revOp>;
1680 defm _e64 : VOP3b_2_3_m <op, p.Outs64, p.Ins64, opName#p.Asm64, pat64,
1681 opName, revOp, p.HasModifiers, useSGPRInput>;
1685 multiclass VOP2bInst <vop2 op, string opName, VOPProfile P,
1686 SDPatternOperator node = null_frag,
1687 string revOp = opName> : VOP2b_Helper <
1691 (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
1692 i1:$clamp, i32:$omod)),
1693 (P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers))))],
1694 [(set P.DstVT:$dst, (node P.Src0VT:$src0, P.Src1VT:$src1))]),
1695 revOp, !eq(P.NumSrcArgs, 3)
1698 // A VOP2 instruction that is VOP3-only on VI.
1699 multiclass VOP2_VI3_Helper <vop23 op, string opName, VOPProfile p,
1700 list<dag> pat32, list<dag> pat64, string revOp> {
1702 defm _e32 : VOP2SI_m <op, opName, p, pat32, revOp>;
1704 defm _e64 : VOP3_2_m <op, p.Outs, p.Ins64, opName#p.Asm64, pat64, opName,
1705 revOp, p.HasModifiers>;
1708 multiclass VOP2_VI3_Inst <vop23 op, string opName, VOPProfile P,
1709 SDPatternOperator node = null_frag,
1710 string revOp = opName>
1715 (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
1716 i1:$clamp, i32:$omod)),
1717 (P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers))))],
1718 [(set P.DstVT:$dst, (node P.Src0VT:$src0, P.Src1VT:$src1))]),
1722 multiclass VOP2MADK <vop2 op, string opName, list<dag> pattern = []> {
1724 def "" : VOP2_Pseudo <VOP_MADK.Outs, VOP_MADK.Ins, pattern, opName>;
1726 let isCodeGenOnly = 0 in {
1727 def _si : VOP2Common <VOP_MADK.Outs, VOP_MADK.Ins,
1728 !strconcat(opName, VOP_MADK.Asm), []>,
1729 SIMCInstr <opName#"_e32", SISubtarget.SI>,
1730 VOP2_MADKe <op.SI> {
1731 let AssemblerPredicates = [isSICI];
1734 def _vi : VOP2Common <VOP_MADK.Outs, VOP_MADK.Ins,
1735 !strconcat(opName, VOP_MADK.Asm), []>,
1736 SIMCInstr <opName#"_e32", SISubtarget.VI>,
1737 VOP2_MADKe <op.VI> {
1738 let AssemblerPredicates = [isVI];
1740 } // End isCodeGenOnly = 0
1743 class VOPC_Pseudo <dag ins, list<dag> pattern, string opName> :
1744 VOPCCommon <ins, "", pattern>,
1746 SIMCInstr<opName#"_e32", SISubtarget.NONE> {
1748 let isCodeGenOnly = 1;
1751 multiclass VOPC_m <vopc op, dag ins, string op_asm, list<dag> pattern,
1752 string opName, bit DefExec, VOPProfile p,
1753 list<SchedReadWrite> sched,
1754 string revOpName = "", string asm = opName#"_e32 "#op_asm,
1755 string alias_asm = opName#" "#op_asm> {
1756 def "" : VOPC_Pseudo <ins, pattern, opName> {
1757 let Defs = !if(DefExec, [VCC, EXEC], [VCC]);
1758 let SchedRW = sched;
1761 let AssemblerPredicates = [isSICI] in {
1762 def _si : VOPC<op.SI, ins, asm, []>,
1763 SIMCInstr <opName#"_e32", SISubtarget.SI> {
1764 let Defs = !if(DefExec, [VCC, EXEC], [VCC]);
1765 let hasSideEffects = DefExec;
1766 let SchedRW = sched;
1769 } // End AssemblerPredicates = [isSICI]
1771 let AssemblerPredicates = [isVI] in {
1772 def _vi : VOPC<op.VI, ins, asm, []>,
1773 SIMCInstr <opName#"_e32", SISubtarget.VI> {
1774 let Defs = !if(DefExec, [VCC, EXEC], [VCC]);
1775 let hasSideEffects = DefExec;
1776 let SchedRW = sched;
1779 } // End AssemblerPredicates = [isVI]
1781 defm : SIInstAliasBuilder<alias_asm, p>;
1784 multiclass VOPC_Helper <vopc op, string opName, list<dag> pat32,
1785 list<dag> pat64, bit DefExec, string revOp,
1786 VOPProfile p, list<SchedReadWrite> sched> {
1787 defm _e32 : VOPC_m <op, p.Ins32, p.Asm32, pat32, opName, DefExec, p, sched>;
1789 defm _e64 : VOP3_C_m <op, (outs VOPDstS64:$dst), p.Ins64, opName#p.Asm64, pat64,
1790 opName, p.HasModifiers, DefExec, revOp, sched>;
1793 // Special case for class instructions which only have modifiers on
1794 // the 1st source operand.
1795 multiclass VOPC_Class_Helper <vopc op, string opName, list<dag> pat32,
1796 list<dag> pat64, bit DefExec, string revOp,
1797 VOPProfile p, list<SchedReadWrite> sched> {
1798 defm _e32 : VOPC_m <op, p.Ins32, p.Asm32, pat32, opName, DefExec, p, sched>;
1800 defm _e64 : VOP3_C_m <op, (outs VOPDstS64:$dst), p.Ins64, opName#p.Asm64, pat64,
1801 opName, p.HasModifiers, DefExec, revOp, sched>,
1802 VOP3DisableModFields<1, 0, 0>;
1805 multiclass VOPCInst <vopc op, string opName,
1806 VOPProfile P, PatLeaf cond = COND_NULL,
1807 string revOp = opName,
1809 list<SchedReadWrite> sched = [Write32Bit]> :
1814 (setcc (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
1815 i1:$clamp, i32:$omod)),
1816 (P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers)),
1818 [(set i1:$dst, (setcc P.Src0VT:$src0, P.Src1VT:$src1, cond))]),
1819 DefExec, revOp, P, sched
1822 multiclass VOPCClassInst <vopc op, string opName, VOPProfile P,
1824 list<SchedReadWrite> sched> : VOPC_Class_Helper <
1828 (AMDGPUfp_class (P.Src0VT (VOP3Mods0Clamp0OMod P.Src0VT:$src0, i32:$src0_modifiers)), P.Src1VT:$src1))],
1829 [(set i1:$dst, (AMDGPUfp_class P.Src0VT:$src0, P.Src1VT:$src1))]),
1830 DefExec, opName, P, sched
1834 multiclass VOPC_F32 <vopc op, string opName, PatLeaf cond = COND_NULL, string revOp = opName> :
1835 VOPCInst <op, opName, VOPC_I1_F32_F32, cond, revOp>;
1837 multiclass VOPC_F64 <vopc op, string opName, PatLeaf cond = COND_NULL, string revOp = opName> :
1838 VOPCInst <op, opName, VOPC_I1_F64_F64, cond, revOp, 0, [WriteDoubleAdd]>;
1840 multiclass VOPC_I32 <vopc op, string opName, PatLeaf cond = COND_NULL, string revOp = opName> :
1841 VOPCInst <op, opName, VOPC_I1_I32_I32, cond, revOp>;
1843 multiclass VOPC_I64 <vopc op, string opName, PatLeaf cond = COND_NULL, string revOp = opName> :
1844 VOPCInst <op, opName, VOPC_I1_I64_I64, cond, revOp, 0, [Write64Bit]>;
1847 multiclass VOPCX <vopc op, string opName, VOPProfile P,
1848 PatLeaf cond = COND_NULL,
1849 list<SchedReadWrite> sched,
1851 : VOPCInst <op, opName, P, cond, revOp, 1, sched>;
1853 multiclass VOPCX_F32 <vopc op, string opName, string revOp = opName> :
1854 VOPCX <op, opName, VOPC_I1_F32_F32, COND_NULL, [Write32Bit], revOp>;
1856 multiclass VOPCX_F64 <vopc op, string opName, string revOp = opName> :
1857 VOPCX <op, opName, VOPC_I1_F64_F64, COND_NULL, [WriteDoubleAdd], revOp>;
1859 multiclass VOPCX_I32 <vopc op, string opName, string revOp = opName> :
1860 VOPCX <op, opName, VOPC_I1_I32_I32, COND_NULL, [Write32Bit], revOp>;
1862 multiclass VOPCX_I64 <vopc op, string opName, string revOp = opName> :
1863 VOPCX <op, opName, VOPC_I1_I64_I64, COND_NULL, [Write64Bit], revOp>;
1865 multiclass VOP3_Helper <vop3 op, string opName, dag outs, dag ins, string asm,
1866 list<dag> pat, int NumSrcArgs, bit HasMods> : VOP3_m <
1867 op, outs, ins, opName#" "#asm, pat, opName, NumSrcArgs, HasMods
1870 multiclass VOPC_CLASS_F32 <vopc op, string opName> :
1871 VOPCClassInst <op, opName, VOPC_I1_F32_I32, 0, [Write32Bit]>;
1873 multiclass VOPCX_CLASS_F32 <vopc op, string opName> :
1874 VOPCClassInst <op, opName, VOPC_I1_F32_I32, 1, [Write32Bit]>;
1876 multiclass VOPC_CLASS_F64 <vopc op, string opName> :
1877 VOPCClassInst <op, opName, VOPC_I1_F64_I32, 0, [WriteDoubleAdd]>;
1879 multiclass VOPCX_CLASS_F64 <vopc op, string opName> :
1880 VOPCClassInst <op, opName, VOPC_I1_F64_I32, 1, [WriteDoubleAdd]>;
1882 multiclass VOP3Inst <vop3 op, string opName, VOPProfile P,
1883 SDPatternOperator node = null_frag> : VOP3_Helper <
1884 op, opName, (outs P.DstRC.RegClass:$dst), P.Ins64, P.Asm64,
1885 !if(!eq(P.NumSrcArgs, 3),
1888 (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
1889 i1:$clamp, i32:$omod)),
1890 (P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers)),
1891 (P.Src2VT (VOP3Mods P.Src2VT:$src2, i32:$src2_modifiers))))],
1892 [(set P.DstVT:$dst, (node P.Src0VT:$src0, P.Src1VT:$src1,
1894 !if(!eq(P.NumSrcArgs, 2),
1897 (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
1898 i1:$clamp, i32:$omod)),
1899 (P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers))))],
1900 [(set P.DstVT:$dst, (node P.Src0VT:$src0, P.Src1VT:$src1))])
1901 /* P.NumSrcArgs == 1 */,
1904 (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
1905 i1:$clamp, i32:$omod))))],
1906 [(set P.DstVT:$dst, (node P.Src0VT:$src0))]))),
1907 P.NumSrcArgs, P.HasModifiers
1910 // Special case for v_div_fmas_{f32|f64}, since it seems to be the
1911 // only VOP instruction that implicitly reads VCC.
1912 multiclass VOP3_VCC_Inst <vop3 op, string opName,
1914 SDPatternOperator node = null_frag> : VOP3_Helper <
1916 (outs P.DstRC.RegClass:$dst),
1917 (ins InputModsNoDefault:$src0_modifiers, P.Src0RC64:$src0,
1918 InputModsNoDefault:$src1_modifiers, P.Src1RC64:$src1,
1919 InputModsNoDefault:$src2_modifiers, P.Src2RC64:$src2,
1922 "$dst, $src0_modifiers, $src1_modifiers, $src2_modifiers"#"$clamp"#"$omod",
1924 (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
1925 i1:$clamp, i32:$omod)),
1926 (P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers)),
1927 (P.Src2VT (VOP3Mods P.Src2VT:$src2, i32:$src2_modifiers)),
1932 multiclass VOP3bInst <vop op, string opName, VOPProfile P, list<dag> pattern = []> :
1934 op, P.Outs64, P.Ins64,
1935 opName#" "#P.Asm64, pattern,
1939 class Vop3ModPat<Instruction Inst, VOPProfile P, SDPatternOperator node> : Pat<
1940 (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers, i1:$clamp, i32:$omod)),
1941 (P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers)),
1942 (P.Src2VT (VOP3Mods P.Src2VT:$src2, i32:$src2_modifiers))),
1943 (Inst i32:$src0_modifiers, P.Src0VT:$src0,
1944 i32:$src1_modifiers, P.Src1VT:$src1,
1945 i32:$src2_modifiers, P.Src2VT:$src2,
1949 //===----------------------------------------------------------------------===//
1950 // Interpolation opcodes
1951 //===----------------------------------------------------------------------===//
1953 class VINTRP_Pseudo <string opName, dag outs, dag ins, list<dag> pattern> :
1954 VINTRPCommon <outs, ins, "", pattern>,
1955 SIMCInstr<opName, SISubtarget.NONE> {
1957 let isCodeGenOnly = 1;
1960 class VINTRP_Real_si <bits <2> op, string opName, dag outs, dag ins,
1962 VINTRPCommon <outs, ins, asm, []>,
1964 SIMCInstr<opName, SISubtarget.SI>;
1966 class VINTRP_Real_vi <bits <2> op, string opName, dag outs, dag ins,
1968 VINTRPCommon <outs, ins, asm, []>,
1970 SIMCInstr<opName, SISubtarget.VI>;
1972 multiclass VINTRP_m <bits <2> op, dag outs, dag ins, string asm,
1973 list<dag> pattern = []> {
1974 def "" : VINTRP_Pseudo <NAME, outs, ins, pattern>;
1976 def _si : VINTRP_Real_si <op, NAME, outs, ins, asm>;
1978 def _vi : VINTRP_Real_vi <op, NAME, outs, ins, asm>;
1981 //===----------------------------------------------------------------------===//
1982 // Vector I/O classes
1983 //===----------------------------------------------------------------------===//
1985 class DS_Pseudo <string opName, dag outs, dag ins, list<dag> pattern> :
1986 DS <outs, ins, "", pattern>,
1987 SIMCInstr <opName, SISubtarget.NONE> {
1989 let isCodeGenOnly = 1;
1992 class DS_Real_si <bits<8> op, string opName, dag outs, dag ins, string asm> :
1993 DS <outs, ins, asm, []>,
1995 SIMCInstr <opName, SISubtarget.SI> {
1996 let isCodeGenOnly = 0;
1999 class DS_Real_vi <bits<8> op, string opName, dag outs, dag ins, string asm> :
2000 DS <outs, ins, asm, []>,
2002 SIMCInstr <opName, SISubtarget.VI>;
2004 class DS_Off16_Real_si <bits<8> op, string opName, dag outs, dag ins, string asm> :
2005 DS_Real_si <op,opName, outs, ins, asm> {
2007 // Single load interpret the 2 i8imm operands as a single i16 offset.
2009 let offset0 = offset{7-0};
2010 let offset1 = offset{15-8};
2011 let isCodeGenOnly = 0;
2014 class DS_Off16_Real_vi <bits<8> op, string opName, dag outs, dag ins, string asm> :
2015 DS_Real_vi <op, opName, outs, ins, asm> {
2017 // Single load interpret the 2 i8imm operands as a single i16 offset.
2019 let offset0 = offset{7-0};
2020 let offset1 = offset{15-8};
2023 multiclass DS_1A_RET <bits<8> op, string opName, RegisterClass rc,
2024 dag outs = (outs rc:$vdst),
2025 dag ins = (ins VGPR_32:$addr, ds_offset:$offset, gds:$gds),
2026 string asm = opName#" $vdst, $addr"#"$offset$gds"> {
2028 def "" : DS_Pseudo <opName, outs, ins, []>;
2030 let data0 = 0, data1 = 0 in {
2031 def _si : DS_Off16_Real_si <op, opName, outs, ins, asm>;
2032 def _vi : DS_Off16_Real_vi <op, opName, outs, ins, asm>;
2036 multiclass DS_1A_Off8_RET <bits<8> op, string opName, RegisterClass rc,
2037 dag outs = (outs rc:$vdst),
2038 dag ins = (ins VGPR_32:$addr, ds_offset0:$offset0, ds_offset1:$offset1,
2040 string asm = opName#" $vdst, $addr"#"$offset0"#"$offset1$gds"> {
2042 def "" : DS_Pseudo <opName, outs, ins, []>;
2044 let data0 = 0, data1 = 0, AsmMatchConverter = "cvtDSOffset01" in {
2045 def _si : DS_Real_si <op, opName, outs, ins, asm>;
2046 def _vi : DS_Real_vi <op, opName, outs, ins, asm>;
2050 multiclass DS_1A1D_NORET <bits<8> op, string opName, RegisterClass rc,
2052 dag ins = (ins VGPR_32:$addr, rc:$data0, ds_offset:$offset, gds:$gds),
2053 string asm = opName#" $addr, $data0"#"$offset$gds"> {
2055 def "" : DS_Pseudo <opName, outs, ins, []>,
2056 AtomicNoRet<opName, 0>;
2058 let data1 = 0, vdst = 0 in {
2059 def _si : DS_Off16_Real_si <op, opName, outs, ins, asm>;
2060 def _vi : DS_Off16_Real_vi <op, opName, outs, ins, asm>;
2064 multiclass DS_1A1D_Off8_NORET <bits<8> op, string opName, RegisterClass rc,
2066 dag ins = (ins VGPR_32:$addr, rc:$data0, rc:$data1,
2067 ds_offset0:$offset0, ds_offset1:$offset1, gds01:$gds),
2068 string asm = opName#" $addr, $data0, $data1"#"$offset0"#"$offset1"#"$gds"> {
2070 def "" : DS_Pseudo <opName, outs, ins, []>;
2072 let vdst = 0, AsmMatchConverter = "cvtDSOffset01" in {
2073 def _si : DS_Real_si <op, opName, outs, ins, asm>;
2074 def _vi : DS_Real_vi <op, opName, outs, ins, asm>;
2078 multiclass DS_1A1D_RET <bits<8> op, string opName, RegisterClass rc,
2079 string noRetOp = "",
2080 dag outs = (outs rc:$vdst),
2081 dag ins = (ins VGPR_32:$addr, rc:$data0, ds_offset:$offset, gds:$gds),
2082 string asm = opName#" $vdst, $addr, $data0"#"$offset$gds"> {
2084 let hasPostISelHook = 1 in {
2085 def "" : DS_Pseudo <opName, outs, ins, []>,
2086 AtomicNoRet<noRetOp, 1>;
2089 def _si : DS_Off16_Real_si <op, opName, outs, ins, asm>;
2090 def _vi : DS_Off16_Real_vi <op, opName, outs, ins, asm>;
2095 multiclass DS_1A2D_RET_m <bits<8> op, string opName, RegisterClass rc,
2096 string noRetOp = "", dag ins,
2097 dag outs = (outs rc:$vdst),
2098 string asm = opName#" $vdst, $addr, $data0, $data1"#"$offset"#"$gds"> {
2100 let hasPostISelHook = 1 in {
2101 def "" : DS_Pseudo <opName, outs, ins, []>,
2102 AtomicNoRet<noRetOp, 1>;
2104 def _si : DS_Off16_Real_si <op, opName, outs, ins, asm>;
2105 def _vi : DS_Off16_Real_vi <op, opName, outs, ins, asm>;
2109 multiclass DS_1A2D_RET <bits<8> op, string asm, RegisterClass rc,
2110 string noRetOp = "", RegisterClass src = rc> :
2111 DS_1A2D_RET_m <op, asm, rc, noRetOp,
2112 (ins VGPR_32:$addr, src:$data0, src:$data1,
2113 ds_offset:$offset, gds:$gds)
2116 multiclass DS_1A2D_NORET <bits<8> op, string opName, RegisterClass rc,
2117 string noRetOp = opName,
2119 dag ins = (ins VGPR_32:$addr, rc:$data0, rc:$data1,
2120 ds_offset:$offset, gds:$gds),
2121 string asm = opName#" $addr, $data0, $data1"#"$offset"#"$gds"> {
2123 def "" : DS_Pseudo <opName, outs, ins, []>,
2124 AtomicNoRet<noRetOp, 0>;
2127 def _si : DS_Off16_Real_si <op, opName, outs, ins, asm>;
2128 def _vi : DS_Off16_Real_vi <op, opName, outs, ins, asm>;
2132 multiclass DS_0A_RET <bits<8> op, string opName,
2133 dag outs = (outs VGPR_32:$vdst),
2134 dag ins = (ins ds_offset:$offset, gds:$gds),
2135 string asm = opName#" $vdst"#"$offset"#"$gds"> {
2137 let mayLoad = 1, mayStore = 1 in {
2138 def "" : DS_Pseudo <opName, outs, ins, []>;
2140 let addr = 0, data0 = 0, data1 = 0 in {
2141 def _si : DS_Off16_Real_si <op, opName, outs, ins, asm>;
2142 def _vi : DS_Off16_Real_vi <op, opName, outs, ins, asm>;
2143 } // end addr = 0, data0 = 0, data1 = 0
2144 } // end mayLoad = 1, mayStore = 1
2147 multiclass DS_1A_RET_GDS <bits<8> op, string opName,
2148 dag outs = (outs VGPR_32:$vdst),
2149 dag ins = (ins VGPR_32:$addr, ds_offset_gds:$offset),
2150 string asm = opName#" $vdst, $addr"#"$offset gds"> {
2152 def "" : DS_Pseudo <opName, outs, ins, []>;
2154 let data0 = 0, data1 = 0, gds = 1 in {
2155 def _si : DS_Off16_Real_si <op, opName, outs, ins, asm>;
2156 def _vi : DS_Off16_Real_vi <op, opName, outs, ins, asm>;
2157 } // end data0 = 0, data1 = 0, gds = 1
2160 multiclass DS_1A_GDS <bits<8> op, string opName,
2162 dag ins = (ins VGPR_32:$addr),
2163 string asm = opName#" $addr gds"> {
2165 def "" : DS_Pseudo <opName, outs, ins, []>;
2167 let vdst = 0, data0 = 0, data1 = 0, offset0 = 0, offset1 = 0, gds = 1 in {
2168 def _si : DS_Real_si <op, opName, outs, ins, asm>;
2169 def _vi : DS_Real_vi <op, opName, outs, ins, asm>;
2170 } // end vdst = 0, data = 0, data1 = 0, gds = 1
2173 multiclass DS_1A <bits<8> op, string opName,
2175 dag ins = (ins VGPR_32:$addr, ds_offset:$offset, gds:$gds),
2176 string asm = opName#" $addr"#"$offset"#"$gds"> {
2178 let mayLoad = 1, mayStore = 1 in {
2179 def "" : DS_Pseudo <opName, outs, ins, []>;
2181 let vdst = 0, data0 = 0, data1 = 0 in {
2182 def _si : DS_Off16_Real_si <op, opName, outs, ins, asm>;
2183 def _vi : DS_Off16_Real_vi <op, opName, outs, ins, asm>;
2184 } // let vdst = 0, data0 = 0, data1 = 0
2185 } // end mayLoad = 1, mayStore = 1
2188 //===----------------------------------------------------------------------===//
2190 //===----------------------------------------------------------------------===//
2192 class MTBUF_Pseudo <string opName, dag outs, dag ins, list<dag> pattern> :
2193 MTBUF <outs, ins, "", pattern>,
2194 SIMCInstr<opName, SISubtarget.NONE> {
2196 let isCodeGenOnly = 1;
2199 class MTBUF_Real_si <bits<3> op, string opName, dag outs, dag ins,
2201 MTBUF <outs, ins, asm, []>,
2203 SIMCInstr<opName, SISubtarget.SI>;
2205 class MTBUF_Real_vi <bits<4> op, string opName, dag outs, dag ins, string asm> :
2206 MTBUF <outs, ins, asm, []>,
2208 SIMCInstr <opName, SISubtarget.VI>;
2210 multiclass MTBUF_m <bits<3> op, string opName, dag outs, dag ins, string asm,
2211 list<dag> pattern> {
2213 def "" : MTBUF_Pseudo <opName, outs, ins, pattern>;
2215 def _si : MTBUF_Real_si <op, opName, outs, ins, asm>;
2217 def _vi : MTBUF_Real_vi <{0, op{2}, op{1}, op{0}}, opName, outs, ins, asm>;
2221 let mayStore = 1, mayLoad = 0 in {
2223 multiclass MTBUF_Store_Helper <bits<3> op, string opName,
2224 RegisterClass regClass> : MTBUF_m <
2226 (ins regClass:$vdata, u16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc,
2227 i1imm:$addr64, i8imm:$dfmt, i8imm:$nfmt, VGPR_32:$vaddr,
2228 SReg_128:$srsrc, i1imm:$slc, i1imm:$tfe, SCSrc_32:$soffset),
2229 opName#" $vdata, $offset, $offen, $idxen, $glc, $addr64, $dfmt,"
2230 #" $nfmt, $vaddr, $srsrc, $slc, $tfe, $soffset", []
2233 } // mayStore = 1, mayLoad = 0
2235 let mayLoad = 1, mayStore = 0 in {
2237 multiclass MTBUF_Load_Helper <bits<3> op, string opName,
2238 RegisterClass regClass> : MTBUF_m <
2239 op, opName, (outs regClass:$dst),
2240 (ins u16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc, i1imm:$addr64,
2241 i8imm:$dfmt, i8imm:$nfmt, VGPR_32:$vaddr, SReg_128:$srsrc,
2242 i1imm:$slc, i1imm:$tfe, SCSrc_32:$soffset),
2243 opName#" $dst, $offset, $offen, $idxen, $glc, $addr64, $dfmt,"
2244 #" $nfmt, $vaddr, $srsrc, $slc, $tfe, $soffset", []
2247 } // mayLoad = 1, mayStore = 0
2249 //===----------------------------------------------------------------------===//
2251 //===----------------------------------------------------------------------===//
2253 class mubuf <bits<7> si, bits<7> vi = si> {
2254 field bits<7> SI = si;
2255 field bits<7> VI = vi;
2258 let isCodeGenOnly = 0 in {
2260 class MUBUF_si <bits<7> op, dag outs, dag ins, string asm, list<dag> pattern> :
2261 MUBUF <outs, ins, asm, pattern>, MUBUFe <op> {
2265 } // End let isCodeGenOnly = 0
2267 class MUBUF_vi <bits<7> op, dag outs, dag ins, string asm, list<dag> pattern> :
2268 MUBUF <outs, ins, asm, pattern>, MUBUFe_vi <op> {
2272 class MUBUFAddr64Table <bit is_addr64, string suffix = ""> {
2273 bit IsAddr64 = is_addr64;
2274 string OpName = NAME # suffix;
2277 class MUBUF_Pseudo <string opName, dag outs, dag ins, list<dag> pattern> :
2278 MUBUF <outs, ins, "", pattern>,
2279 SIMCInstr<opName, SISubtarget.NONE> {
2281 let isCodeGenOnly = 1;
2283 // dummy fields, so that we can use let statements around multiclasses
2293 class MUBUF_Real_si <mubuf op, string opName, dag outs, dag ins,
2295 MUBUF <outs, ins, asm, []>,
2297 SIMCInstr<opName, SISubtarget.SI> {
2301 class MUBUF_Real_vi <mubuf op, string opName, dag outs, dag ins,
2303 MUBUF <outs, ins, asm, []>,
2305 SIMCInstr<opName, SISubtarget.VI> {
2309 multiclass MUBUF_m <mubuf op, string opName, dag outs, dag ins, string asm,
2310 list<dag> pattern> {
2312 def "" : MUBUF_Pseudo <opName, outs, ins, pattern>,
2313 MUBUFAddr64Table <0>;
2315 let addr64 = 0, isCodeGenOnly = 0 in {
2316 def _si : MUBUF_Real_si <op, opName, outs, ins, asm>;
2319 def _vi : MUBUF_Real_vi <op, opName, outs, ins, asm>;
2322 multiclass MUBUFAddr64_m <mubuf op, string opName, dag outs,
2323 dag ins, string asm, list<dag> pattern> {
2325 def "" : MUBUF_Pseudo <opName, outs, ins, pattern>,
2326 MUBUFAddr64Table <1>;
2328 let addr64 = 1, isCodeGenOnly = 0 in {
2329 def _si : MUBUF_Real_si <op, opName, outs, ins, asm>;
2332 // There is no VI version. If the pseudo is selected, it should be lowered
2333 // for VI appropriately.
2336 multiclass MUBUFAtomicOffset_m <mubuf op, string opName, dag outs, dag ins,
2337 string asm, list<dag> pattern, bit is_return> {
2339 def "" : MUBUF_Pseudo <opName, outs, ins, pattern>,
2340 MUBUFAddr64Table <0, !if(is_return, "_RTN", "")>,
2341 AtomicNoRet<NAME#"_OFFSET", is_return>;
2343 let offen = 0, idxen = 0, tfe = 0, vaddr = 0 in {
2345 def _si : MUBUF_Real_si <op, opName, outs, ins, asm>;
2348 def _vi : MUBUF_Real_vi <op, opName, outs, ins, asm>;
2352 multiclass MUBUFAtomicAddr64_m <mubuf op, string opName, dag outs, dag ins,
2353 string asm, list<dag> pattern, bit is_return> {
2355 def "" : MUBUF_Pseudo <opName, outs, ins, pattern>,
2356 MUBUFAddr64Table <1, !if(is_return, "_RTN", "")>,
2357 AtomicNoRet<NAME#"_ADDR64", is_return>;
2359 let offen = 0, idxen = 0, addr64 = 1, tfe = 0 in {
2360 def _si : MUBUF_Real_si <op, opName, outs, ins, asm>;
2363 // There is no VI version. If the pseudo is selected, it should be lowered
2364 // for VI appropriately.
2367 multiclass MUBUF_Atomic <mubuf op, string name, RegisterClass rc,
2368 ValueType vt, SDPatternOperator atomic> {
2370 let mayStore = 1, mayLoad = 1, hasPostISelHook = 1 in {
2372 // No return variants
2375 defm _ADDR64 : MUBUFAtomicAddr64_m <
2376 op, name#"_addr64", (outs),
2377 (ins rc:$vdata, VReg_64:$vaddr, SReg_128:$srsrc,
2378 SCSrc_32:$soffset, mbuf_offset:$offset, slc:$slc),
2379 name#" $vdata, $vaddr, $srsrc, $soffset addr64"#"$offset"#"$slc", [], 0
2382 defm _OFFSET : MUBUFAtomicOffset_m <
2383 op, name#"_offset", (outs),
2384 (ins rc:$vdata, SReg_128:$srsrc, SCSrc_32:$soffset, mbuf_offset:$offset,
2386 name#" $vdata, $srsrc, $soffset"#"$offset"#"$slc", [], 0
2390 // Variant that return values
2391 let glc = 1, Constraints = "$vdata = $vdata_in",
2392 DisableEncoding = "$vdata_in" in {
2394 defm _RTN_ADDR64 : MUBUFAtomicAddr64_m <
2395 op, name#"_rtn_addr64", (outs rc:$vdata),
2396 (ins rc:$vdata_in, VReg_64:$vaddr, SReg_128:$srsrc,
2397 SCSrc_32:$soffset, mbuf_offset:$offset, slc:$slc),
2398 name#" $vdata, $vaddr, $srsrc, $soffset addr64"#"$offset"#" glc"#"$slc",
2400 (atomic (MUBUFAddr64Atomic v4i32:$srsrc, i64:$vaddr, i32:$soffset,
2401 i16:$offset, i1:$slc), vt:$vdata_in))], 1
2404 defm _RTN_OFFSET : MUBUFAtomicOffset_m <
2405 op, name#"_rtn_offset", (outs rc:$vdata),
2406 (ins rc:$vdata_in, SReg_128:$srsrc, SCSrc_32:$soffset,
2407 mbuf_offset:$offset, slc:$slc),
2408 name#" $vdata, $srsrc, $soffset"#"$offset"#" glc$slc",
2410 (atomic (MUBUFOffsetAtomic v4i32:$srsrc, i32:$soffset, i16:$offset,
2411 i1:$slc), vt:$vdata_in))], 1
2416 } // mayStore = 1, mayLoad = 1, hasPostISelHook = 1
2419 // FIXME: tfe can't be an operand because it requires a separate
2420 // opcode because it needs an N+1 register class dest register.
2421 multiclass MUBUF_Load_Helper <mubuf op, string name, RegisterClass regClass,
2422 ValueType load_vt = i32,
2423 SDPatternOperator ld = null_frag> {
2425 let mayLoad = 1, mayStore = 0 in {
2426 let offen = 0, idxen = 0, vaddr = 0 in {
2427 defm _OFFSET : MUBUF_m <op, name#"_offset", (outs regClass:$vdata),
2428 (ins SReg_128:$srsrc, SCSrc_32:$soffset,
2429 mbuf_offset:$offset, glc:$glc, slc:$slc, tfe:$tfe),
2430 name#" $vdata, $srsrc, $soffset"#"$offset"#"$glc"#"$slc"#"$tfe",
2431 [(set load_vt:$vdata, (ld (MUBUFOffset v4i32:$srsrc,
2432 i32:$soffset, i16:$offset,
2433 i1:$glc, i1:$slc, i1:$tfe)))]>;
2436 let offen = 1, idxen = 0 in {
2437 defm _OFFEN : MUBUF_m <op, name#"_offen", (outs regClass:$vdata),
2438 (ins VGPR_32:$vaddr, SReg_128:$srsrc,
2439 SCSrc_32:$soffset, mbuf_offset:$offset, glc:$glc, slc:$slc,
2441 name#" $vdata, $vaddr, $srsrc, $soffset offen"#"$offset"#"$glc"#"$slc"#"$tfe", []>;
2444 let offen = 0, idxen = 1 in {
2445 defm _IDXEN : MUBUF_m <op, name#"_idxen", (outs regClass:$vdata),
2446 (ins VGPR_32:$vaddr, SReg_128:$srsrc,
2447 SCSrc_32:$soffset, mbuf_offset:$offset, glc:$glc,
2448 slc:$slc, tfe:$tfe),
2449 name#" $vdata, $vaddr, $srsrc, $soffset idxen"#"$offset"#"$glc"#"$slc"#"$tfe", []>;
2452 let offen = 1, idxen = 1 in {
2453 defm _BOTHEN : MUBUF_m <op, name#"_bothen", (outs regClass:$vdata),
2454 (ins VReg_64:$vaddr, SReg_128:$srsrc, SCSrc_32:$soffset,
2455 mbuf_offset:$offset, glc:$glc, slc:$slc, tfe:$tfe),
2456 name#" $vdata, $vaddr, $srsrc, $soffset idxen offen"#"$offset"#"$glc"#"$slc"#"$tfe", []>;
2459 let offen = 0, idxen = 0 in {
2460 defm _ADDR64 : MUBUFAddr64_m <op, name#"_addr64", (outs regClass:$vdata),
2461 (ins VReg_64:$vaddr, SReg_128:$srsrc,
2462 SCSrc_32:$soffset, mbuf_offset:$offset,
2463 glc:$glc, slc:$slc, tfe:$tfe),
2464 name#" $vdata, $vaddr, $srsrc, $soffset addr64"#"$offset"#
2465 "$glc"#"$slc"#"$tfe",
2466 [(set load_vt:$vdata, (ld (MUBUFAddr64 v4i32:$srsrc,
2467 i64:$vaddr, i32:$soffset,
2468 i16:$offset, i1:$glc, i1:$slc,
2474 multiclass MUBUF_Store_Helper <mubuf op, string name, RegisterClass vdataClass,
2475 ValueType store_vt = i32, SDPatternOperator st = null_frag> {
2476 let mayLoad = 0, mayStore = 1 in {
2477 defm : MUBUF_m <op, name, (outs),
2478 (ins vdataClass:$vdata, VGPR_32:$vaddr, SReg_128:$srsrc, SCSrc_32:$soffset,
2479 mbuf_offset:$offset, offen:$offen, idxen:$idxen, glc:$glc, slc:$slc,
2481 name#" $vdata, $vaddr, $srsrc, $soffset"#"$offen"#"$idxen"#"$offset"#
2482 "$glc"#"$slc"#"$tfe", []>;
2484 let offen = 0, idxen = 0, vaddr = 0 in {
2485 defm _OFFSET : MUBUF_m <op, name#"_offset",(outs),
2486 (ins vdataClass:$vdata, SReg_128:$srsrc, SCSrc_32:$soffset,
2487 mbuf_offset:$offset, glc:$glc, slc:$slc, tfe:$tfe),
2488 name#" $vdata, $srsrc, $soffset"#"$offset"#"$glc"#"$slc"#"$tfe",
2489 [(st store_vt:$vdata, (MUBUFOffset v4i32:$srsrc, i32:$soffset,
2490 i16:$offset, i1:$glc, i1:$slc, i1:$tfe))]>;
2491 } // offen = 0, idxen = 0, vaddr = 0
2493 let offen = 1, idxen = 0 in {
2494 defm _OFFEN : MUBUF_m <op, name#"_offen", (outs),
2495 (ins vdataClass:$vdata, VGPR_32:$vaddr, SReg_128:$srsrc,
2496 SCSrc_32:$soffset, mbuf_offset:$offset, glc:$glc,
2497 slc:$slc, tfe:$tfe),
2498 name#" $vdata, $vaddr, $srsrc, $soffset offen"#"$offset"#
2499 "$glc"#"$slc"#"$tfe", []>;
2500 } // end offen = 1, idxen = 0
2502 let offen = 0, idxen = 1 in {
2503 defm _IDXEN : MUBUF_m <op, name#"_idxen", (outs),
2504 (ins vdataClass:$vdata, VGPR_32:$vaddr, SReg_128:$srsrc,
2505 SCSrc_32:$soffset, mbuf_offset:$offset, glc:$glc,
2506 slc:$slc, tfe:$tfe),
2507 name#" $vdata, $vaddr, $srsrc, $soffset idxen"#"$offset"#"$glc"#"$slc"#"$tfe", []>;
2510 let offen = 1, idxen = 1 in {
2511 defm _BOTHEN : MUBUF_m <op, name#"_bothen", (outs),
2512 (ins vdataClass:$vdata, VReg_64:$vaddr, SReg_128:$srsrc, SCSrc_32:$soffset,
2513 mbuf_offset:$offset, glc:$glc, slc:$slc, tfe:$tfe),
2514 name#" $vdata, $vaddr, $srsrc, $soffset idxen offen"#"$offset"#"$glc"#"$slc"#"$tfe", []>;
2517 let offen = 0, idxen = 0 in {
2518 defm _ADDR64 : MUBUFAddr64_m <op, name#"_addr64", (outs),
2519 (ins vdataClass:$vdata, VReg_64:$vaddr, SReg_128:$srsrc,
2521 mbuf_offset:$offset, glc:$glc, slc:$slc,
2523 name#" $vdata, $vaddr, $srsrc, $soffset addr64"#
2524 "$offset"#"$glc"#"$slc"#"$tfe",
2525 [(st store_vt:$vdata,
2526 (MUBUFAddr64 v4i32:$srsrc, i64:$vaddr,
2527 i32:$soffset, i16:$offset,
2528 i1:$glc, i1:$slc, i1:$tfe))]>;
2530 } // End mayLoad = 0, mayStore = 1
2533 // For cache invalidation instructions.
2534 multiclass MUBUF_Invalidate <mubuf op, string opName, SDPatternOperator node> {
2535 let hasSideEffects = 1, mayStore = 1, AsmMatchConverter = "" in {
2536 def "" : MUBUF_Pseudo <opName, (outs), (ins), [(node)]>;
2538 // Set everything to 0.
2539 let offset = 0, offen = 0, idxen = 0, glc = 0, vaddr = 0,
2540 vdata = 0, srsrc = 0, slc = 0, tfe = 0, soffset = 0 in {
2542 def _si : MUBUF_Real_si <op, opName, (outs), (ins), opName>;
2545 def _vi : MUBUF_Real_vi <op, opName, (outs), (ins), opName>;
2547 } // End hasSideEffects = 1, mayStore = 1, AsmMatchConverter = ""
2550 class FLAT_Load_Helper <bits<7> op, string asm, RegisterClass regClass> :
2551 FLAT <op, (outs regClass:$vdst),
2552 (ins VReg_64:$addr, glc_flat:$glc, slc_flat:$slc, tfe_flat:$tfe),
2553 asm#" $vdst, $addr"#"$glc"#"$slc"#"$tfe", []> {
2558 class FLAT_Store_Helper <bits<7> op, string name, RegisterClass vdataClass> :
2559 FLAT <op, (outs), (ins vdataClass:$data, VReg_64:$addr,
2560 glc_flat:$glc, slc_flat:$slc, tfe_flat:$tfe),
2561 name#" $data, $addr"#"$glc"#"$slc"#"$tfe",
2571 multiclass FLAT_ATOMIC <bits<7> op, string name, RegisterClass vdst_rc,
2572 RegisterClass data_rc = vdst_rc> {
2574 let mayLoad = 1, mayStore = 1 in {
2575 def "" : FLAT <op, (outs),
2576 (ins VReg_64:$addr, data_rc:$data, slc_flat_atomic:$slc,
2577 tfe_flat_atomic:$tfe),
2578 name#" $addr, $data"#"$slc"#"$tfe", []>,
2579 AtomicNoRet <NAME, 0> {
2584 def _RTN : FLAT <op, (outs vdst_rc:$vdst),
2585 (ins VReg_64:$addr, data_rc:$data, slc_flat_atomic:$slc,
2586 tfe_flat_atomic:$tfe),
2587 name#" $vdst, $addr, $data glc"#"$slc"#"$tfe", []>,
2588 AtomicNoRet <NAME, 1> {
2590 let hasPostISelHook = 1;
2595 class MIMG_Mask <string op, int channels> {
2597 int Channels = channels;
2600 class MIMG_NoSampler_Helper <bits<7> op, string asm,
2601 RegisterClass dst_rc,
2602 RegisterClass src_rc> : MIMG <
2604 (outs dst_rc:$vdata),
2605 (ins i32imm:$dmask, i1imm:$unorm, i1imm:$glc, i1imm:$da, i1imm:$r128,
2606 i1imm:$tfe, i1imm:$lwe, i1imm:$slc, src_rc:$vaddr,
2608 asm#" $vdata, $dmask, $unorm, $glc, $da, $r128,"
2609 #" $tfe, $lwe, $slc, $vaddr, $srsrc",
2614 let hasPostISelHook = 1;
2617 multiclass MIMG_NoSampler_Src_Helper <bits<7> op, string asm,
2618 RegisterClass dst_rc,
2620 def _V1 : MIMG_NoSampler_Helper <op, asm, dst_rc, VGPR_32>,
2621 MIMG_Mask<asm#"_V1", channels>;
2622 def _V2 : MIMG_NoSampler_Helper <op, asm, dst_rc, VReg_64>,
2623 MIMG_Mask<asm#"_V2", channels>;
2624 def _V4 : MIMG_NoSampler_Helper <op, asm, dst_rc, VReg_128>,
2625 MIMG_Mask<asm#"_V4", channels>;
2628 multiclass MIMG_NoSampler <bits<7> op, string asm> {
2629 defm _V1 : MIMG_NoSampler_Src_Helper <op, asm, VGPR_32, 1>;
2630 defm _V2 : MIMG_NoSampler_Src_Helper <op, asm, VReg_64, 2>;
2631 defm _V3 : MIMG_NoSampler_Src_Helper <op, asm, VReg_96, 3>;
2632 defm _V4 : MIMG_NoSampler_Src_Helper <op, asm, VReg_128, 4>;
2635 class MIMG_Sampler_Helper <bits<7> op, string asm,
2636 RegisterClass dst_rc,
2637 RegisterClass src_rc, int wqm> : MIMG <
2639 (outs dst_rc:$vdata),
2640 (ins i32imm:$dmask, i1imm:$unorm, i1imm:$glc, i1imm:$da, i1imm:$r128,
2641 i1imm:$tfe, i1imm:$lwe, i1imm:$slc, src_rc:$vaddr,
2642 SReg_256:$srsrc, SReg_128:$ssamp),
2643 asm#" $vdata, $dmask, $unorm, $glc, $da, $r128,"
2644 #" $tfe, $lwe, $slc, $vaddr, $srsrc, $ssamp",
2648 let hasPostISelHook = 1;
2652 multiclass MIMG_Sampler_Src_Helper <bits<7> op, string asm,
2653 RegisterClass dst_rc,
2654 int channels, int wqm> {
2655 def _V1 : MIMG_Sampler_Helper <op, asm, dst_rc, VGPR_32, wqm>,
2656 MIMG_Mask<asm#"_V1", channels>;
2657 def _V2 : MIMG_Sampler_Helper <op, asm, dst_rc, VReg_64, wqm>,
2658 MIMG_Mask<asm#"_V2", channels>;
2659 def _V4 : MIMG_Sampler_Helper <op, asm, dst_rc, VReg_128, wqm>,
2660 MIMG_Mask<asm#"_V4", channels>;
2661 def _V8 : MIMG_Sampler_Helper <op, asm, dst_rc, VReg_256, wqm>,
2662 MIMG_Mask<asm#"_V8", channels>;
2663 def _V16 : MIMG_Sampler_Helper <op, asm, dst_rc, VReg_512, wqm>,
2664 MIMG_Mask<asm#"_V16", channels>;
2667 multiclass MIMG_Sampler <bits<7> op, string asm> {
2668 defm _V1 : MIMG_Sampler_Src_Helper<op, asm, VGPR_32, 1, 0>;
2669 defm _V2 : MIMG_Sampler_Src_Helper<op, asm, VReg_64, 2, 0>;
2670 defm _V3 : MIMG_Sampler_Src_Helper<op, asm, VReg_96, 3, 0>;
2671 defm _V4 : MIMG_Sampler_Src_Helper<op, asm, VReg_128, 4, 0>;
2674 multiclass MIMG_Sampler_WQM <bits<7> op, string asm> {
2675 defm _V1 : MIMG_Sampler_Src_Helper<op, asm, VGPR_32, 1, 1>;
2676 defm _V2 : MIMG_Sampler_Src_Helper<op, asm, VReg_64, 2, 1>;
2677 defm _V3 : MIMG_Sampler_Src_Helper<op, asm, VReg_96, 3, 1>;
2678 defm _V4 : MIMG_Sampler_Src_Helper<op, asm, VReg_128, 4, 1>;
2681 class MIMG_Gather_Helper <bits<7> op, string asm,
2682 RegisterClass dst_rc,
2683 RegisterClass src_rc, int wqm> : MIMG <
2685 (outs dst_rc:$vdata),
2686 (ins i32imm:$dmask, i1imm:$unorm, i1imm:$glc, i1imm:$da, i1imm:$r128,
2687 i1imm:$tfe, i1imm:$lwe, i1imm:$slc, src_rc:$vaddr,
2688 SReg_256:$srsrc, SReg_128:$ssamp),
2689 asm#" $vdata, $dmask, $unorm, $glc, $da, $r128,"
2690 #" $tfe, $lwe, $slc, $vaddr, $srsrc, $ssamp",
2695 // DMASK was repurposed for GATHER4. 4 components are always
2696 // returned and DMASK works like a swizzle - it selects
2697 // the component to fetch. The only useful DMASK values are
2698 // 1=red, 2=green, 4=blue, 8=alpha. (e.g. 1 returns
2699 // (red,red,red,red) etc.) The ISA document doesn't mention
2701 // Therefore, disable all code which updates DMASK by setting these two:
2703 let hasPostISelHook = 0;
2707 multiclass MIMG_Gather_Src_Helper <bits<7> op, string asm,
2708 RegisterClass dst_rc,
2709 int channels, int wqm> {
2710 def _V1 : MIMG_Gather_Helper <op, asm, dst_rc, VGPR_32, wqm>,
2711 MIMG_Mask<asm#"_V1", channels>;
2712 def _V2 : MIMG_Gather_Helper <op, asm, dst_rc, VReg_64, wqm>,
2713 MIMG_Mask<asm#"_V2", channels>;
2714 def _V4 : MIMG_Gather_Helper <op, asm, dst_rc, VReg_128, wqm>,
2715 MIMG_Mask<asm#"_V4", channels>;
2716 def _V8 : MIMG_Gather_Helper <op, asm, dst_rc, VReg_256, wqm>,
2717 MIMG_Mask<asm#"_V8", channels>;
2718 def _V16 : MIMG_Gather_Helper <op, asm, dst_rc, VReg_512, wqm>,
2719 MIMG_Mask<asm#"_V16", channels>;
2722 multiclass MIMG_Gather <bits<7> op, string asm> {
2723 defm _V1 : MIMG_Gather_Src_Helper<op, asm, VGPR_32, 1, 0>;
2724 defm _V2 : MIMG_Gather_Src_Helper<op, asm, VReg_64, 2, 0>;
2725 defm _V3 : MIMG_Gather_Src_Helper<op, asm, VReg_96, 3, 0>;
2726 defm _V4 : MIMG_Gather_Src_Helper<op, asm, VReg_128, 4, 0>;
2729 multiclass MIMG_Gather_WQM <bits<7> op, string asm> {
2730 defm _V1 : MIMG_Gather_Src_Helper<op, asm, VGPR_32, 1, 1>;
2731 defm _V2 : MIMG_Gather_Src_Helper<op, asm, VReg_64, 2, 1>;
2732 defm _V3 : MIMG_Gather_Src_Helper<op, asm, VReg_96, 3, 1>;
2733 defm _V4 : MIMG_Gather_Src_Helper<op, asm, VReg_128, 4, 1>;
2736 //===----------------------------------------------------------------------===//
2737 // Vector instruction mappings
2738 //===----------------------------------------------------------------------===//
2740 // Maps an opcode in e32 form to its e64 equivalent
2741 def getVOPe64 : InstrMapping {
2742 let FilterClass = "VOP";
2743 let RowFields = ["OpName"];
2744 let ColFields = ["Size"];
2746 let ValueCols = [["8"]];
2749 // Maps an opcode in e64 form to its e32 equivalent
2750 def getVOPe32 : InstrMapping {
2751 let FilterClass = "VOP";
2752 let RowFields = ["OpName"];
2753 let ColFields = ["Size"];
2755 let ValueCols = [["4"]];
2758 def getMaskedMIMGOp : InstrMapping {
2759 let FilterClass = "MIMG_Mask";
2760 let RowFields = ["Op"];
2761 let ColFields = ["Channels"];
2763 let ValueCols = [["1"], ["2"], ["3"] ];
2766 // Maps an commuted opcode to its original version
2767 def getCommuteOrig : InstrMapping {
2768 let FilterClass = "VOP2_REV";
2769 let RowFields = ["RevOp"];
2770 let ColFields = ["IsOrig"];
2772 let ValueCols = [["1"]];
2775 // Maps an original opcode to its commuted version
2776 def getCommuteRev : InstrMapping {
2777 let FilterClass = "VOP2_REV";
2778 let RowFields = ["RevOp"];
2779 let ColFields = ["IsOrig"];
2781 let ValueCols = [["0"]];
2784 def getCommuteCmpOrig : InstrMapping {
2785 let FilterClass = "VOP2_REV";
2786 let RowFields = ["RevOp"];
2787 let ColFields = ["IsOrig"];
2789 let ValueCols = [["1"]];
2792 // Maps an original opcode to its commuted version
2793 def getCommuteCmpRev : InstrMapping {
2794 let FilterClass = "VOP2_REV";
2795 let RowFields = ["RevOp"];
2796 let ColFields = ["IsOrig"];
2798 let ValueCols = [["0"]];
2802 def getMCOpcodeGen : InstrMapping {
2803 let FilterClass = "SIMCInstr";
2804 let RowFields = ["PseudoInstr"];
2805 let ColFields = ["Subtarget"];
2806 let KeyCol = [!cast<string>(SISubtarget.NONE)];
2807 let ValueCols = [[!cast<string>(SISubtarget.SI)],[!cast<string>(SISubtarget.VI)]];
2810 def getAddr64Inst : InstrMapping {
2811 let FilterClass = "MUBUFAddr64Table";
2812 let RowFields = ["OpName"];
2813 let ColFields = ["IsAddr64"];
2815 let ValueCols = [["1"]];
2818 // Maps an atomic opcode to its version with a return value.
2819 def getAtomicRetOp : InstrMapping {
2820 let FilterClass = "AtomicNoRet";
2821 let RowFields = ["NoRetOp"];
2822 let ColFields = ["IsRet"];
2824 let ValueCols = [["1"]];
2827 // Maps an atomic opcode to its returnless version.
2828 def getAtomicNoRetOp : InstrMapping {
2829 let FilterClass = "AtomicNoRet";
2830 let RowFields = ["NoRetOp"];
2831 let ColFields = ["IsRet"];
2833 let ValueCols = [["0"]];
2836 include "SIInstructions.td"
2837 include "CIInstructions.td"
2838 include "VIInstructions.td"