33 printInstruction(MI, STI, OS);
34 printAnnotation(OS, Annot);
37 void AMDGPUInstPrinter::printU4ImmOperand(
const MCInst *
MI,
unsigned OpNo,
43 void AMDGPUInstPrinter::printU8ImmOperand(
const MCInst *MI,
unsigned OpNo,
48 void AMDGPUInstPrinter::printU16ImmOperand(
const MCInst *MI,
unsigned OpNo,
55 O << formatHex(static_cast<uint64_t>(Imm & 0xffff));
57 printU32ImmOperand(MI, OpNo, STI, O);
60 void AMDGPUInstPrinter::printU4ImmDecOperand(
const MCInst *MI,
unsigned OpNo,
65 void AMDGPUInstPrinter::printU8ImmDecOperand(
const MCInst *MI,
unsigned OpNo,
70 void AMDGPUInstPrinter::printU16ImmDecOperand(
const MCInst *MI,
unsigned OpNo,
75 void AMDGPUInstPrinter::printS13ImmDecOperand(
const MCInst *MI,
unsigned OpNo,
80 void AMDGPUInstPrinter::printU32ImmOperand(
const MCInst *MI,
unsigned OpNo,
86 void AMDGPUInstPrinter::printNamedBit(
const MCInst *MI,
unsigned OpNo,
93 void AMDGPUInstPrinter::printOffen(
const MCInst *MI,
unsigned OpNo,
95 printNamedBit(MI, OpNo, O,
"offen");
98 void AMDGPUInstPrinter::printIdxen(
const MCInst *MI,
unsigned OpNo,
100 printNamedBit(MI, OpNo, O,
"idxen");
103 void AMDGPUInstPrinter::printAddr64(
const MCInst *MI,
unsigned OpNo,
105 printNamedBit(MI, OpNo, O,
"addr64");
108 void AMDGPUInstPrinter::printMBUFOffset(
const MCInst *MI,
unsigned OpNo,
112 printU16ImmDecOperand(MI, OpNo, O);
116 void AMDGPUInstPrinter::printOffset(
const MCInst *MI,
unsigned OpNo,
121 O << ((OpNo == 0)?
"offset:" :
" offset:");
122 printU16ImmDecOperand(MI, OpNo, O);
126 void AMDGPUInstPrinter::printOffsetS13(
const MCInst *MI,
unsigned OpNo,
131 O << ((OpNo == 0)?
"offset:" :
" offset:");
132 printS13ImmDecOperand(MI, OpNo, O);
136 void AMDGPUInstPrinter::printOffset0(
const MCInst *MI,
unsigned OpNo,
141 printU8ImmDecOperand(MI, OpNo, O);
145 void AMDGPUInstPrinter::printOffset1(
const MCInst *MI,
unsigned OpNo,
150 printU8ImmDecOperand(MI, OpNo, O);
154 void AMDGPUInstPrinter::printSMRDOffset8(
const MCInst *MI,
unsigned OpNo,
157 printU32ImmOperand(MI, OpNo, STI, O);
160 void AMDGPUInstPrinter::printSMRDOffset20(
const MCInst *MI,
unsigned OpNo,
163 printU32ImmOperand(MI, OpNo, STI, O);
166 void AMDGPUInstPrinter::printSMRDLiteralOffset(
const MCInst *MI,
unsigned OpNo,
169 printU32ImmOperand(MI, OpNo, STI, O);
172 void AMDGPUInstPrinter::printGDS(
const MCInst *MI,
unsigned OpNo,
174 printNamedBit(MI, OpNo, O,
"gds");
177 void AMDGPUInstPrinter::printGLC(
const MCInst *MI,
unsigned OpNo,
179 printNamedBit(MI, OpNo, O,
"glc");
182 void AMDGPUInstPrinter::printSLC(
const MCInst *MI,
unsigned OpNo,
184 printNamedBit(MI, OpNo, O,
"slc");
187 void AMDGPUInstPrinter::printTFE(
const MCInst *MI,
unsigned OpNo,
189 printNamedBit(MI, OpNo, O,
"tfe");
192 void AMDGPUInstPrinter::printDMask(
const MCInst *MI,
unsigned OpNo,
196 printU16ImmOperand(MI, OpNo, STI, O);
200 void AMDGPUInstPrinter::printUNorm(
const MCInst *MI,
unsigned OpNo,
202 printNamedBit(MI, OpNo, O,
"unorm");
205 void AMDGPUInstPrinter::printDA(
const MCInst *MI,
unsigned OpNo,
207 printNamedBit(MI, OpNo, O,
"da");
210 void AMDGPUInstPrinter::printR128(
const MCInst *MI,
unsigned OpNo,
212 printNamedBit(MI, OpNo, O,
"r128");
215 void AMDGPUInstPrinter::printLWE(
const MCInst *MI,
unsigned OpNo,
217 printNamedBit(MI, OpNo, O,
"lwe");
220 void AMDGPUInstPrinter::printD16(
const MCInst *MI,
unsigned OpNo,
222 printNamedBit(MI, OpNo, O,
"d16");
225 void AMDGPUInstPrinter::printExpCompr(
const MCInst *MI,
unsigned OpNo,
232 void AMDGPUInstPrinter::printExpVM(
const MCInst *MI,
unsigned OpNo,
239 void AMDGPUInstPrinter::printDFMT(
const MCInst *MI,
unsigned OpNo,
244 printU8ImmDecOperand(MI, OpNo, O);
248 void AMDGPUInstPrinter::printNFMT(
const MCInst *MI,
unsigned OpNo,
253 printU8ImmDecOperand(MI, OpNo, O);
272 case AMDGPU::FLAT_SCR:
275 case AMDGPU::XNACK_MASK:
296 case AMDGPU::EXEC_LO:
299 case AMDGPU::EXEC_HI:
302 case AMDGPU::FLAT_SCR_LO:
303 O <<
"flat_scratch_lo";
305 case AMDGPU::FLAT_SCR_HI:
306 O <<
"flat_scratch_hi";
308 case AMDGPU::XNACK_MASK_LO:
309 O <<
"xnack_mask_lo";
311 case AMDGPU::XNACK_MASK_HI:
312 O <<
"xnack_mask_hi";
316 case AMDGPU::SCRATCH_WAVE_OFFSET_REG:
317 case AMDGPU::PRIVATE_RSRC_REG:
371 O <<
'[' << RegIdx <<
':' << (RegIdx + NumRegs - 1) <<
']';
374 void AMDGPUInstPrinter::printVOPDst(
const MCInst *MI,
unsigned OpNo,
388 void AMDGPUInstPrinter::printVINTRPDst(
const MCInst *MI,
unsigned OpNo,
398 void AMDGPUInstPrinter::printImmediate16(
uint32_t Imm,
401 int16_t SImm =
static_cast<int16_t
>(Imm);
402 if (SImm >= -16 && SImm <= 64) {
409 else if (Imm == 0xBC00)
411 else if (Imm == 0x3800)
413 else if (Imm == 0xB800)
415 else if (Imm == 0x4000)
417 else if (Imm == 0xC000)
419 else if (Imm == 0x4400)
421 else if (Imm == 0xC400)
423 else if (Imm == 0x3118) {
427 O << formatHex(static_cast<uint64_t>(Imm));
430 void AMDGPUInstPrinter::printImmediateV216(
uint32_t Imm,
433 uint16_t Lo16 =
static_cast<uint16_t
>(Imm);
434 printImmediate16(Lo16, STI, O);
437 void AMDGPUInstPrinter::printImmediate32(
uint32_t Imm,
440 int32_t SImm =
static_cast<int32_t
>(Imm);
441 if (SImm >= -16 && SImm <= 64) {
464 else if (Imm == 0x3e22f983 &&
468 O << formatHex(static_cast<uint64_t>(Imm));
471 void AMDGPUInstPrinter::printImmediate64(uint64_t Imm,
474 int64_t SImm =
static_cast<int64_t
>(Imm);
475 if (SImm >= -16 && SImm <= 64) {
498 else if (Imm == 0x3fc45f306dc9c882 &&
506 O << formatHex(static_cast<uint64_t>(Imm));
510 void AMDGPUInstPrinter::printOperand(
const MCInst *MI,
unsigned OpNo,
514 O <<
"/*Missing OP" << OpNo <<
"*/";
521 }
else if (Op.
isImm()) {
529 printImmediate32(Op.
getImm(), STI,
O);
535 printImmediate64(Op.
getImm(), STI,
O);
541 printImmediate16(Op.
getImm(), STI,
O);
545 printImmediateV216(Op.
getImm(), STI,
O);
549 O << formatDec(Op.
getImm());
554 O <<
"/*invalid immediate*/";
571 else if (RCBits == 64)
584 void AMDGPUInstPrinter::printOperandAndFPInputMods(
const MCInst *MI,
593 bool NegMnemo =
false;
611 if (InputModifiers & SISrcMods::ABS)
619 void AMDGPUInstPrinter::printOperandAndIntInputMods(
const MCInst *MI,
627 if (InputModifiers & SISrcMods::SEXT)
631 void AMDGPUInstPrinter::printDPPCtrl(
const MCInst *MI,
unsigned OpNo,
639 O << formatDec(Imm & 0x3) <<
',';
640 O << formatDec((Imm & 0xc) >> 2) <<
',';
641 O << formatDec((Imm & 0x30) >> 4) <<
',';
642 O << formatDec((Imm & 0xc0) >> 6) <<
']';
646 printU4ImmDecOperand(MI, OpNo, O);
650 printU4ImmDecOperand(MI, OpNo, O);
654 printU4ImmDecOperand(MI, OpNo, O);
666 O <<
" row_half_mirror";
668 O <<
" row_bcast:15";
670 O <<
" row_bcast:31";
672 O <<
" /* Invalid dpp_ctrl value */";
676 void AMDGPUInstPrinter::printRowMask(
const MCInst *MI,
unsigned OpNo,
680 printU4ImmOperand(MI, OpNo, STI, O);
683 void AMDGPUInstPrinter::printBankMask(
const MCInst *MI,
unsigned OpNo,
687 printU4ImmOperand(MI, OpNo, STI, O);
690 void AMDGPUInstPrinter::printBoundCtrl(
const MCInst *MI,
unsigned OpNo,
695 O <<
" bound_ctrl:0";
699 void AMDGPUInstPrinter::printSDWASel(
const MCInst *MI,
unsigned OpNo,
716 void AMDGPUInstPrinter::printSDWADstSel(
const MCInst *MI,
unsigned OpNo,
720 printSDWASel(MI, OpNo, O);
723 void AMDGPUInstPrinter::printSDWASrc0Sel(
const MCInst *MI,
unsigned OpNo,
727 printSDWASel(MI, OpNo, O);
730 void AMDGPUInstPrinter::printSDWASrc1Sel(
const MCInst *MI,
unsigned OpNo,
734 printSDWASel(MI, OpNo, O);
737 void AMDGPUInstPrinter::printSDWADstUnused(
const MCInst *MI,
unsigned OpNo,
752 template <
unsigned N>
753 void AMDGPUInstPrinter::printExpSrcN(
const MCInst *MI,
unsigned OpNo,
764 if (
N == 1 ||
N == 2)
776 void AMDGPUInstPrinter::printExpSrc0(
const MCInst *MI,
unsigned OpNo,
779 printExpSrcN<0>(
MI, OpNo, STI,
O);
782 void AMDGPUInstPrinter::printExpSrc1(
const MCInst *MI,
unsigned OpNo,
785 printExpSrcN<1>(
MI, OpNo, STI,
O);
788 void AMDGPUInstPrinter::printExpSrc2(
const MCInst *MI,
unsigned OpNo,
791 printExpSrcN<2>(
MI, OpNo, STI,
O);
794 void AMDGPUInstPrinter::printExpSrc3(
const MCInst *MI,
unsigned OpNo,
797 printExpSrcN<3>(
MI, OpNo, STI,
O);
800 void AMDGPUInstPrinter::printExpTgt(
const MCInst *MI,
unsigned OpNo,
812 else if (Tgt >= 12 && Tgt <= 15)
813 O <<
" pos" << Tgt - 12;
814 else if (Tgt >= 32 && Tgt <= 63)
815 O <<
" param" << Tgt - 32;
818 O <<
" invalid_target_" << Tgt;
826 for (
int I = 0;
I < NumOps; ++
I) {
827 if (!!(Ops[
I] & Mod) != DefaultValue)
837 void AMDGPUInstPrinter::printPackedModifier(
const MCInst *MI,
845 for (
int OpName : { AMDGPU::OpName::src0_modifiers,
846 AMDGPU::OpName::src1_modifiers,
847 AMDGPU::OpName::src2_modifiers }) {
855 const bool HasDstSel =
867 for (
int I = 0;
I < NumOps; ++
I) {
871 O << !!(Ops[
I] & Mod);
881 void AMDGPUInstPrinter::printOpSel(
const MCInst *MI,
unsigned,
887 void AMDGPUInstPrinter::printOpSelHi(
const MCInst *MI,
unsigned OpNo,
893 void AMDGPUInstPrinter::printNegLo(
const MCInst *MI,
unsigned OpNo,
899 void AMDGPUInstPrinter::printNegHi(
const MCInst *MI,
unsigned OpNo,
905 void AMDGPUInstPrinter::printInterpSlot(
const MCInst *MI,
unsigned OpNum,
920 O <<
"invalid_param_" << Imm;
924 void AMDGPUInstPrinter::printInterpAttr(
const MCInst *MI,
unsigned OpNum,
931 void AMDGPUInstPrinter::printInterpAttrChan(
const MCInst *MI,
unsigned OpNum,
935 O <<
'.' <<
"xyzw"[Chan & 0x3];
938 void AMDGPUInstPrinter::printVGPRIndexMode(
const MCInst *MI,
unsigned OpNo,
960 void AMDGPUInstPrinter::printMemOperand(
const MCInst *MI,
unsigned OpNo,
1023 if ((SImm16 & ~ID_MASK_) != 0)
1056 const uint16_t OrMask,
1057 const uint16_t XorMask,
1061 uint16_t Probe0 = ((0 & AndMask) | OrMask) ^ XorMask;
1062 uint16_t Probe1 = ((
BITMASK_MASK & AndMask) | OrMask) ^ XorMask;
1067 uint16_t p0 = Probe0 &
Mask;
1068 uint16_t p1 = Probe1 &
Mask;
1103 for (
auto i = 0; i <
LANE_NUM; ++i) {
1122 O << formatDec(XorMask);
1126 OrMask == 0 && XorMask > 0 &&
1131 O << formatDec(XorMask + 1);
1137 if (GroupSize > 1 &&
1139 OrMask < GroupSize &&
1144 O << formatDec(GroupSize);
1146 O << formatDec(OrMask);
1157 printU16ImmDecOperand(MI, OpNo, O);
1168 unsigned Vmcnt, Expcnt, Lgkmcnt;
1171 bool NeedSpace =
false;
1174 O <<
"vmcnt(" << Vmcnt <<
')';
1181 O <<
"expcnt(" << Expcnt <<
')';
1188 O <<
"lgkmcnt(" << Lgkmcnt <<
')';
1211 O <<
", " << Offset <<
", " << Width;
1216 #include "AMDGPUGenAsmWriter.inc" 1221 printInstruction(MI, O);
1222 printAnnotation(O, Annot);
1233 switch (BankSwizzle) {
1235 O <<
"BS:VEC_021/SCL_122";
1238 O <<
"BS:VEC_120/SCL_212";
1241 O <<
"BS:VEC_102/SCL_221";
1277 if (KCacheMode > 0) {
1279 O <<
"CB" << KCacheBank <<
':';
1281 int LineSize = (KCacheMode == 1) ? 16 : 32;
1282 O << KCacheAddr * 16 <<
'-' << KCacheAddr * 16 + LineSize;
1296 int64_t Imm = Op.
getImm();
1335 O <<
"/*Missing OP" << OpNo <<
"*/";
1343 case R600::PRED_SEL_OFF:
1350 }
else if (Op.
isImm()) {
1359 }
else if (Op.
isExpr()) {
1361 Exp->
print(O, &MAI);
1420 #include "R600GenAsmWriter.inc"
constexpr bool isUInt< 32 >(uint64_t x)
void printUpdatePred(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Compute iterated dominance frontiers using a linear time algorithm.
Describe properties that are true of each instruction in the target description file.
static bool allOpsDefaultValue(const int *Ops, int NumOps, int Mod, bool IsPacked, bool HasDstSel)
unsigned getRegBitWidth(unsigned RCID)
Get the size in bits of a register from the register class RC.
float BitsToFloat(uint32_t Bits)
This function takes a 32-bit integer and returns the bit equivalent float.
static void printIfSet(const MCInst *MI, unsigned OpNo, raw_ostream &O, StringRef Asm, StringRef Default="")
void printUpdateExecMask(const MCInst *MI, unsigned OpNo, raw_ostream &O)
constexpr bool isInt< 16 >(int64_t x)
LLVM_READONLY int16_t getNamedOperandIdx(uint16_t Opcode, uint16_t NamedIdx)
void printWaitFlag(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
bool contains(unsigned Reg) const
contains - Return true if the specified register is included in this register class.
const FeatureBitset & getFeatureBits() const
static void printRegOperand(unsigned RegNo, raw_ostream &O, const MCRegisterInfo &MRI)
Base class for the full range of assembler expressions which are needed for parsing.
void printOModSI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printLast(const MCInst *MI, unsigned OpNo, raw_ostream &O)
unsigned getReg() const
Returns the register number.
void printRel(const MCInst *MI, unsigned OpNo, raw_ostream &O)
uint8_t OperandType
Information about the type of the operand.
static std::string getRegisterName(const TargetRegisterInfo *TRI, unsigned Reg)
void printKCache(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printCT(const MCInst *MI, unsigned OpNo, raw_ostream &O)
const MCExpr * getExpr() const
Instances of this class represent a single low-level machine instruction.
uint32_t FloatToBits(float Float)
This function takes a float and returns the bit equivalent 32-bit integer.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
void printBankSwizzle(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens=false) const
bool isSI(const MCSubtargetInfo &STI)
unsigned const MachineRegisterInfo * MRI
void printNeg(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void decodeWaitcnt(const IsaInfo::IsaVersion &Version, unsigned Waitcnt, unsigned &Vmcnt, unsigned &Expcnt, unsigned &Lgkmcnt)
Decodes Vmcnt, Expcnt and Lgkmcnt from given Waitcnt for given isa Version, and writes decoded values...
void printAbs(const MCInst *MI, unsigned OpNo, raw_ostream &O)
const char *const IdSymbolic[]
void printHwreg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
constexpr bool isPowerOf2_64(uint64_t Value)
Return true if the argument is a power of two > 0 (64 bit edition.)
void printMemOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Instruction set architecture version.
void printClampSI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
unsigned getNumOperands() const
void printLiteral(const MCInst *MI, unsigned OpNo, raw_ostream &O)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Operands with register or inline constant.
void printWrite(const MCInst *MI, unsigned OpNo, raw_ostream &O)
unsigned getLgkmcntBitMask(const IsaInfo::IsaVersion &Version)
unsigned countPopulation(T Value)
Count the number of set bits in a value.
void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
const MCOperand & getOperand(unsigned i) const
void printClamp(const MCInst *MI, unsigned OpNo, raw_ostream &O)
unsigned getExpcntBitMask(const IsaInfo::IsaVersion &Version)
uint64_t DoubleToBits(double Double)
This function takes a double and returns the bit equivalent 64-bit integer.
The access may modify the value stored in memory.
const char *const OpSysSymbolic[]
bool isCI(const MCSubtargetInfo &STI)
void printSwizzle(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
const char *const OpGsSymbolic[]
Provides AMDGPU specific target descriptions.
static bool printOperand(raw_ostream &OS, const SelectionDAG *G, const SDValue Value)
uint16_t getEncodingValue(unsigned RegNo) const
Returns the encoding for RegNo.
bool isVI(const MCSubtargetInfo &STI)
int16_t RegClass
This specifies the register class enumeration of the operand if the operand is a register.
void printRSel(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot, const MCSubtargetInfo &STI) override
Print the specified MCInst to the specified raw_ostream.
static void printSwizzleBitmask(const uint16_t AndMask, const uint16_t OrMask, const uint16_t XorMask, raw_ostream &O)
Generic base class for all target subtargets.
unsigned getVmcntBitMask(const IsaInfo::IsaVersion &Version)
constexpr bool isUInt< 16 >(uint64_t x)
Operands with register or 32-bit immediate.
void printOMOD(const MCInst *MI, unsigned OpNo, raw_ostream &O)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot, const MCSubtargetInfo &STI) override
Print the specified MCInst to the specified raw_ostream.
const MCOperandInfo * OpInfo
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
This class implements an extremely fast bulk output stream that can only output to a stream...
void printHigh(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
StringRef - Represent a constant reference to a string, i.e.
unsigned getOpcode() const
Instances of this class represent operands of the MCInst class.
IsaVersion getIsaVersion(const FeatureBitset &Features)
void printSendMsg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
const MCRegisterClass & getRegClass(unsigned i) const
Returns the register class associated with the enumeration value.