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::printR128A16(
const MCInst *MI,
unsigned OpNo,
213 printNamedBit(MI, OpNo, O,
"a16");
215 printNamedBit(MI, OpNo, O,
"r128");
218 void AMDGPUInstPrinter::printLWE(
const MCInst *MI,
unsigned OpNo,
220 printNamedBit(MI, OpNo, O,
"lwe");
223 void AMDGPUInstPrinter::printD16(
const MCInst *MI,
unsigned OpNo,
225 printNamedBit(MI, OpNo, O,
"d16");
228 void AMDGPUInstPrinter::printExpCompr(
const MCInst *MI,
unsigned OpNo,
235 void AMDGPUInstPrinter::printExpVM(
const MCInst *MI,
unsigned OpNo,
242 void AMDGPUInstPrinter::printFORMAT(
const MCInst *MI,
unsigned OpNo,
246 O <<
" dfmt:" << (Val & 15);
247 O <<
", nfmt:" << (Val >> 4);
266 case AMDGPU::FLAT_SCR:
269 case AMDGPU::XNACK_MASK:
290 case AMDGPU::EXEC_LO:
293 case AMDGPU::EXEC_HI:
296 case AMDGPU::FLAT_SCR_LO:
297 O <<
"flat_scratch_lo";
299 case AMDGPU::FLAT_SCR_HI:
300 O <<
"flat_scratch_hi";
302 case AMDGPU::XNACK_MASK_LO:
303 O <<
"xnack_mask_lo";
305 case AMDGPU::XNACK_MASK_HI:
306 O <<
"xnack_mask_hi";
310 case AMDGPU::SCRATCH_WAVE_OFFSET_REG:
311 case AMDGPU::PRIVATE_RSRC_REG:
365 O <<
'[' << RegIdx <<
':' << (RegIdx + NumRegs - 1) <<
']';
368 void AMDGPUInstPrinter::printVOPDst(
const MCInst *MI,
unsigned OpNo,
382 void AMDGPUInstPrinter::printVINTRPDst(
const MCInst *MI,
unsigned OpNo,
392 void AMDGPUInstPrinter::printImmediate16(
uint32_t Imm,
395 int16_t SImm =
static_cast<int16_t
>(Imm);
396 if (SImm >= -16 && SImm <= 64) {
403 else if (Imm == 0xBC00)
405 else if (Imm == 0x3800)
407 else if (Imm == 0xB800)
409 else if (Imm == 0x4000)
411 else if (Imm == 0xC000)
413 else if (Imm == 0x4400)
415 else if (Imm == 0xC400)
417 else if (Imm == 0x3118) {
421 O << formatHex(static_cast<uint64_t>(Imm));
424 void AMDGPUInstPrinter::printImmediateV216(
uint32_t Imm,
427 uint16_t Lo16 =
static_cast<uint16_t
>(Imm);
428 printImmediate16(Lo16, STI, O);
431 void AMDGPUInstPrinter::printImmediate32(
uint32_t Imm,
434 int32_t SImm =
static_cast<int32_t
>(Imm);
435 if (SImm >= -16 && SImm <= 64) {
458 else if (Imm == 0x3e22f983 &&
462 O << formatHex(static_cast<uint64_t>(Imm));
465 void AMDGPUInstPrinter::printImmediate64(uint64_t Imm,
468 int64_t SImm =
static_cast<int64_t
>(Imm);
469 if (SImm >= -16 && SImm <= 64) {
492 else if (Imm == 0x3fc45f306dc9c882 &&
500 O << formatHex(static_cast<uint64_t>(Imm));
504 void AMDGPUInstPrinter::printOperand(
const MCInst *MI,
unsigned OpNo,
508 O <<
"/*Missing OP" << OpNo <<
"*/";
515 }
else if (Op.
isImm()) {
523 printImmediate32(Op.
getImm(), STI,
O);
529 printImmediate64(Op.
getImm(), STI,
O);
535 printImmediate16(Op.
getImm(), STI,
O);
539 printImmediateV216(Op.
getImm(), STI,
O);
543 O << formatDec(Op.
getImm());
548 O <<
"/*invalid immediate*/";
565 else if (RCBits == 64)
578 void AMDGPUInstPrinter::printOperandAndFPInputMods(
const MCInst *MI,
587 bool NegMnemo =
false;
605 if (InputModifiers & SISrcMods::ABS)
613 void AMDGPUInstPrinter::printOperandAndIntInputMods(
const MCInst *MI,
621 if (InputModifiers & SISrcMods::SEXT)
625 void AMDGPUInstPrinter::printDPPCtrl(
const MCInst *MI,
unsigned OpNo,
633 O << formatDec(Imm & 0x3) <<
',';
634 O << formatDec((Imm & 0xc) >> 2) <<
',';
635 O << formatDec((Imm & 0x30) >> 4) <<
',';
636 O << formatDec((Imm & 0xc0) >> 6) <<
']';
640 printU4ImmDecOperand(MI, OpNo, O);
644 printU4ImmDecOperand(MI, OpNo, O);
648 printU4ImmDecOperand(MI, OpNo, O);
660 O <<
" row_half_mirror";
662 O <<
" row_bcast:15";
664 O <<
" row_bcast:31";
666 O <<
" /* Invalid dpp_ctrl value */";
670 void AMDGPUInstPrinter::printRowMask(
const MCInst *MI,
unsigned OpNo,
674 printU4ImmOperand(MI, OpNo, STI, O);
677 void AMDGPUInstPrinter::printBankMask(
const MCInst *MI,
unsigned OpNo,
681 printU4ImmOperand(MI, OpNo, STI, O);
684 void AMDGPUInstPrinter::printBoundCtrl(
const MCInst *MI,
unsigned OpNo,
689 O <<
" bound_ctrl:0";
693 void AMDGPUInstPrinter::printSDWASel(
const MCInst *MI,
unsigned OpNo,
710 void AMDGPUInstPrinter::printSDWADstSel(
const MCInst *MI,
unsigned OpNo,
714 printSDWASel(MI, OpNo, O);
717 void AMDGPUInstPrinter::printSDWASrc0Sel(
const MCInst *MI,
unsigned OpNo,
721 printSDWASel(MI, OpNo, O);
724 void AMDGPUInstPrinter::printSDWASrc1Sel(
const MCInst *MI,
unsigned OpNo,
728 printSDWASel(MI, OpNo, O);
731 void AMDGPUInstPrinter::printSDWADstUnused(
const MCInst *MI,
unsigned OpNo,
746 template <
unsigned N>
747 void AMDGPUInstPrinter::printExpSrcN(
const MCInst *MI,
unsigned OpNo,
758 if (
N == 1 ||
N == 2)
770 void AMDGPUInstPrinter::printExpSrc0(
const MCInst *MI,
unsigned OpNo,
773 printExpSrcN<0>(
MI, OpNo, STI,
O);
776 void AMDGPUInstPrinter::printExpSrc1(
const MCInst *MI,
unsigned OpNo,
779 printExpSrcN<1>(
MI, OpNo, STI,
O);
782 void AMDGPUInstPrinter::printExpSrc2(
const MCInst *MI,
unsigned OpNo,
785 printExpSrcN<2>(
MI, OpNo, STI,
O);
788 void AMDGPUInstPrinter::printExpSrc3(
const MCInst *MI,
unsigned OpNo,
791 printExpSrcN<3>(
MI, OpNo, STI,
O);
794 void AMDGPUInstPrinter::printExpTgt(
const MCInst *MI,
unsigned OpNo,
806 else if (Tgt >= 12 && Tgt <= 15)
807 O <<
" pos" << Tgt - 12;
808 else if (Tgt >= 32 && Tgt <= 63)
809 O <<
" param" << Tgt - 32;
812 O <<
" invalid_target_" << Tgt;
820 for (
int I = 0;
I < NumOps; ++
I) {
821 if (!!(Ops[
I] & Mod) != DefaultValue)
831 void AMDGPUInstPrinter::printPackedModifier(
const MCInst *MI,
839 for (
int OpName : { AMDGPU::OpName::src0_modifiers,
840 AMDGPU::OpName::src1_modifiers,
841 AMDGPU::OpName::src2_modifiers }) {
849 const bool HasDstSel =
861 for (
int I = 0;
I < NumOps; ++
I) {
865 O << !!(Ops[
I] & Mod);
875 void AMDGPUInstPrinter::printOpSel(
const MCInst *MI,
unsigned,
881 void AMDGPUInstPrinter::printOpSelHi(
const MCInst *MI,
unsigned OpNo,
887 void AMDGPUInstPrinter::printNegLo(
const MCInst *MI,
unsigned OpNo,
893 void AMDGPUInstPrinter::printNegHi(
const MCInst *MI,
unsigned OpNo,
899 void AMDGPUInstPrinter::printInterpSlot(
const MCInst *MI,
unsigned OpNum,
914 O <<
"invalid_param_" << Imm;
918 void AMDGPUInstPrinter::printInterpAttr(
const MCInst *MI,
unsigned OpNum,
925 void AMDGPUInstPrinter::printInterpAttrChan(
const MCInst *MI,
unsigned OpNum,
929 O <<
'.' <<
"xyzw"[Chan & 0x3];
932 void AMDGPUInstPrinter::printVGPRIndexMode(
const MCInst *MI,
unsigned OpNo,
954 void AMDGPUInstPrinter::printMemOperand(
const MCInst *MI,
unsigned OpNo,
1017 if ((SImm16 & ~ID_MASK_) != 0)
1050 const uint16_t OrMask,
1051 const uint16_t XorMask,
1055 uint16_t Probe0 = ((0 & AndMask) | OrMask) ^ XorMask;
1056 uint16_t Probe1 = ((
BITMASK_MASK & AndMask) | OrMask) ^ XorMask;
1061 uint16_t p0 = Probe0 &
Mask;
1062 uint16_t p1 = Probe1 &
Mask;
1097 for (
auto i = 0; i <
LANE_NUM; ++i) {
1116 O << formatDec(XorMask);
1120 OrMask == 0 && XorMask > 0 &&
1125 O << formatDec(XorMask + 1);
1131 if (GroupSize > 1 &&
1133 OrMask < GroupSize &&
1138 O << formatDec(GroupSize);
1140 O << formatDec(OrMask);
1151 printU16ImmDecOperand(MI, OpNo, O);
1161 unsigned Vmcnt, Expcnt, Lgkmcnt;
1164 bool NeedSpace =
false;
1167 O <<
"vmcnt(" << Vmcnt <<
')';
1174 O <<
"expcnt(" << Expcnt <<
')';
1181 O <<
"lgkmcnt(" << Lgkmcnt <<
')';
1204 O <<
", " << Offset <<
", " << Width;
1209 #include "AMDGPUGenAsmWriter.inc" 1214 printInstruction(MI, O);
1215 printAnnotation(O, Annot);
1226 switch (BankSwizzle) {
1228 O <<
"BS:VEC_021/SCL_122";
1231 O <<
"BS:VEC_120/SCL_212";
1234 O <<
"BS:VEC_102/SCL_221";
1270 if (KCacheMode > 0) {
1272 O <<
"CB" << KCacheBank <<
':';
1274 int LineSize = (KCacheMode == 1) ? 16 : 32;
1275 O << KCacheAddr * 16 <<
'-' << KCacheAddr * 16 + LineSize;
1289 int64_t Imm = Op.
getImm();
1328 O <<
"/*Missing OP" << OpNo <<
"*/";
1336 case R600::PRED_SEL_OFF:
1343 }
else if (Op.
isImm()) {
1352 }
else if (Op.
isExpr()) {
1354 Exp->
print(O, &MAI);
1413 #include "R600GenAsmWriter.inc"
constexpr bool isUInt< 32 >(uint64_t x)
void printUpdatePred(const MCInst *MI, unsigned OpNo, raw_ostream &O)
This class represents lattice values for constants.
unsigned getExpcntBitMask(const IsaVersion &Version)
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.
Instruction set architecture version.
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)
amdgpu Simplify well known AMD library false Value Value const Twine & Name
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 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)
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.
IsaVersion getIsaVersion(StringRef GPU)
void printWrite(const MCInst *MI, unsigned OpNo, raw_ostream &O)
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)
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)
bool hasFeature(unsigned Feature) const
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.
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 getLgkmcntBitMask(const IsaVersion &Version)
unsigned getOpcode() const
Instances of this class represent operands of the MCInst class.
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.
unsigned getVmcntBitMask(const IsaVersion &Version)
void decodeWaitcnt(const 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...