21#include "llvm/IR/IntrinsicsAMDGPU.h"
22#include "llvm/IR/IntrinsicsR600.h"
32#define GET_INSTRINFO_NAMED_OPS
33#define GET_INSTRMAP_INFO
34#include "AMDGPUGenInstrInfo.inc"
39 llvm::cl::desc(
"Set default AMDHSA Code Object Version (module flag "
40 "or asm directive still take priority if present)"));
45unsigned getBitMask(
unsigned Shift,
unsigned Width) {
46 return ((1 << Width) - 1) << Shift;
52unsigned packBits(
unsigned Src,
unsigned Dst,
unsigned Shift,
unsigned Width) {
53 unsigned Mask = getBitMask(Shift, Width);
54 return ((Src << Shift) & Mask) | (Dst & ~Mask);
60unsigned unpackBits(
unsigned Src,
unsigned Shift,
unsigned Width) {
61 return (Src & getBitMask(Shift, Width)) >> Shift;
65unsigned getVmcntBitShiftLo(
unsigned VersionMajor) {
70unsigned getVmcntBitWidthLo(
unsigned VersionMajor) {
75unsigned getExpcntBitShift(
unsigned VersionMajor) {
80unsigned getExpcntBitWidth(
unsigned VersionMajor) {
return 3; }
83unsigned getLgkmcntBitShift(
unsigned VersionMajor) {
88unsigned getLgkmcntBitWidth(
unsigned VersionMajor) {
93unsigned getVmcntBitShiftHi(
unsigned VersionMajor) {
return 14; }
96unsigned getVmcntBitWidthHi(
unsigned VersionMajor) {
97 return (VersionMajor == 9 || VersionMajor == 10) ? 2 : 0;
101unsigned getLoadcntBitWidth(
unsigned VersionMajor) {
106unsigned getSamplecntBitWidth(
unsigned VersionMajor) {
111unsigned getBvhcntBitWidth(
unsigned VersionMajor) {
116unsigned getDscntBitWidth(
unsigned VersionMajor) {
121unsigned getDscntBitShift(
unsigned VersionMajor) {
return 0; }
124unsigned getStorecntBitWidth(
unsigned VersionMajor) {
129unsigned getKmcntBitWidth(
unsigned VersionMajor) {
134unsigned getXcntBitWidth(
unsigned VersionMajor,
unsigned VersionMinor) {
139unsigned getAsynccntBitWidth(
unsigned VersionMajor,
unsigned VersionMinor) {
144unsigned getLoadcntStorecntBitShift(
unsigned VersionMajor) {
149inline unsigned getVaSdstBitWidth() {
return 3; }
152inline unsigned getVaSdstBitShift() {
return 9; }
155inline unsigned getVmVsrcBitWidth() {
return 3; }
158inline unsigned getVmVsrcBitShift() {
return 2; }
161inline unsigned getVaVdstBitWidth() {
return 4; }
164inline unsigned getVaVdstBitShift() {
return 12; }
167inline unsigned getVaVccBitWidth() {
return 1; }
170inline unsigned getVaVccBitShift() {
return 1; }
173inline unsigned getSaSdstBitWidth() {
return 1; }
176inline unsigned getSaSdstBitShift() {
return 0; }
179inline unsigned getVaSsrcBitWidth() {
return 1; }
182inline unsigned getVaSsrcBitShift() {
return 8; }
185inline unsigned getHoldCntWidth(
unsigned VersionMajor,
unsigned VersionMinor) {
186 static constexpr const unsigned MinMajor = 10;
187 static constexpr const unsigned MinMinor = 3;
188 return std::tie(VersionMajor, VersionMinor) >= std::tie(MinMajor, MinMinor)
194inline unsigned getHoldCntBitShift() {
return 7; }
215 M.getModuleFlag(
"amdhsa_code_object_version"))) {
216 return (
unsigned)Ver->getZExtValue() / 100;
227 switch (ABIVersion) {
243 switch (CodeObjectVersion) {
252 Twine(CodeObjectVersion));
257 switch (CodeObjectVersion) {
270 switch (CodeObjectVersion) {
281 switch (CodeObjectVersion) {
292 switch (CodeObjectVersion) {
302#define GET_MIMGBaseOpcodesTable_IMPL
303#define GET_MIMGDimInfoTable_IMPL
304#define GET_MIMGInfoTable_IMPL
305#define GET_MIMGLZMappingTable_IMPL
306#define GET_MIMGMIPMappingTable_IMPL
307#define GET_MIMGBiasMappingTable_IMPL
308#define GET_MIMGOffsetMappingTable_IMPL
309#define GET_MIMGG16MappingTable_IMPL
310#define GET_MAIInstInfoTable_IMPL
311#define GET_WMMAInstInfoTable_IMPL
312#include "AMDGPUGenSearchableTables.inc"
315 unsigned VDataDwords,
unsigned VAddrDwords) {
317 getMIMGOpcodeHelper(BaseOpcode, MIMGEncoding, VDataDwords, VAddrDwords);
318 return Info ? Info->Opcode : -1;
331 return NewInfo ? NewInfo->
Opcode : -1;
336 bool IsG16Supported) {
343 AddrWords += AddrComponents;
351 if ((IsA16 && !IsG16Supported) || BaseOpcode->
G16)
424#define GET_FP4FP8DstByteSelTable_DECL
425#define GET_FP4FP8DstByteSelTable_IMPL
438#define GET_DPMACCInstructionTable_DECL
439#define GET_DPMACCInstructionTable_IMPL
440#define GET_MTBUFInfoTable_DECL
441#define GET_MTBUFInfoTable_IMPL
442#define GET_MUBUFInfoTable_DECL
443#define GET_MUBUFInfoTable_IMPL
444#define GET_SMInfoTable_DECL
445#define GET_SMInfoTable_IMPL
446#define GET_VOP1InfoTable_DECL
447#define GET_VOP1InfoTable_IMPL
448#define GET_VOP2InfoTable_DECL
449#define GET_VOP2InfoTable_IMPL
450#define GET_VOP3InfoTable_DECL
451#define GET_VOP3InfoTable_IMPL
452#define GET_VOPC64DPPTable_DECL
453#define GET_VOPC64DPPTable_IMPL
454#define GET_VOPC64DPP8Table_DECL
455#define GET_VOPC64DPP8Table_IMPL
456#define GET_VOPCAsmOnlyInfoTable_DECL
457#define GET_VOPCAsmOnlyInfoTable_IMPL
458#define GET_VOP3CAsmOnlyInfoTable_DECL
459#define GET_VOP3CAsmOnlyInfoTable_IMPL
460#define GET_VOPDComponentTable_DECL
461#define GET_VOPDComponentTable_IMPL
462#define GET_VOPDPairs_DECL
463#define GET_VOPDPairs_IMPL
464#define GET_VOPTrue16Table_DECL
465#define GET_VOPTrue16Table_IMPL
466#define GET_True16D16Table_IMPL
467#define GET_WMMAOpcode2AddrMappingTable_DECL
468#define GET_WMMAOpcode2AddrMappingTable_IMPL
469#define GET_WMMAOpcode3AddrMappingTable_DECL
470#define GET_WMMAOpcode3AddrMappingTable_IMPL
471#define GET_getMFMA_F8F6F4_WithSize_DECL
472#define GET_getMFMA_F8F6F4_WithSize_IMPL
473#define GET_isMFMA_F8F6F4Table_IMPL
474#define GET_isCvtScaleF32_F32F16ToF8F4Table_IMPL
476#include "AMDGPUGenSearchableTables.inc"
480 return Info ? Info->BaseOpcode : -1;
485 getMTBUFInfoFromBaseOpcodeAndElements(BaseOpc, Elements);
486 return Info ? Info->Opcode : -1;
491 return Info ? Info->elements : 0;
496 return Info && Info->has_vaddr;
501 return Info && Info->has_srsrc;
506 return Info && Info->has_soffset;
511 return Info ? Info->BaseOpcode : -1;
516 getMUBUFInfoFromBaseOpcodeAndElements(BaseOpc, Elements);
517 return Info ? Info->Opcode : -1;
522 return Info ? Info->elements : 0;
527 return Info && Info->has_vaddr;
532 return Info && Info->has_srsrc;
537 return Info && Info->has_soffset;
542 return Info && Info->IsBufferInv;
547 return Info && Info->tfe;
551 const SMInfo *Info = getSMEMOpcodeHelper(
Opc);
552 return Info && Info->IsBuffer;
556 const VOPInfo *Info = getVOP1OpcodeHelper(
Opc);
557 return !Info || Info->IsSingle;
561 const VOPInfo *Info = getVOP2OpcodeHelper(
Opc);
562 return !Info || Info->IsSingle;
566 const VOPInfo *Info = getVOP3OpcodeHelper(
Opc);
567 return !Info || Info->IsSingle;
571 return isVOPC64DPPOpcodeHelper(
Opc) || isVOPC64DPP8OpcodeHelper(
Opc);
578 return Info && Info->is_dgemm;
583 return Info && Info->is_gfx940_xdl;
588 return Info ? Info->is_wmma_xdl :
false;
592 switch (EncodingVal) {
609 unsigned F8F8Opcode) {
612 return getMFMA_F8F6F4_InstWithNumRegs(SrcANumRegs, SrcBNumRegs, F8F8Opcode);
632 unsigned F8F8Opcode) {
635 return getMFMA_F8F6F4_InstWithNumRegs(SrcANumRegs, SrcBNumRegs, F8F8Opcode);
639 if (ST.hasFeature(AMDGPU::FeatureGFX13Insts))
641 if (ST.hasFeature(AMDGPU::FeatureGFX1250Insts))
643 if (ST.hasFeature(AMDGPU::FeatureGFX12Insts))
645 if (ST.hasFeature(AMDGPU::FeatureGFX11_7Insts))
647 if (ST.hasFeature(AMDGPU::FeatureGFX11Insts))
654 Opc = IsConvertibleToBitOp ? (
unsigned)AMDGPU::V_BITOP3_B32_e64 :
Opc;
665 EncodingFamily, VOPD3) != -1;
669 CanBeVOPDX = Info->CanBeVOPDX;
672 EncodingFamily, VOPD3) != -1;
673 return {CanBeVOPDX, CanBeVOPDY};
676 return {
false,
false};
681 Opc = IsConvertibleToBitOp ? (
unsigned)AMDGPU::V_BITOP3_B32_e64 :
Opc;
683 return Info ? Info->VOPDOp : ~0u;
691 return Opc == AMDGPU::V_MAC_F32_e64_gfx6_gfx7 ||
692 Opc == AMDGPU::V_MAC_F32_e64_gfx10 ||
693 Opc == AMDGPU::V_MAC_F32_e64_vi ||
694 Opc == AMDGPU::V_MAC_LEGACY_F32_e64_gfx6_gfx7 ||
695 Opc == AMDGPU::V_MAC_LEGACY_F32_e64_gfx10 ||
696 Opc == AMDGPU::V_MAC_F16_e64_vi ||
697 Opc == AMDGPU::V_FMAC_F64_e64_gfx90a ||
698 Opc == AMDGPU::V_FMAC_F64_e64_gfx12 ||
699 Opc == AMDGPU::V_FMAC_F64_e64_gfx13 ||
700 Opc == AMDGPU::V_FMAC_F32_e64_gfx10 ||
701 Opc == AMDGPU::V_FMAC_F32_e64_gfx11 ||
702 Opc == AMDGPU::V_FMAC_F32_e64_gfx12 ||
703 Opc == AMDGPU::V_FMAC_F32_e64_gfx13 ||
704 Opc == AMDGPU::V_FMAC_F32_e64_vi ||
705 Opc == AMDGPU::V_FMAC_LEGACY_F32_e64_gfx10 ||
706 Opc == AMDGPU::V_FMAC_DX9_ZERO_F32_e64_gfx11 ||
707 Opc == AMDGPU::V_FMAC_F16_e64_gfx10 ||
708 Opc == AMDGPU::V_FMAC_F16_t16_e64_gfx11 ||
709 Opc == AMDGPU::V_FMAC_F16_fake16_e64_gfx11 ||
710 Opc == AMDGPU::V_FMAC_F16_t16_e64_gfx12 ||
711 Opc == AMDGPU::V_FMAC_F16_fake16_e64_gfx12 ||
712 Opc == AMDGPU::V_FMAC_F16_t16_e64_gfx13 ||
713 Opc == AMDGPU::V_FMAC_F16_fake16_e64_gfx13 ||
714 Opc == AMDGPU::V_DOT2C_F32_F16_e64_vi ||
715 Opc == AMDGPU::V_DOT2C_F32_BF16_e64_vi ||
716 Opc == AMDGPU::V_DOT2C_I32_I16_e64_vi ||
717 Opc == AMDGPU::V_DOT4C_I32_I8_e64_vi ||
718 Opc == AMDGPU::V_DOT8C_I32_I4_e64_vi;
722 return Opc == AMDGPU::V_PERMLANE16_B32_gfx10 ||
723 Opc == AMDGPU::V_PERMLANEX16_B32_gfx10 ||
724 Opc == AMDGPU::V_PERMLANE16_B32_e64_gfx11 ||
725 Opc == AMDGPU::V_PERMLANEX16_B32_e64_gfx11 ||
726 Opc == AMDGPU::V_PERMLANE16_B32_e64_gfx12 ||
727 Opc == AMDGPU::V_PERMLANEX16_B32_e64_gfx12 ||
728 Opc == AMDGPU::V_PERMLANE16_VAR_B32_e64_gfx12 ||
729 Opc == AMDGPU::V_PERMLANEX16_VAR_B32_e64_gfx12;
733 return Opc == AMDGPU::V_CVT_F32_BF8_e64_gfx12 ||
734 Opc == AMDGPU::V_CVT_F32_FP8_e64_gfx12 ||
735 Opc == AMDGPU::V_CVT_F32_BF8_e64_dpp_gfx12 ||
736 Opc == AMDGPU::V_CVT_F32_FP8_e64_dpp_gfx12 ||
737 Opc == AMDGPU::V_CVT_F32_BF8_e64_dpp8_gfx12 ||
738 Opc == AMDGPU::V_CVT_F32_FP8_e64_dpp8_gfx12 ||
739 Opc == AMDGPU::V_CVT_PK_F32_BF8_fake16_e64_gfx12 ||
740 Opc == AMDGPU::V_CVT_PK_F32_FP8_fake16_e64_gfx12 ||
741 Opc == AMDGPU::V_CVT_PK_F32_BF8_t16_e64_gfx12 ||
742 Opc == AMDGPU::V_CVT_PK_F32_FP8_t16_e64_gfx12;
746 return Opc == AMDGPU::G_AMDGPU_BUFFER_ATOMIC_SWAP ||
747 Opc == AMDGPU::G_AMDGPU_BUFFER_ATOMIC_ADD ||
748 Opc == AMDGPU::G_AMDGPU_BUFFER_ATOMIC_SUB ||
749 Opc == AMDGPU::G_AMDGPU_BUFFER_ATOMIC_SMIN ||
750 Opc == AMDGPU::G_AMDGPU_BUFFER_ATOMIC_UMIN ||
751 Opc == AMDGPU::G_AMDGPU_BUFFER_ATOMIC_SMAX ||
752 Opc == AMDGPU::G_AMDGPU_BUFFER_ATOMIC_UMAX ||
753 Opc == AMDGPU::G_AMDGPU_BUFFER_ATOMIC_AND ||
754 Opc == AMDGPU::G_AMDGPU_BUFFER_ATOMIC_OR ||
755 Opc == AMDGPU::G_AMDGPU_BUFFER_ATOMIC_XOR ||
756 Opc == AMDGPU::G_AMDGPU_BUFFER_ATOMIC_INC ||
757 Opc == AMDGPU::G_AMDGPU_BUFFER_ATOMIC_DEC ||
758 Opc == AMDGPU::G_AMDGPU_BUFFER_ATOMIC_FADD ||
759 Opc == AMDGPU::G_AMDGPU_BUFFER_ATOMIC_FMIN ||
760 Opc == AMDGPU::G_AMDGPU_BUFFER_ATOMIC_FMAX ||
761 Opc == AMDGPU::G_AMDGPU_BUFFER_ATOMIC_CMPSWAP ||
762 Opc == AMDGPU::G_AMDGPU_BUFFER_ATOMIC_SUB_CLAMP_U32 ||
763 Opc == AMDGPU::G_AMDGPU_BUFFER_ATOMIC_COND_SUB_U32 ||
764 Opc == AMDGPU::G_AMDGPU_ATOMIC_CMPXCHG;
768 return Opc == GLOBAL_STORE_ASYNC_FROM_LDS_B8_gfx1250 ||
769 Opc == GLOBAL_STORE_ASYNC_FROM_LDS_B32_gfx1250 ||
770 Opc == GLOBAL_STORE_ASYNC_FROM_LDS_B64_gfx1250 ||
771 Opc == GLOBAL_STORE_ASYNC_FROM_LDS_B128_gfx1250 ||
772 Opc == GLOBAL_STORE_ASYNC_FROM_LDS_B8_SADDR_gfx1250 ||
773 Opc == GLOBAL_STORE_ASYNC_FROM_LDS_B32_SADDR_gfx1250 ||
774 Opc == GLOBAL_STORE_ASYNC_FROM_LDS_B64_SADDR_gfx1250 ||
775 Opc == GLOBAL_STORE_ASYNC_FROM_LDS_B128_SADDR_gfx1250;
779 return Opc == TENSOR_STORE_FROM_LDS_d2_gfx1250 ||
780 Opc == TENSOR_STORE_FROM_LDS_d4_gfx1250;
800 return Info && Info->IsTrue16;
807 if (Info->HasFP8DstByteSel)
809 if (Info->HasFP4DstByteSel)
817 return Info && Info->IsDPMACCInstruction;
822 return Info ? Info->Opcode3Addr : ~0u;
827 return Info ? Info->Opcode2Addr : ~0u;
834 return getMCOpcodeGen(Opcode,
static_cast<Subtarget
>(Gen));
841 case AMDGPU::V_AND_B32_e32:
843 case AMDGPU::V_OR_B32_e32:
845 case AMDGPU::V_XOR_B32_e32:
847 case AMDGPU::V_XNOR_B32_e32:
852int getVOPDFull(
unsigned OpX,
unsigned OpY,
unsigned EncodingFamily,
854 bool IsConvertibleToBitOp = VOPD3 ?
getBitOp2(OpY) : 0;
855 OpY = IsConvertibleToBitOp ? (
unsigned)AMDGPU::V_BITOP3_B32_e64 : OpY;
857 getVOPDInfoFromComponentOpcodes(OpX, OpY, EncodingFamily, VOPD3);
858 return Info ? Info->Opcode : -1;
862 const VOPDInfo *Info = getVOPDOpcodeHelper(VOPDOpcode);
864 const auto *OpX = getVOPDBaseFromComponent(Info->OpX);
865 const auto *OpY = getVOPDBaseFromComponent(Info->OpY);
867 return {OpX->BaseVOP, OpY->BaseVOP};
879 HasSrc2Acc = TiedIdx != -1;
889 if (Opcode == AMDGPU::V_CNDMASK_B32_e32 ||
890 Opcode == AMDGPU::V_CNDMASK_B32_e64) {
897 getNamedOperandIdx(Opcode, OpName::src0))) {
900 NumVOPD3Mods = SrcOperandsNum;
910 for (CompOprIdx =
Component::SRC1; CompOprIdx < OperandsNum; ++CompOprIdx) {
912 MandatoryLiteralIdx = CompOprIdx;
919 return getNamedOperandIdx(Opcode, OpName::bitop3);
937 std::function<
MCRegister(
unsigned,
unsigned)> GetRegIdx,
947 unsigned BanksMask) ->
bool {
954 if ((BaseX.
id() & BanksMask) == (BaseY.
id() & BanksMask))
957 ((BaseX.
id() + 1) & BanksMask) == (BaseY.
id() & BanksMask))
960 (BaseX.
id() & BanksMask) == ((BaseY.
id() + 1) & BanksMask))
972 if (!OpXRegs[CompOprIdx] || !OpYRegs[CompOprIdx])
985 if (MRI.
regsOverlap(OpXRegs[CompOprIdx], OpYRegs[CompOprIdx]))
991 if (banksOverlap(OpXRegs[CompOprIdx], OpYRegs[CompOprIdx], BanksMasks) &&
993 OpXRegs[CompOprIdx] != OpYRegs[CompOprIdx]))
1008InstInfo::getRegIndices(
unsigned CompIdx,
1009 std::function<
MCRegister(
unsigned,
unsigned)> GetRegIdx,
1013 const auto &Comp = CompInfo[CompIdx];
1016 RegIndices[
DST] = GetRegIdx(CompIdx, Comp.getIndexOfDstInMCOperands());
1019 unsigned CompSrcIdx = CompOprIdx -
DST_NUM;
1021 Comp.hasRegSrcOperand(CompSrcIdx)
1022 ? GetRegIdx(CompIdx,
1023 Comp.getIndexOfSrcInMCOperands(CompSrcIdx, VOPD3))
1038 const auto &OpXDesc = InstrInfo->get(OpX);
1039 const auto &OpYDesc = InstrInfo->get(OpY);
1051 if (!STI.getFeatureBits().test(FeatureSupportsXNACK))
1053 if (!STI.getFeatureBits().test(FeatureSupportsSRAMECC))
1062 std::optional<bool> XnackRequested;
1063 std::optional<bool> SramEccRequested;
1065 for (
const std::string &Feature : Features.
getFeatures()) {
1066 if (Feature ==
"+xnack")
1067 XnackRequested =
true;
1068 else if (Feature ==
"-xnack")
1069 XnackRequested =
false;
1070 else if (Feature ==
"+sramecc")
1071 SramEccRequested =
true;
1072 else if (Feature ==
"-sramecc")
1073 SramEccRequested =
false;
1079 if (XnackRequested) {
1080 if (XnackSupported) {
1086 if (*XnackRequested) {
1087 errs() <<
"warning: xnack 'On' was requested for a processor that does "
1088 "not support it!\n";
1090 errs() <<
"warning: xnack 'Off' was requested for a processor that "
1091 "does not support it!\n";
1096 if (SramEccRequested) {
1097 if (SramEccSupported) {
1104 if (*SramEccRequested) {
1105 errs() <<
"warning: sramecc 'On' was requested for a processor that "
1106 "does not support it!\n";
1108 errs() <<
"warning: sramecc 'Off' was requested for a processor that "
1109 "does not support it!\n";
1127 TargetID.
split(TargetIDSplit,
':');
1129 for (
const auto &FeatureString : TargetIDSplit) {
1130 if (FeatureString.starts_with(
"xnack"))
1132 if (FeatureString.starts_with(
"sramecc"))
1138 const Triple &TargetTriple = STI.getTargetTriple();
1142 <<
'-' << TargetTriple.
getOSName() <<
'-'
1145 std::string Processor;
1150 Processor = STI.getCPU().
str();
1156 std::string Features;
1160 Features +=
":sramecc-";
1162 Features +=
":sramecc+";
1165 Features +=
":xnack-";
1167 Features +=
":xnack+";
1170 StreamRep << Processor << Features;
1234 unsigned FlatWorkGroupSize) {
1235 assert(FlatWorkGroupSize != 0);
1245 unsigned MaxBarriers = 16;
1249 return std::min(MaxWaves /
N, MaxBarriers);
1264 unsigned FlatWorkGroupSize) {
1272 unsigned FlatWorkGroupSize) {
1330 return Addressable ? AddressableNumSGPRs : 108;
1331 if (
Version.Major >= 8 && !Addressable)
1332 AddressableNumSGPRs = 112;
1337 return std::min(MaxNumSGPRs, AddressableNumSGPRs);
1341 bool FlatScrUsed,
bool XNACKUsed) {
1342 unsigned ExtraSGPRs = 0;
1373 return divideCeil(std::max(1u, NumRegs), Granule);
1383 unsigned DynamicVGPRBlockSize,
1384 std::optional<bool> EnableWavefrontSize32) {
1388 if (DynamicVGPRBlockSize != 0)
1389 return DynamicVGPRBlockSize;
1391 bool IsWave32 = EnableWavefrontSize32
1392 ? *EnableWavefrontSize32
1396 return IsWave32 ? 24 : 12;
1399 return IsWave32 ? 16 : 8;
1401 return IsWave32 ? 8 : 4;
1405 std::optional<bool> EnableWavefrontSize32) {
1409 bool IsWave32 = EnableWavefrontSize32
1410 ? *EnableWavefrontSize32
1414 return IsWave32 ? 16 : 8;
1416 return IsWave32 ? 8 : 4;
1428 return IsWave32 ? 1536 : 768;
1429 return IsWave32 ? 1024 : 512;
1434 if (Features.test(Feature1024AddressableVGPRs))
1435 return Features.
test(FeatureWavefrontSize32) ? 1024 : 512;
1440 unsigned DynamicVGPRBlockSize) {
1442 if (Features.test(FeatureGFX90AInsts))
1445 if (DynamicVGPRBlockSize != 0)
1453 unsigned DynamicVGPRBlockSize) {
1461 unsigned TotalNumVGPRs) {
1462 if (NumVGPRs < Granule)
1464 unsigned RoundedRegs =
alignTo(NumVGPRs, Granule);
1465 return std::min(std::max(TotalNumVGPRs / RoundedRegs, 1u), MaxWaves);
1496 unsigned DynamicVGPRBlockSize) {
1503 bool DynamicVGPREnabled = (DynamicVGPRBlockSize != 0);
1504 if (DynamicVGPREnabled)
1508 if (WavesPerEU >= MaxWavesPerEU)
1512 unsigned AddrsableNumVGPRs =
1515 unsigned MaxNumVGPRs =
alignDown(TotNumVGPRs / WavesPerEU, Granule);
1517 if (MaxNumVGPRs ==
alignDown(TotNumVGPRs / MaxWavesPerEU, Granule))
1521 DynamicVGPRBlockSize);
1522 if (WavesPerEU < MinWavesPerEU)
1525 unsigned MaxNumVGPRsNext =
alignDown(TotNumVGPRs / (WavesPerEU + 1), Granule);
1526 unsigned MinNumVGPRs = 1 + std::min(MaxNumVGPRs - Granule, MaxNumVGPRsNext);
1527 return std::min(MinNumVGPRs, AddrsableNumVGPRs);
1531 unsigned DynamicVGPRBlockSize) {
1535 bool DynamicVGPREnabled = (DynamicVGPRBlockSize != 0);
1536 unsigned MaxNumVGPRs =
1541 unsigned AddressableNumVGPRs =
1543 return std::min(MaxNumVGPRs, AddressableNumVGPRs);
1547 std::optional<bool> EnableWavefrontSize32) {
1555 unsigned DynamicVGPRBlockSize,
1556 std::optional<bool> EnableWavefrontSize32) {
1616 return C ==
'v' ||
C ==
's' ||
C ==
'a';
1625 if (
RegName.consume_front(
"[")) {
1632 unsigned NumRegs = End - Idx + 1;
1634 return {Kind, Idx, NumRegs};
1640 return {Kind, Idx, 1};
1646std::tuple<char, unsigned, unsigned>
1654std::pair<unsigned, unsigned>
1656 std::pair<unsigned, unsigned>
Default,
1657 bool OnlyFirstRequired) {
1659 return {Attr->first, Attr->second.value_or(
Default.second)};
1663std::optional<std::pair<unsigned, std::optional<unsigned>>>
1665 bool OnlyFirstRequired) {
1667 if (!
A.isStringAttribute())
1668 return std::nullopt;
1671 std::pair<unsigned, std::optional<unsigned>> Ints;
1672 std::pair<StringRef, StringRef> Strs =
A.getValueAsString().split(
',');
1673 if (Strs.first.trim().getAsInteger(0, Ints.first)) {
1674 Ctx.emitError(
"can't parse first integer attribute " + Name);
1675 return std::nullopt;
1677 unsigned Second = 0;
1678 if (Strs.second.trim().getAsInteger(0, Second)) {
1679 if (!OnlyFirstRequired || !Strs.second.trim().empty()) {
1680 Ctx.emitError(
"can't parse second integer attribute " + Name);
1681 return std::nullopt;
1684 Ints.second = Second;
1692 unsigned DefaultVal) {
1693 std::optional<SmallVector<unsigned>> R =
1698std::optional<SmallVector<unsigned>>
1705 return std::nullopt;
1706 if (!
A.isStringAttribute()) {
1707 Ctx.emitError(Name +
" is not a string attribute");
1708 return std::nullopt;
1716 std::pair<StringRef, StringRef> Strs = S.
split(
',');
1718 if (Strs.first.trim().getAsInteger(0, IntVal)) {
1719 Ctx.emitError(
"can't parse integer attribute " + Strs.first +
" in " +
1721 return std::nullopt;
1728 Ctx.emitError(
"attribute " + Name +
1729 " has incorrect number of integers; expected " +
1731 return std::nullopt;
1748 if (
Low.ule(Val) &&
High.ugt(Val))
1751 if (
Low.uge(Val) &&
High.ult(Val))
1760 return (1 << (getVmcntBitWidthLo(
Version.Major) +
1761 getVmcntBitWidthHi(
Version.Major))) -
1766 return (1 << getLoadcntBitWidth(
Version.Major)) - 1;
1770 return (1 << getSamplecntBitWidth(
Version.Major)) - 1;
1774 return (1 << getBvhcntBitWidth(
Version.Major)) - 1;
1778 return (1 << getExpcntBitWidth(
Version.Major)) - 1;
1782 return (1 << getLgkmcntBitWidth(
Version.Major)) - 1;
1786 return (1 << getDscntBitWidth(
Version.Major)) - 1;
1790 return (1 << getKmcntBitWidth(
Version.Major)) - 1;
1798 return (1 << getAsynccntBitWidth(
Version.Major,
Version.Minor)) - 1;
1802 return (1 << getStorecntBitWidth(
Version.Major)) - 1;
1806 bool HasExtendedWaitCounts =
IV.Major >= 12;
1807 if (HasExtendedWaitCounts) {
1826 unsigned VmcntLo = getBitMask(getVmcntBitShiftLo(
Version.Major),
1827 getVmcntBitWidthLo(
Version.Major));
1828 unsigned Expcnt = getBitMask(getExpcntBitShift(
Version.Major),
1829 getExpcntBitWidth(
Version.Major));
1830 unsigned Lgkmcnt = getBitMask(getLgkmcntBitShift(
Version.Major),
1831 getLgkmcntBitWidth(
Version.Major));
1832 unsigned VmcntHi = getBitMask(getVmcntBitShiftHi(
Version.Major),
1833 getVmcntBitWidthHi(
Version.Major));
1834 return VmcntLo | Expcnt | Lgkmcnt | VmcntHi;
1838 unsigned VmcntLo = unpackBits(
Waitcnt, getVmcntBitShiftLo(
Version.Major),
1839 getVmcntBitWidthLo(
Version.Major));
1840 unsigned VmcntHi = unpackBits(
Waitcnt, getVmcntBitShiftHi(
Version.Major),
1841 getVmcntBitWidthHi(
Version.Major));
1842 return VmcntLo | VmcntHi << getVmcntBitWidthLo(
Version.Major);
1847 getExpcntBitWidth(
Version.Major));
1852 getLgkmcntBitWidth(
Version.Major));
1856 return unpackBits(
Waitcnt, getLoadcntStorecntBitShift(
Version.Major),
1857 getLoadcntBitWidth(
Version.Major));
1861 return unpackBits(
Waitcnt, getLoadcntStorecntBitShift(
Version.Major),
1862 getStorecntBitWidth(
Version.Major));
1867 getDscntBitWidth(
Version.Major));
1871 unsigned &Expcnt,
unsigned &Lgkmcnt) {
1880 getVmcntBitWidthLo(
Version.Major));
1881 return packBits(Vmcnt >> getVmcntBitWidthLo(
Version.Major),
Waitcnt,
1882 getVmcntBitShiftHi(
Version.Major),
1883 getVmcntBitWidthHi(
Version.Major));
1888 return packBits(Expcnt,
Waitcnt, getExpcntBitShift(
Version.Major),
1889 getExpcntBitWidth(
Version.Major));
1894 return packBits(Lgkmcnt,
Waitcnt, getLgkmcntBitShift(
Version.Major),
1895 getLgkmcntBitWidth(
Version.Major));
1899 unsigned Expcnt,
unsigned Lgkmcnt) {
1909 unsigned Dscnt = getBitMask(getDscntBitShift(
Version.Major),
1910 getDscntBitWidth(
Version.Major));
1912 unsigned Storecnt = getBitMask(getLoadcntStorecntBitShift(
Version.Major),
1913 getStorecntBitWidth(
Version.Major));
1914 return Dscnt | Storecnt;
1916 unsigned Loadcnt = getBitMask(getLoadcntStorecntBitShift(
Version.Major),
1917 getLoadcntBitWidth(
Version.Major));
1918 return Dscnt | Loadcnt;
1923 return packBits(Loadcnt,
Waitcnt, getLoadcntStorecntBitShift(
Version.Major),
1924 getLoadcntBitWidth(
Version.Major));
1928 unsigned Storecnt) {
1929 return packBits(Storecnt,
Waitcnt, getLoadcntStorecntBitShift(
Version.Major),
1930 getStorecntBitWidth(
Version.Major));
1936 getDscntBitWidth(
Version.Major));
1963 for (
int Idx = 0; Idx <
Size; ++Idx) {
1964 const auto &
Op = Opr[Idx];
1965 if (
Op.isSupported(STI))
1966 Enc |=
Op.encode(
Op.Default);
1972 int Size,
unsigned Code,
1973 bool &HasNonDefaultVal,
1975 unsigned UsedOprMask = 0;
1976 HasNonDefaultVal =
false;
1977 for (
int Idx = 0; Idx <
Size; ++Idx) {
1978 const auto &
Op = Opr[Idx];
1979 if (!
Op.isSupported(STI))
1981 UsedOprMask |=
Op.getMask();
1982 unsigned Val =
Op.decode(Code);
1983 if (!
Op.isValid(Val))
1985 HasNonDefaultVal |= (Val !=
Op.Default);
1987 return (Code & ~UsedOprMask) == 0;
1991 unsigned Code,
int &Idx,
StringRef &Name,
1992 unsigned &Val,
bool &IsDefault,
1994 while (Idx <
Size) {
1995 const auto &
Op = Opr[Idx++];
1996 if (
Op.isSupported(STI)) {
1998 Val =
Op.decode(Code);
1999 IsDefault = (Val ==
Op.Default);
2009 if (InputVal < 0 || InputVal >
Op.Max)
2011 return Op.encode(InputVal);
2016 unsigned &UsedOprMask,
2019 for (
int Idx = 0; Idx <
Size; ++Idx) {
2020 const auto &
Op = Opr[Idx];
2021 if (
Op.Name == Name) {
2022 if (!
Op.isSupported(STI)) {
2026 auto OprMask =
Op.getMask();
2027 if (OprMask & UsedOprMask)
2029 UsedOprMask |= OprMask;
2052 HasNonDefaultVal, STI);
2084 return unpackBits(Encoded, getVmVsrcBitShift(), getVmVsrcBitWidth());
2088 return unpackBits(Encoded, getVaVdstBitShift(), getVaVdstBitWidth());
2092 return unpackBits(Encoded, getSaSdstBitShift(), getSaSdstBitWidth());
2096 return unpackBits(Encoded, getVaSdstBitShift(), getVaSdstBitWidth());
2100 return unpackBits(Encoded, getVaVccBitShift(), getVaVccBitWidth());
2104 return unpackBits(Encoded, getVaSsrcBitShift(), getVaSsrcBitWidth());
2108 return unpackBits(Encoded, getHoldCntBitShift(),
2113 return packBits(VmVsrc, Encoded, getVmVsrcBitShift(), getVmVsrcBitWidth());
2122 return packBits(VaVdst, Encoded, getVaVdstBitShift(), getVaVdstBitWidth());
2131 return packBits(SaSdst, Encoded, getSaSdstBitShift(), getSaSdstBitWidth());
2140 return packBits(VaSdst, Encoded, getVaSdstBitShift(), getVaSdstBitWidth());
2149 return packBits(VaVcc, Encoded, getVaVccBitShift(), getVaVccBitWidth());
2158 return packBits(VaSsrc, Encoded, getVaSsrcBitShift(), getVaSsrcBitWidth());
2168 return packBits(HoldCnt, Encoded, getHoldCntBitShift(),
2205 if (Val.Tgt <= Id && Id <= Val.Tgt + Val.MaxIndex) {
2206 Index = (Val.MaxIndex == 0) ? -1 : (Id - Val.Tgt);
2217 if (Val.MaxIndex == 0 && Name == Val.Name)
2220 if (Val.MaxIndex > 0 && Name.starts_with(Val.Name)) {
2221 StringRef Suffix = Name.drop_front(Val.Name.size());
2228 if (Suffix.
size() > 1 && Suffix[0] ==
'0')
2231 return Val.Tgt + Id;
2260namespace MTBUFFormat {
2286 if (Name == lookupTable[Id])
2485 return F.getFnAttributeAsParsedInteger(
"InitialPSInputAddr", 0);
2490 return F.getFnAttributeAsParsedInteger(
2491 "amdgpu-color-export",
2496 return F.getFnAttributeAsParsedInteger(
"amdgpu-depth-export", 0) != 0;
2501 F.getFnAttributeAsParsedInteger(
"amdgpu-dynamic-vgpr-block-size", 0);
2514 return STI.
hasFeature(AMDGPU::FeatureMIMG_R128) &&
2527 return !STI.
hasFeature(AMDGPU::FeatureUnpackedD16VMem) && !
isCI(STI) &&
2538 return Version.Minor >= 3 ? 13 : 5;
2542 return HasSampler ? 4 : 5;
2553 return STI.
hasFeature(AMDGPU::FeatureSouthernIslands);
2557 return STI.
hasFeature(AMDGPU::FeatureSeaIslands);
2561 return STI.
hasFeature(AMDGPU::FeatureVolcanicIslands);
2651 return STI.
hasFeature(AMDGPU::FeatureGCN3Encoding);
2655 return STI.
hasFeature(AMDGPU::FeatureGFX10_AEncoding);
2659 return STI.
hasFeature(AMDGPU::FeatureGFX10_BEncoding);
2663 return STI.
hasFeature(AMDGPU::FeatureGFX10_3Insts);
2671 return STI.
hasFeature(AMDGPU::FeatureGFX90AInsts);
2675 return STI.
hasFeature(AMDGPU::FeatureGFX940Insts);
2679 return STI.
hasFeature(AMDGPU::FeatureArchitectedFlatScratch);
2683 return STI.
hasFeature(AMDGPU::FeatureMAIInsts);
2687 return STI.
hasFeature(AMDGPU::FeatureVOPDInsts);
2691 return STI.
hasFeature(AMDGPU::FeatureDPPSrc1SGPR);
2695 return STI.
hasFeature(AMDGPU::FeatureKernargPreload);
2699 int32_t ArgNumVGPR) {
2700 if (has90AInsts && ArgNumAGPR)
2701 return alignTo(ArgNumVGPR, 4) + ArgNumAGPR;
2702 return std::max(ArgNumVGPR, ArgNumAGPR);
2708 return SGPRClass.
contains(FirstSubReg != 0 ? FirstSubReg :
Reg) ||
2716#define MAP_REG2REG \
2717 using namespace AMDGPU; \
2718 switch (Reg.id()) { \
2721 CASE_CI_VI(FLAT_SCR) \
2722 CASE_CI_VI(FLAT_SCR_LO) \
2723 CASE_CI_VI(FLAT_SCR_HI) \
2724 CASE_VI_GFX9PLUS(TTMP0) \
2725 CASE_VI_GFX9PLUS(TTMP1) \
2726 CASE_VI_GFX9PLUS(TTMP2) \
2727 CASE_VI_GFX9PLUS(TTMP3) \
2728 CASE_VI_GFX9PLUS(TTMP4) \
2729 CASE_VI_GFX9PLUS(TTMP5) \
2730 CASE_VI_GFX9PLUS(TTMP6) \
2731 CASE_VI_GFX9PLUS(TTMP7) \
2732 CASE_VI_GFX9PLUS(TTMP8) \
2733 CASE_VI_GFX9PLUS(TTMP9) \
2734 CASE_VI_GFX9PLUS(TTMP10) \
2735 CASE_VI_GFX9PLUS(TTMP11) \
2736 CASE_VI_GFX9PLUS(TTMP12) \
2737 CASE_VI_GFX9PLUS(TTMP13) \
2738 CASE_VI_GFX9PLUS(TTMP14) \
2739 CASE_VI_GFX9PLUS(TTMP15) \
2740 CASE_VI_GFX9PLUS(TTMP0_TTMP1) \
2741 CASE_VI_GFX9PLUS(TTMP2_TTMP3) \
2742 CASE_VI_GFX9PLUS(TTMP4_TTMP5) \
2743 CASE_VI_GFX9PLUS(TTMP6_TTMP7) \
2744 CASE_VI_GFX9PLUS(TTMP8_TTMP9) \
2745 CASE_VI_GFX9PLUS(TTMP10_TTMP11) \
2746 CASE_VI_GFX9PLUS(TTMP12_TTMP13) \
2747 CASE_VI_GFX9PLUS(TTMP14_TTMP15) \
2748 CASE_VI_GFX9PLUS(TTMP0_TTMP1_TTMP2_TTMP3) \
2749 CASE_VI_GFX9PLUS(TTMP4_TTMP5_TTMP6_TTMP7) \
2750 CASE_VI_GFX9PLUS(TTMP8_TTMP9_TTMP10_TTMP11) \
2751 CASE_VI_GFX9PLUS(TTMP12_TTMP13_TTMP14_TTMP15) \
2752 CASE_VI_GFX9PLUS(TTMP0_TTMP1_TTMP2_TTMP3_TTMP4_TTMP5_TTMP6_TTMP7) \
2753 CASE_VI_GFX9PLUS(TTMP4_TTMP5_TTMP6_TTMP7_TTMP8_TTMP9_TTMP10_TTMP11) \
2754 CASE_VI_GFX9PLUS(TTMP8_TTMP9_TTMP10_TTMP11_TTMP12_TTMP13_TTMP14_TTMP15) \
2756 TTMP0_TTMP1_TTMP2_TTMP3_TTMP4_TTMP5_TTMP6_TTMP7_TTMP8_TTMP9_TTMP10_TTMP11_TTMP12_TTMP13_TTMP14_TTMP15) \
2757 CASE_GFXPRE11_GFX11PLUS(M0) \
2758 CASE_GFXPRE11_GFX11PLUS(SGPR_NULL) \
2759 CASE_GFXPRE11_GFX11PLUS_TO(SGPR_NULL64, SGPR_NULL) \
2762#define CASE_CI_VI(node) \
2763 assert(!isSI(STI)); \
2765 return isCI(STI) ? node##_ci : node##_vi;
2767#define CASE_VI_GFX9PLUS(node) \
2769 return isGFX9Plus(STI) ? node##_gfx9plus : node##_vi;
2771#define CASE_GFXPRE11_GFX11PLUS(node) \
2773 return isGFX11Plus(STI) ? node##_gfx11plus : node##_gfxpre11;
2775#define CASE_GFXPRE11_GFX11PLUS_TO(node, result) \
2777 return isGFX11Plus(STI) ? result##_gfx11plus : result##_gfxpre11;
2786#undef CASE_VI_GFX9PLUS
2787#undef CASE_GFXPRE11_GFX11PLUS
2788#undef CASE_GFXPRE11_GFX11PLUS_TO
2790#define CASE_CI_VI(node) \
2794#define CASE_VI_GFX9PLUS(node) \
2796 case node##_gfx9plus: \
2798#define CASE_GFXPRE11_GFX11PLUS(node) \
2799 case node##_gfx11plus: \
2800 case node##_gfxpre11: \
2802#define CASE_GFXPRE11_GFX11PLUS_TO(node, result)
2808 case AMDGPU::SRC_SHARED_BASE_LO:
2809 case AMDGPU::SRC_SHARED_BASE:
2810 case AMDGPU::SRC_SHARED_LIMIT_LO:
2811 case AMDGPU::SRC_SHARED_LIMIT:
2812 case AMDGPU::SRC_PRIVATE_BASE_LO:
2813 case AMDGPU::SRC_PRIVATE_BASE:
2814 case AMDGPU::SRC_PRIVATE_LIMIT_LO:
2815 case AMDGPU::SRC_PRIVATE_LIMIT:
2816 case AMDGPU::SRC_FLAT_SCRATCH_BASE_LO:
2817 case AMDGPU::SRC_FLAT_SCRATCH_BASE_HI:
2818 case AMDGPU::SRC_POPS_EXITING_WAVE_ID:
2820 case AMDGPU::SRC_VCCZ:
2821 case AMDGPU::SRC_EXECZ:
2822 case AMDGPU::SRC_SCC:
2824 case AMDGPU::SGPR_NULL:
2832#undef CASE_VI_GFX9PLUS
2833#undef CASE_GFXPRE11_GFX11PLUS
2834#undef CASE_GFXPRE11_GFX11PLUS_TO
2839 unsigned OpType =
Desc.operands()[OpNo].OperandType;
2846 unsigned OpType =
Desc.operands()[OpNo].OperandType;
2869 unsigned OpType =
Desc.operands()[OpNo].OperandType;
2880 case AMDGPU::VGPR_16RegClassID:
2881 case AMDGPU::VGPR_16_Lo128RegClassID:
2882 case AMDGPU::SGPR_LO16RegClassID:
2883 case AMDGPU::AGPR_LO16RegClassID:
2885 case AMDGPU::SGPR_32RegClassID:
2886 case AMDGPU::VGPR_32RegClassID:
2887 case AMDGPU::VGPR_32_Lo256RegClassID:
2888 case AMDGPU::VRegOrLds_32RegClassID:
2889 case AMDGPU::AGPR_32RegClassID:
2890 case AMDGPU::VS_32RegClassID:
2891 case AMDGPU::AV_32RegClassID:
2892 case AMDGPU::SReg_32RegClassID:
2893 case AMDGPU::SReg_32_XM0RegClassID:
2894 case AMDGPU::SRegOrLds_32RegClassID:
2896 case AMDGPU::SGPR_64RegClassID:
2897 case AMDGPU::VS_64RegClassID:
2898 case AMDGPU::SReg_64RegClassID:
2899 case AMDGPU::VReg_64RegClassID:
2900 case AMDGPU::AReg_64RegClassID:
2901 case AMDGPU::SReg_64_XEXECRegClassID:
2902 case AMDGPU::VReg_64_Align2RegClassID:
2903 case AMDGPU::AReg_64_Align2RegClassID:
2904 case AMDGPU::AV_64RegClassID:
2905 case AMDGPU::AV_64_Align2RegClassID:
2906 case AMDGPU::VReg_64_Lo256_Align2RegClassID:
2907 case AMDGPU::VS_64_Lo256RegClassID:
2909 case AMDGPU::SGPR_96RegClassID:
2910 case AMDGPU::SReg_96RegClassID:
2911 case AMDGPU::VReg_96RegClassID:
2912 case AMDGPU::AReg_96RegClassID:
2913 case AMDGPU::VReg_96_Align2RegClassID:
2914 case AMDGPU::AReg_96_Align2RegClassID:
2915 case AMDGPU::AV_96RegClassID:
2916 case AMDGPU::AV_96_Align2RegClassID:
2917 case AMDGPU::VReg_96_Lo256_Align2RegClassID:
2919 case AMDGPU::SGPR_128RegClassID:
2920 case AMDGPU::SReg_128RegClassID:
2921 case AMDGPU::VReg_128RegClassID:
2922 case AMDGPU::AReg_128RegClassID:
2923 case AMDGPU::VReg_128_Align2RegClassID:
2924 case AMDGPU::AReg_128_Align2RegClassID:
2925 case AMDGPU::AV_128RegClassID:
2926 case AMDGPU::AV_128_Align2RegClassID:
2927 case AMDGPU::SReg_128_XNULLRegClassID:
2928 case AMDGPU::VReg_128_Lo256_Align2RegClassID:
2930 case AMDGPU::SGPR_160RegClassID:
2931 case AMDGPU::SReg_160RegClassID:
2932 case AMDGPU::VReg_160RegClassID:
2933 case AMDGPU::AReg_160RegClassID:
2934 case AMDGPU::VReg_160_Align2RegClassID:
2935 case AMDGPU::AReg_160_Align2RegClassID:
2936 case AMDGPU::AV_160RegClassID:
2937 case AMDGPU::AV_160_Align2RegClassID:
2938 case AMDGPU::VReg_160_Lo256_Align2RegClassID:
2940 case AMDGPU::SGPR_192RegClassID:
2941 case AMDGPU::SReg_192RegClassID:
2942 case AMDGPU::VReg_192RegClassID:
2943 case AMDGPU::AReg_192RegClassID:
2944 case AMDGPU::VReg_192_Align2RegClassID:
2945 case AMDGPU::AReg_192_Align2RegClassID:
2946 case AMDGPU::AV_192RegClassID:
2947 case AMDGPU::AV_192_Align2RegClassID:
2948 case AMDGPU::VReg_192_Lo256_Align2RegClassID:
2950 case AMDGPU::SGPR_224RegClassID:
2951 case AMDGPU::SReg_224RegClassID:
2952 case AMDGPU::VReg_224RegClassID:
2953 case AMDGPU::AReg_224RegClassID:
2954 case AMDGPU::VReg_224_Align2RegClassID:
2955 case AMDGPU::AReg_224_Align2RegClassID:
2956 case AMDGPU::AV_224RegClassID:
2957 case AMDGPU::AV_224_Align2RegClassID:
2958 case AMDGPU::VReg_224_Lo256_Align2RegClassID:
2960 case AMDGPU::SGPR_256RegClassID:
2961 case AMDGPU::SReg_256RegClassID:
2962 case AMDGPU::VReg_256RegClassID:
2963 case AMDGPU::AReg_256RegClassID:
2964 case AMDGPU::VReg_256_Align2RegClassID:
2965 case AMDGPU::AReg_256_Align2RegClassID:
2966 case AMDGPU::AV_256RegClassID:
2967 case AMDGPU::AV_256_Align2RegClassID:
2968 case AMDGPU::SReg_256_XNULLRegClassID:
2969 case AMDGPU::VReg_256_Lo256_Align2RegClassID:
2971 case AMDGPU::SGPR_288RegClassID:
2972 case AMDGPU::SReg_288RegClassID:
2973 case AMDGPU::VReg_288RegClassID:
2974 case AMDGPU::AReg_288RegClassID:
2975 case AMDGPU::VReg_288_Align2RegClassID:
2976 case AMDGPU::AReg_288_Align2RegClassID:
2977 case AMDGPU::AV_288RegClassID:
2978 case AMDGPU::AV_288_Align2RegClassID:
2979 case AMDGPU::VReg_288_Lo256_Align2RegClassID:
2981 case AMDGPU::SGPR_320RegClassID:
2982 case AMDGPU::SReg_320RegClassID:
2983 case AMDGPU::VReg_320RegClassID:
2984 case AMDGPU::AReg_320RegClassID:
2985 case AMDGPU::VReg_320_Align2RegClassID:
2986 case AMDGPU::AReg_320_Align2RegClassID:
2987 case AMDGPU::AV_320RegClassID:
2988 case AMDGPU::AV_320_Align2RegClassID:
2989 case AMDGPU::VReg_320_Lo256_Align2RegClassID:
2991 case AMDGPU::SGPR_352RegClassID:
2992 case AMDGPU::SReg_352RegClassID:
2993 case AMDGPU::VReg_352RegClassID:
2994 case AMDGPU::AReg_352RegClassID:
2995 case AMDGPU::VReg_352_Align2RegClassID:
2996 case AMDGPU::AReg_352_Align2RegClassID:
2997 case AMDGPU::AV_352RegClassID:
2998 case AMDGPU::AV_352_Align2RegClassID:
2999 case AMDGPU::VReg_352_Lo256_Align2RegClassID:
3001 case AMDGPU::SGPR_384RegClassID:
3002 case AMDGPU::SReg_384RegClassID:
3003 case AMDGPU::VReg_384RegClassID:
3004 case AMDGPU::AReg_384RegClassID:
3005 case AMDGPU::VReg_384_Align2RegClassID:
3006 case AMDGPU::AReg_384_Align2RegClassID:
3007 case AMDGPU::AV_384RegClassID:
3008 case AMDGPU::AV_384_Align2RegClassID:
3009 case AMDGPU::VReg_384_Lo256_Align2RegClassID:
3011 case AMDGPU::SGPR_512RegClassID:
3012 case AMDGPU::SReg_512RegClassID:
3013 case AMDGPU::VReg_512RegClassID:
3014 case AMDGPU::AReg_512RegClassID:
3015 case AMDGPU::VReg_512_Align2RegClassID:
3016 case AMDGPU::AReg_512_Align2RegClassID:
3017 case AMDGPU::AV_512RegClassID:
3018 case AMDGPU::AV_512_Align2RegClassID:
3019 case AMDGPU::VReg_512_Lo256_Align2RegClassID:
3021 case AMDGPU::SGPR_1024RegClassID:
3022 case AMDGPU::SReg_1024RegClassID:
3023 case AMDGPU::VReg_1024RegClassID:
3024 case AMDGPU::AReg_1024RegClassID:
3025 case AMDGPU::VReg_1024_Align2RegClassID:
3026 case AMDGPU::AReg_1024_Align2RegClassID:
3027 case AMDGPU::AV_1024RegClassID:
3028 case AMDGPU::AV_1024_Align2RegClassID:
3029 case AMDGPU::VReg_1024_Lo256_Align2RegClassID:
3054 (Val == 0x3fc45f306dc9c882 && HasInv2Pi);
3080 (Val == 0x3e22f983 && HasInv2Pi);
3089 return Val == 0x3F00 ||
3110 return Val == 0x3C00 ||
3137 return 192 + std::abs(
Signed);
3142 case 0x3800:
return 240;
3143 case 0xB800:
return 241;
3144 case 0x3C00:
return 242;
3145 case 0xBC00:
return 243;
3146 case 0x4000:
return 244;
3147 case 0xC000:
return 245;
3148 case 0x4400:
return 246;
3149 case 0xC400:
return 247;
3150 case 0x3118:
return 248;
3157 case 0x3F000000:
return 240;
3158 case 0xBF000000:
return 241;
3159 case 0x3F800000:
return 242;
3160 case 0xBF800000:
return 243;
3161 case 0x40000000:
return 244;
3162 case 0xC0000000:
return 245;
3163 case 0x40800000:
return 246;
3164 case 0xC0800000:
return 247;
3165 case 0x3E22F983:
return 248;
3188 return 192 + std::abs(
Signed);
3192 case 0x3F00:
return 240;
3193 case 0xBF00:
return 241;
3194 case 0x3F80:
return 242;
3195 case 0xBF80:
return 243;
3196 case 0x4000:
return 244;
3197 case 0xC000:
return 245;
3198 case 0x4080:
return 246;
3199 case 0xC080:
return 247;
3200 case 0x3E22:
return 248;
3205 return std::nullopt;
3232 return 192 + std::abs(
Signed);
3238 return std::nullopt;
3298 return Imm & 0xffff;
3340 return A->hasAttribute(Attribute::InReg) ||
3341 A->hasAttribute(Attribute::ByVal);
3344 return A->hasAttribute(Attribute::InReg);
3379 int64_t EncodedOffset) {
3388 int64_t EncodedOffset,
bool IsBuffer) {
3390 if (IsBuffer && EncodedOffset < 0)
3399 return (ByteOffset & 3) == 0;
3408 return ByteOffset >> 2;
3412 int64_t ByteOffset,
bool IsBuffer,
3418 return std::nullopt;
3421 return isInt<24>(ByteOffset) ? std::optional<int64_t>(ByteOffset)
3427 return isInt<20>(ByteOffset) ? std::optional<int64_t>(ByteOffset)
3432 return std::nullopt;
3436 ? std::optional<int64_t>(EncodedOffset)
3441 int64_t ByteOffset) {
3443 return std::nullopt;
3446 return isUInt<32>(EncodedOffset) ? std::optional<int64_t>(EncodedOffset)
3451 if (ST.getFeatureBits().test(FeatureFlatOffsetBits12))
3453 if (ST.getFeatureBits().test(FeatureFlatOffsetBits24))
3460struct SourceOfDivergence {
3463const SourceOfDivergence *lookupSourceOfDivergence(
unsigned Intr);
3468const AlwaysUniform *lookupAlwaysUniform(
unsigned Intr);
3470#define GET_SourcesOfDivergence_IMPL
3471#define GET_UniformIntrinsics_IMPL
3472#define GET_Gfx9BufferFormat_IMPL
3473#define GET_Gfx10BufferFormat_IMPL
3474#define GET_Gfx11PlusBufferFormat_IMPL
3476#include "AMDGPUGenSearchableTables.inc"
3481 return lookupSourceOfDivergence(IntrID);
3485 return lookupAlwaysUniform(IntrID);
3492 return isGFX11Plus(STI) ? getGfx11PlusBufferFormatInfo(
3493 BitsPerComp, NumComponents, NumFormat)
3495 ? getGfx10BufferFormatInfo(BitsPerComp, NumComponents, NumFormat)
3496 : getGfx9BufferFormatInfo(BitsPerComp, NumComponents, NumFormat);
3503 : getGfx9BufferFormatInfo(
Format);
3508 const unsigned VGPRClasses[] = {
3509 AMDGPU::VGPR_16RegClassID, AMDGPU::VGPR_32RegClassID,
3510 AMDGPU::VReg_64RegClassID, AMDGPU::VReg_96RegClassID,
3511 AMDGPU::VReg_128RegClassID, AMDGPU::VReg_160RegClassID,
3512 AMDGPU::VReg_192RegClassID, AMDGPU::VReg_224RegClassID,
3513 AMDGPU::VReg_256RegClassID, AMDGPU::VReg_288RegClassID,
3514 AMDGPU::VReg_320RegClassID, AMDGPU::VReg_352RegClassID,
3515 AMDGPU::VReg_384RegClassID, AMDGPU::VReg_512RegClassID,
3516 AMDGPU::VReg_1024RegClassID};
3518 for (
unsigned RCID : VGPRClasses) {
3545 if (RC->
getID() == AMDGPU::VGPR_16RegClassID) {
3555static std::optional<unsigned>
3557 bool HasSetregVGPRMSBFixup) {
3558 constexpr unsigned VGPRMSBShift =
3563 (!HasSetregVGPRMSBFixup && (
Offset +
Size) < VGPRMSBShift))
3566 if (!HasSetregVGPRMSBFixup)
3569 if (!HasSetregVGPRMSBFixup)
3575 bool HasSetregVGPRMSBFixup) {
3576 assert(
MI.getOpcode() == AMDGPU::S_SETREG_IMM32_B32);
3578 MI.getOperand(1).getImm(),
3579 HasSetregVGPRMSBFixup);
3583 bool HasSetregVGPRMSBFixup) {
3584 assert(
MI.getOpcode() == AMDGPU::S_SETREG_IMM32_B32_gfx12);
3586 MI.getOperand(1).getImm(),
3587 HasSetregVGPRMSBFixup);
3590std::pair<const AMDGPU::OpName *, const AMDGPU::OpName *>
3592 static const AMDGPU::OpName VOPOps[4] = {
3593 AMDGPU::OpName::src0, AMDGPU::OpName::src1, AMDGPU::OpName::src2,
3594 AMDGPU::OpName::vdst};
3595 static const AMDGPU::OpName VDSOps[4] = {
3596 AMDGPU::OpName::addr, AMDGPU::OpName::data0, AMDGPU::OpName::data1,
3597 AMDGPU::OpName::vdst};
3598 static const AMDGPU::OpName FLATOps[4] = {
3599 AMDGPU::OpName::vaddr, AMDGPU::OpName::vdata,
3600 AMDGPU::OpName::NUM_OPERAND_NAMES, AMDGPU::OpName::vdst};
3601 static const AMDGPU::OpName BUFOps[4] = {
3602 AMDGPU::OpName::vaddr, AMDGPU::OpName::NUM_OPERAND_NAMES,
3603 AMDGPU::OpName::NUM_OPERAND_NAMES, AMDGPU::OpName::vdata};
3604 static const AMDGPU::OpName VIMGOps[4] = {
3605 AMDGPU::OpName::vaddr0, AMDGPU::OpName::vaddr1, AMDGPU::OpName::vaddr2,
3606 AMDGPU::OpName::vdata};
3611 static const AMDGPU::OpName VOPDOpsX[4] = {
3612 AMDGPU::OpName::src0X, AMDGPU::OpName::vsrc1X, AMDGPU::OpName::vsrc2X,
3613 AMDGPU::OpName::vdstX};
3614 static const AMDGPU::OpName VOPDOpsY[4] = {
3615 AMDGPU::OpName::src0Y, AMDGPU::OpName::vsrc1Y, AMDGPU::OpName::vsrc2Y,
3616 AMDGPU::OpName::vdstY};
3619 static const AMDGPU::OpName VOP2MADMKOps[4] = {
3620 AMDGPU::OpName::src0, AMDGPU::OpName::NUM_OPERAND_NAMES,
3621 AMDGPU::OpName::src1, AMDGPU::OpName::vdst};
3622 static const AMDGPU::OpName VOPDFMAMKOpsX[4] = {
3623 AMDGPU::OpName::src0X, AMDGPU::OpName::NUM_OPERAND_NAMES,
3624 AMDGPU::OpName::vsrc1X, AMDGPU::OpName::vdstX};
3625 static const AMDGPU::OpName VOPDFMAMKOpsY[4] = {
3626 AMDGPU::OpName::src0Y, AMDGPU::OpName::NUM_OPERAND_NAMES,
3627 AMDGPU::OpName::vsrc1Y, AMDGPU::OpName::vdstY};
3629 unsigned TSFlags =
Desc.TSFlags;
3634 switch (
Desc.getOpcode()) {
3636 case AMDGPU::V_WMMA_LD_SCALE_PAIRED_B32:
3637 case AMDGPU::V_WMMA_LD_SCALE_PAIRED_B32_gfx1250:
3638 case AMDGPU::V_WMMA_LD_SCALE16_PAIRED_B64:
3639 case AMDGPU::V_WMMA_LD_SCALE16_PAIRED_B64_gfx1250:
3641 case AMDGPU::V_FMAMK_F16:
3642 case AMDGPU::V_FMAMK_F16_t16:
3643 case AMDGPU::V_FMAMK_F16_t16_gfx12:
3644 case AMDGPU::V_FMAMK_F16_fake16:
3645 case AMDGPU::V_FMAMK_F16_fake16_gfx12:
3646 case AMDGPU::V_FMAMK_F32:
3647 case AMDGPU::V_FMAMK_F32_gfx12:
3648 case AMDGPU::V_FMAMK_F64:
3649 case AMDGPU::V_FMAMK_F64_gfx1250:
3650 return {VOP2MADMKOps,
nullptr};
3654 return {VOPOps,
nullptr};
3658 return {VDSOps,
nullptr};
3661 return {FLATOps,
nullptr};
3664 return {BUFOps,
nullptr};
3667 return {VIMGOps,
nullptr};
3671 return {(OpX == AMDGPU::V_FMAMK_F32) ? VOPDFMAMKOpsX : VOPDOpsX,
3672 (OpY == AMDGPU::V_FMAMK_F32) ? VOPDFMAMKOpsY : VOPDOpsY};
3679 " these instructions are not expected on gfx1250");
3705 for (
auto OpName : {OpName::vdst, OpName::src0, OpName::src1, OpName::src2}) {
3713 if (RegClass == AMDGPU::VReg_64RegClassID ||
3714 RegClass == AMDGPU::VReg_64_Align2RegClassID)
3723 case AMDGPU::V_MUL_LO_U32_e64:
3724 case AMDGPU::V_MUL_LO_U32_e64_dpp:
3725 case AMDGPU::V_MUL_LO_U32_e64_dpp_gfx1250:
3726 case AMDGPU::V_MUL_HI_U32_e64:
3727 case AMDGPU::V_MUL_HI_U32_e64_dpp:
3728 case AMDGPU::V_MUL_HI_U32_e64_dpp_gfx1250:
3729 case AMDGPU::V_MUL_HI_I32_e64:
3730 case AMDGPU::V_MUL_HI_I32_e64_dpp:
3731 case AMDGPU::V_MUL_HI_I32_e64_dpp_gfx1250:
3732 case AMDGPU::V_MAD_U32_e64:
3733 case AMDGPU::V_MAD_U32_e64_dpp:
3734 case AMDGPU::V_MAD_U32_e64_dpp_gfx1250:
3743 if (!ST.hasFeature(AMDGPU::FeatureDPALU_DPP))
3747 return ST.hasFeature(AMDGPU::FeatureGFX1250Insts);
3753 if (ST.getFeatureBits().test(FeatureAddressableLocalMemorySize32768))
3755 if (ST.getFeatureBits().test(FeatureAddressableLocalMemorySize65536))
3757 if (ST.getFeatureBits().test(FeatureAddressableLocalMemorySize163840))
3759 if (ST.getFeatureBits().test(FeatureAddressableLocalMemorySize327680))
3766 case AMDGPU::V_PK_ADD_F32:
3767 case AMDGPU::V_PK_ADD_F32_gfx12:
3768 case AMDGPU::V_PK_MUL_F32:
3769 case AMDGPU::V_PK_MUL_F32_gfx12:
3770 case AMDGPU::V_PK_FMA_F32:
3771 case AMDGPU::V_PK_FMA_F32_gfx12:
3791 OS << EncoNoCluster <<
',' << EncoNoCluster <<
',' << EncoNoCluster;
3792 return Buffer.
c_str();
3795 OS << EncoVariableDims <<
',' << EncoVariableDims <<
','
3796 << EncoVariableDims;
3797 return Buffer.
c_str();
3800 OS << Dims[0] <<
',' << Dims[1] <<
',' << Dims[2];
3801 return Buffer.
c_str();
3808 std::optional<SmallVector<unsigned>> Attr =
3812 if (!Attr.has_value())
3821 A.Dims = {(*Attr)[0], (*Attr)[1], (*Attr)[2]};
3832 OS <<
"Unsupported";
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static llvm::cl::opt< unsigned > DefaultAMDHSACodeObjectVersion("amdhsa-code-object-version", llvm::cl::Hidden, llvm::cl::init(llvm::AMDGPU::AMDHSA_COV6), llvm::cl::desc("Set default AMDHSA Code Object Version (module flag " "or asm directive still take priority if present)"))
Provides AMDGPU specific target descriptions.
MC layer struct for AMDGPUMCKernelCodeT, provides MCExpr functionality where required.
@ AMD_CODE_PROPERTY_ENABLE_WAVEFRONT_SIZE32
This file contains the simple types necessary to represent the attributes associated with functions a...
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Register const TargetRegisterInfo * TRI
#define S_00B848_MEM_ORDERED(x)
#define S_00B848_WGP_MODE(x)
#define S_00B848_FWD_PROGRESS(x)
static const int BlockSize
static const uint32_t IV[8]
static ClusterDimsAttr get(const Function &F)
ClusterDimsAttr()=default
std::string to_string() const
const std::array< unsigned, 3 > & getDims() const
bool isSramEccSupported() const
void setTargetIDFromFeaturesString(StringRef FS)
TargetIDSetting getXnackSetting() const
void print(raw_ostream &OS) const
Write string representation to OS.
AMDGPUTargetID(const MCSubtargetInfo &STI)
bool isXnackSupported() const
void setTargetIDFromTargetIDStream(StringRef TargetID)
std::string toString() const
TargetIDSetting getSramEccSetting() const
unsigned getIndexInParsedOperands(unsigned CompOprIdx) const
unsigned getIndexOfDstInParsedOperands() const
unsigned getIndexOfSrcInParsedOperands(unsigned CompSrcIdx) const
int getBitOp3OperandIdx() const
unsigned getCompParsedSrcOperandsNum() const
std::optional< unsigned > getInvalidCompOperandIndex(std::function< MCRegister(unsigned, unsigned)> GetRegIdx, const MCRegisterInfo &MRI, bool SkipSrc=false, bool AllowSameVGPR=false, bool VOPD3=false) const
std::array< MCRegister, Component::MAX_OPR_NUM > RegIndices
Represents the counter values to wait for in an s_waitcnt instruction.
This class represents an incoming formal argument to a Function.
Functions, function parameters, and return types can have attributes to indicate how they should be t...
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
CallingConv::ID getCallingConv() const
LLVM_ABI bool paramHasAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Determine whether the argument or parameter has the given attribute.
constexpr bool test(unsigned I) const
unsigned getAddressSpace() const
This is an important class for using LLVM in a threaded context.
Instances of this class represent a single low-level machine instruction.
Describe properties that are true of each instruction in the target description file.
unsigned getNumOperands() const
Return the number of declared MachineOperands for this MachineInstruction.
ArrayRef< MCOperandInfo > operands() const
bool mayStore() const
Return true if this instruction could possibly modify memory.
bool mayLoad() const
Return true if this instruction could possibly read memory.
unsigned getNumDefs() const
Return the number of MachineOperands that are register definitions.
int getOperandConstraint(unsigned OpNum, MCOI::OperandConstraint Constraint) const
Returns the value of the specified operand constraint if it is present.
unsigned getOpcode() const
Return the opcode number for this descriptor.
Interface to description of machine instruction set.
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode.
int16_t getOpRegClassID(const MCOperandInfo &OpInfo, unsigned HwModeId) const
Return the ID of the register class to use for OpInfo, for the active HwMode HwModeId.
This holds information about one operand of a machine instruction, indicating the register class for ...
MCRegisterClass - Base class of TargetRegisterClass.
unsigned getID() const
getID() - Return the register class ID number.
MCRegister getRegister(unsigned i) const
getRegister - Return the specified register in the class.
bool contains(MCRegister Reg) const
contains - Return true if the specified register is included in this register class.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
bool regsOverlap(MCRegister RegA, MCRegister RegB) const
Returns true if the two registers are equal or alias each other.
uint16_t getEncodingValue(MCRegister Reg) const
Returns the encoding for Reg.
const MCRegisterClass & getRegClass(unsigned i) const
Returns the register class associated with the enumeration value.
MCRegister getSubReg(MCRegister Reg, unsigned Idx) const
Returns the physical register number of sub-register "Index" for physical register RegNo.
Wrapper class representing physical registers. Should be passed by value.
constexpr unsigned id() const
Generic base class for all target subtargets.
bool hasFeature(unsigned Feature) const
const Triple & getTargetTriple() const
const FeatureBitset & getFeatureBits() const
const MDOperand & getOperand(unsigned I) const
unsigned getNumOperands() const
Return number of MDNode operands.
Representation of each machine instruction.
A Module instance is used to store all the information related to an LLVM module.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
StringRef - Represent a constant reference to a string, i.e.
std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
bool getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
std::string str() const
str - Get the contents as an std::string.
constexpr bool empty() const
empty - Check if the string is empty.
constexpr size_t size() const
size - Get the string size.
bool ends_with(StringRef Suffix) const
Check if this string ends with the given Suffix.
Manages the enabling and disabling of subtarget specific features.
const std::vector< std::string > & getFeatures() const
Returns the vector of individual subtarget features.
Triple - Helper class for working with autoconf configuration names.
LLVM_ABI StringRef getVendorName() const
Get the vendor (second) component of the triple.
LLVM_ABI StringRef getOSName() const
Get the operating system (third) component of the triple.
OSType getOS() const
Get the parsed operating system type of this triple.
ArchType getArch() const
Get the parsed architecture type of this triple.
LLVM_ABI StringRef getEnvironmentName() const
Get the optional environment (fourth) component of the triple, or "" if empty.
bool isAMDGCN() const
Tests whether the target is AMDGCN.
LLVM_ABI StringRef getArchName() const
Get the architecture (first) component of the triple.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
This class implements an extremely fast bulk output stream that can only output to a stream.
A raw_ostream that writes to an std::string.
A raw_ostream that writes to an SmallVector or SmallString.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ CONSTANT_ADDRESS_32BIT
Address space for 32-bit constant memory.
@ LOCAL_ADDRESS
Address space for local memory.
@ CONSTANT_ADDRESS
Address space for constant memory (VTX2).
@ GLOBAL_ADDRESS
Address space for global memory (RAT0, VTX0).
unsigned decodeFieldVaVcc(unsigned Encoded)
unsigned encodeFieldVaVcc(unsigned Encoded, unsigned VaVcc)
unsigned decodeFieldHoldCnt(unsigned Encoded, const IsaVersion &Version)
unsigned getVaVccBitMask()
bool decodeDepCtr(unsigned Code, int &Id, StringRef &Name, unsigned &Val, bool &IsDefault, const MCSubtargetInfo &STI)
unsigned encodeFieldHoldCnt(unsigned Encoded, unsigned HoldCnt, const IsaVersion &Version)
unsigned getVmVsrcBitMask()
unsigned encodeFieldVaSsrc(unsigned Encoded, unsigned VaSsrc)
unsigned encodeFieldVaVdst(unsigned Encoded, unsigned VaVdst)
unsigned decodeFieldSaSdst(unsigned Encoded)
unsigned getHoldCntBitMask(const IsaVersion &Version)
unsigned decodeFieldVaSdst(unsigned Encoded)
unsigned getVaVdstBitMask()
unsigned getVaSsrcBitMask()
unsigned encodeFieldVmVsrc(unsigned Encoded, unsigned VmVsrc)
unsigned getVaSdstBitMask()
unsigned decodeFieldVaSsrc(unsigned Encoded)
int encodeDepCtr(const StringRef Name, int64_t Val, unsigned &UsedOprMask, const MCSubtargetInfo &STI)
unsigned encodeFieldSaSdst(unsigned Encoded, unsigned SaSdst)
const CustomOperandVal DepCtrInfo[]
bool isSymbolicDepCtrEncoding(unsigned Code, bool &HasNonDefaultVal, const MCSubtargetInfo &STI)
unsigned decodeFieldVaVdst(unsigned Encoded)
unsigned getSaSdstBitMask()
int getDefaultDepCtrEncoding(const MCSubtargetInfo &STI)
unsigned decodeFieldVmVsrc(unsigned Encoded)
unsigned encodeFieldVaSdst(unsigned Encoded, unsigned VaSdst)
bool isSupportedTgtId(unsigned Id, const MCSubtargetInfo &STI)
static constexpr ExpTgt ExpTgtInfo[]
bool getTgtName(unsigned Id, StringRef &Name, int &Index)
unsigned getTgtId(const StringRef Name)
@ ET_DUAL_SRC_BLEND_MAX_IDX
constexpr uint32_t VersionMinor
HSA metadata minor version.
constexpr uint32_t VersionMajor
HSA metadata major version.
@ COMPLETION_ACTION_OFFSET
@ MULTIGRID_SYNC_ARG_OFFSET
unsigned getVGPREncodingGranule(const MCSubtargetInfo *STI, std::optional< bool > EnableWavefrontSize32)
@ FIXED_NUM_SGPRS_FOR_INIT_BUG
unsigned getTotalNumVGPRs(const MCSubtargetInfo *STI)
unsigned getArchVGPRAllocGranule()
For subtargets with a unified VGPR file and mixed ArchVGPR/AGPR usage, returns the allocation granule...
unsigned getWavesPerEUForWorkGroup(const MCSubtargetInfo *STI, unsigned FlatWorkGroupSize)
unsigned getWavefrontSize(const MCSubtargetInfo *STI)
unsigned getNumWavesPerEUWithNumVGPRs(const MCSubtargetInfo *STI, unsigned NumVGPRs, unsigned DynamicVGPRBlockSize)
unsigned getMaxWorkGroupsPerCU(const MCSubtargetInfo *STI, unsigned FlatWorkGroupSize)
unsigned getMaxWavesPerEU(const MCSubtargetInfo *STI)
unsigned getWavesPerWorkGroup(const MCSubtargetInfo *STI, unsigned FlatWorkGroupSize)
unsigned getNumExtraSGPRs(const MCSubtargetInfo *STI, bool VCCUsed, bool FlatScrUsed, bool XNACKUsed)
unsigned getSGPREncodingGranule(const MCSubtargetInfo *STI)
unsigned getLocalMemorySize(const MCSubtargetInfo *STI)
unsigned getAddressableLocalMemorySize(const MCSubtargetInfo *STI)
unsigned getEUsPerCU(const MCSubtargetInfo *STI)
unsigned getAddressableNumSGPRs(const MCSubtargetInfo *STI)
unsigned getMinNumSGPRs(const MCSubtargetInfo *STI, unsigned WavesPerEU)
static TargetIDSetting getTargetIDSettingFromFeatureString(StringRef FeatureString)
unsigned getMinFlatWorkGroupSize(const MCSubtargetInfo *STI)
unsigned getVGPRAllocGranule(const MCSubtargetInfo *STI, unsigned DynamicVGPRBlockSize, std::optional< bool > EnableWavefrontSize32)
unsigned getMaxNumSGPRs(const MCSubtargetInfo *STI, unsigned WavesPerEU, bool Addressable)
unsigned getNumSGPRBlocks(const MCSubtargetInfo *STI, unsigned NumSGPRs)
unsigned getMinWavesPerEU(const MCSubtargetInfo *STI)
unsigned getMaxNumVGPRs(const MCSubtargetInfo *STI, unsigned WavesPerEU, unsigned DynamicVGPRBlockSize)
unsigned getSGPRAllocGranule(const MCSubtargetInfo *STI)
unsigned getMinNumVGPRs(const MCSubtargetInfo *STI, unsigned WavesPerEU, unsigned DynamicVGPRBlockSize)
unsigned getAllocatedNumVGPRBlocks(const MCSubtargetInfo *STI, unsigned NumVGPRs, unsigned DynamicVGPRBlockSize, std::optional< bool > EnableWavefrontSize32)
unsigned getEncodedNumVGPRBlocks(const MCSubtargetInfo *STI, unsigned NumVGPRs, std::optional< bool > EnableWavefrontSize32)
unsigned getOccupancyWithNumSGPRs(unsigned SGPRs, unsigned MaxWaves, AMDGPUSubtarget::Generation Gen)
static unsigned getGranulatedNumRegisterBlocks(unsigned NumRegs, unsigned Granule)
unsigned getAddressableNumArchVGPRs(const MCSubtargetInfo *STI)
unsigned getTotalNumSGPRs(const MCSubtargetInfo *STI)
unsigned getAddressableNumVGPRs(const MCSubtargetInfo *STI, unsigned DynamicVGPRBlockSize)
uint64_t encodeMsg(uint64_t MsgId, uint64_t OpId, uint64_t StreamId)
@ ID_DEALLOC_VGPRS_GFX11Plus
bool msgSupportsStream(int64_t MsgId, int64_t OpId, const MCSubtargetInfo &STI)
void decodeMsg(unsigned Val, uint16_t &MsgId, uint16_t &OpId, uint16_t &StreamId, const MCSubtargetInfo &STI)
bool isValidMsgId(int64_t MsgId, const MCSubtargetInfo &STI)
bool isValidMsgStream(int64_t MsgId, int64_t OpId, int64_t StreamId, const MCSubtargetInfo &STI, bool Strict)
bool msgDoesNotUseM0(int64_t MsgId, const MCSubtargetInfo &STI)
Returns true if the message does not use the m0 operand.
StringRef getMsgOpName(int64_t MsgId, uint64_t Encoding, const MCSubtargetInfo &STI)
Map from an encoding to the symbolic name for a sendmsg operation.
static uint64_t getMsgIdMask(const MCSubtargetInfo &STI)
bool msgRequiresOp(int64_t MsgId, const MCSubtargetInfo &STI)
bool isValidMsgOp(int64_t MsgId, int64_t OpId, const MCSubtargetInfo &STI, bool Strict)
constexpr unsigned VOPD_VGPR_BANK_MASKS[]
constexpr unsigned COMPONENTS_NUM
constexpr unsigned VOPD3_VGPR_BANK_MASKS[]
bool isPackedFP32Inst(unsigned Opc)
bool isGCN3Encoding(const MCSubtargetInfo &STI)
bool isInlinableLiteralBF16(int16_t Literal, bool HasInv2Pi)
bool isGFX10_BEncoding(const MCSubtargetInfo &STI)
bool isInlineValue(MCRegister Reg)
bool isGFX10_GFX11(const MCSubtargetInfo &STI)
bool isInlinableLiteralV216(uint32_t Literal, uint8_t OpType)
bool isPKFMACF16InlineConstant(uint32_t Literal, bool IsGFX11Plus)
LLVM_READONLY const MIMGInfo * getMIMGInfo(unsigned Opc)
bool isInlinableLiteralFP16(int16_t Literal, bool HasInv2Pi)
bool isSGPR(MCRegister Reg, const MCRegisterInfo *TRI)
Is Reg - scalar register.
uint64_t convertSMRDOffsetUnits(const MCSubtargetInfo &ST, uint64_t ByteOffset)
Convert ByteOffset to dwords if the subtarget uses dword SMRD immediate offsets.
static unsigned encodeStorecnt(const IsaVersion &Version, unsigned Waitcnt, unsigned Storecnt)
MCRegister getMCReg(MCRegister Reg, const MCSubtargetInfo &STI)
If Reg is a pseudo reg, return the correct hardware register given STI otherwise return Reg.
static bool hasSMEMByteOffset(const MCSubtargetInfo &ST)
bool isVOPCAsmOnly(unsigned Opc)
int getMIMGOpcode(unsigned BaseOpcode, unsigned MIMGEncoding, unsigned VDataDwords, unsigned VAddrDwords)
bool getMTBUFHasSrsrc(unsigned Opc)
std::optional< int64_t > getSMRDEncodedLiteralOffset32(const MCSubtargetInfo &ST, int64_t ByteOffset)
bool getWMMAIsXDL(unsigned Opc)
static std::optional< unsigned > convertSetRegImmToVgprMSBs(unsigned Imm, unsigned Simm16, bool HasSetregVGPRMSBFixup)
uint8_t wmmaScaleF8F6F4FormatToNumRegs(unsigned Fmt)
static bool isSymbolicCustomOperandEncoding(const CustomOperandVal *Opr, int Size, unsigned Code, bool &HasNonDefaultVal, const MCSubtargetInfo &STI)
bool isGFX10Before1030(const MCSubtargetInfo &STI)
bool isSISrcInlinableOperand(const MCInstrDesc &Desc, unsigned OpNo)
Does this operand support only inlinable literals?
unsigned mapWMMA2AddrTo3AddrOpcode(unsigned Opc)
const int OPR_ID_UNSUPPORTED
bool shouldEmitConstantsToTextSection(const Triple &TT)
bool isInlinableLiteralV2I16(uint32_t Literal)
bool isDPMACCInstruction(unsigned Opc)
int getMTBUFElements(unsigned Opc)
bool isHi16Reg(MCRegister Reg, const MCRegisterInfo &MRI)
static int encodeCustomOperandVal(const CustomOperandVal &Op, int64_t InputVal)
unsigned getTemporalHintType(const MCInstrDesc TID)
int32_t getTotalNumVGPRs(bool has90AInsts, int32_t ArgNumAGPR, int32_t ArgNumVGPR)
bool isGFX10(const MCSubtargetInfo &STI)
bool isInlinableLiteralV2BF16(uint32_t Literal)
unsigned getMaxNumUserSGPRs(const MCSubtargetInfo &STI)
std::optional< unsigned > getInlineEncodingV216(bool IsFloat, uint32_t Literal)
FPType getFPDstSelType(unsigned Opc)
unsigned getNumFlatOffsetBits(const MCSubtargetInfo &ST)
For pre-GFX12 FLAT instructions the offset must be positive; MSB is ignored and forced to zero.
bool hasA16(const MCSubtargetInfo &STI)
bool isLegalSMRDEncodedSignedOffset(const MCSubtargetInfo &ST, int64_t EncodedOffset, bool IsBuffer)
bool isGFX12Plus(const MCSubtargetInfo &STI)
unsigned getNSAMaxSize(const MCSubtargetInfo &STI, bool HasSampler)
const MCRegisterClass * getVGPRPhysRegClass(MCRegister Reg, const MCRegisterInfo &MRI)
unsigned encodeLoadcntDscnt(const IsaVersion &Version, const Waitcnt &Decoded)
bool hasPackedD16(const MCSubtargetInfo &STI)
unsigned getStorecntBitMask(const IsaVersion &Version)
unsigned getLdsDwGranularity(const MCSubtargetInfo &ST)
bool isGFX940(const MCSubtargetInfo &STI)
bool isInlinableLiteralV2F16(uint32_t Literal)
bool isHsaAbi(const MCSubtargetInfo &STI)
bool isGFX11(const MCSubtargetInfo &STI)
const int OPR_VAL_INVALID
bool getSMEMIsBuffer(unsigned Opc)
bool isGFX10_3_GFX11(const MCSubtargetInfo &STI)
bool isGFX13(const MCSubtargetInfo &STI)
unsigned getAsynccntBitMask(const IsaVersion &Version)
bool hasValueInRangeLikeMetadata(const MDNode &MD, int64_t Val)
Checks if Val is inside MD, a !range-like metadata.
uint8_t mfmaScaleF8F6F4FormatToNumRegs(unsigned EncodingVal)
unsigned getVOPDOpcode(unsigned Opc, bool VOPD3)
bool isGroupSegment(const GlobalValue *GV)
LLVM_ABI IsaVersion getIsaVersion(StringRef GPU)
bool getMTBUFHasSoffset(unsigned Opc)
bool hasXNACK(const MCSubtargetInfo &STI)
bool isValid32BitLiteral(uint64_t Val, bool IsFP64)
static unsigned getCombinedCountBitMask(const IsaVersion &Version, bool IsStore)
CanBeVOPD getCanBeVOPD(unsigned Opc, unsigned EncodingFamily, bool VOPD3)
bool isVOPC64DPP(unsigned Opc)
int getMUBUFOpcode(unsigned BaseOpc, unsigned Elements)
bool getMAIIsGFX940XDL(unsigned Opc)
bool isSI(const MCSubtargetInfo &STI)
unsigned getDefaultAMDHSACodeObjectVersion()
bool isReadOnlySegment(const GlobalValue *GV)
Waitcnt decodeWaitcnt(const IsaVersion &Version, unsigned Encoded)
bool isArgPassedInSGPR(const Argument *A)
bool isIntrinsicAlwaysUniform(unsigned IntrID)
int getMUBUFBaseOpcode(unsigned Opc)
unsigned encodeWaitcnt(const IsaVersion &Version, const Waitcnt &Decoded)
unsigned getAMDHSACodeObjectVersion(const Module &M)
unsigned decodeLgkmcnt(const IsaVersion &Version, unsigned Waitcnt)
unsigned getWaitcntBitMask(const IsaVersion &Version)
LLVM_READONLY bool hasNamedOperand(uint64_t Opcode, OpName NamedIdx)
bool getVOP3IsSingle(unsigned Opc)
bool isGFX9(const MCSubtargetInfo &STI)
bool isDPALU_DPP32BitOpc(unsigned Opc)
bool getVOP1IsSingle(unsigned Opc)
static bool isDwordAligned(uint64_t ByteOffset)
unsigned getVOPDEncodingFamily(const MCSubtargetInfo &ST)
bool isGFX10_AEncoding(const MCSubtargetInfo &STI)
bool isKImmOperand(const MCInstrDesc &Desc, unsigned OpNo)
Is this a KImm operand?
bool getHasColorExport(const Function &F)
int getMTBUFBaseOpcode(unsigned Opc)
bool isGFX90A(const MCSubtargetInfo &STI)
unsigned getSamplecntBitMask(const IsaVersion &Version)
unsigned getDefaultQueueImplicitArgPosition(unsigned CodeObjectVersion)
std::tuple< char, unsigned, unsigned > parseAsmPhysRegName(StringRef RegName)
Returns a valid charcode or 0 in the first entry if this is a valid physical register name.
bool getHasDepthExport(const Function &F)
bool isGFX8_GFX9_GFX10(const MCSubtargetInfo &STI)
bool getMUBUFHasVAddr(unsigned Opc)
bool isTrue16Inst(unsigned Opc)
unsigned getVGPREncodingMSBs(MCRegister Reg, const MCRegisterInfo &MRI)
std::pair< unsigned, unsigned > getVOPDComponents(unsigned VOPDOpcode)
bool isInlinableLiteral32(int32_t Literal, bool HasInv2Pi)
bool isGFX12(const MCSubtargetInfo &STI)
unsigned getInitialPSInputAddr(const Function &F)
unsigned encodeExpcnt(const IsaVersion &Version, unsigned Waitcnt, unsigned Expcnt)
bool isAsyncStore(unsigned Opc)
unsigned getDynamicVGPRBlockSize(const Function &F)
unsigned getKmcntBitMask(const IsaVersion &Version)
MCRegister getVGPRWithMSBs(MCRegister Reg, unsigned MSBs, const MCRegisterInfo &MRI)
If Reg is a low VGPR return a corresponding high VGPR with MSBs set.
unsigned getVmcntBitMask(const IsaVersion &Version)
bool isNotGFX10Plus(const MCSubtargetInfo &STI)
bool hasMAIInsts(const MCSubtargetInfo &STI)
unsigned getBitOp2(unsigned Opc)
bool isIntrinsicSourceOfDivergence(unsigned IntrID)
unsigned getXcntBitMask(const IsaVersion &Version)
bool isGenericAtomic(unsigned Opc)
const MFMA_F8F6F4_Info * getWMMA_F8F6F4_WithFormatArgs(unsigned FmtA, unsigned FmtB, unsigned F8F8Opcode)
bool isGFX8Plus(const MCSubtargetInfo &STI)
LLVM_READNONE bool isInlinableIntLiteral(int64_t Literal)
Is this literal inlinable, and not one of the values intended for floating point values.
unsigned getLgkmcntBitMask(const IsaVersion &Version)
bool getMUBUFTfe(unsigned Opc)
unsigned getBvhcntBitMask(const IsaVersion &Version)
bool hasSMRDSignedImmOffset(const MCSubtargetInfo &ST)
bool hasMIMG_R128(const MCSubtargetInfo &STI)
bool hasGFX10_3Insts(const MCSubtargetInfo &STI)
unsigned decodeDscnt(const IsaVersion &Version, unsigned Waitcnt)
std::pair< const AMDGPU::OpName *, const AMDGPU::OpName * > getVGPRLoweringOperandTables(const MCInstrDesc &Desc)
bool hasG16(const MCSubtargetInfo &STI)
unsigned getAddrSizeMIMGOp(const MIMGBaseOpcodeInfo *BaseOpcode, const MIMGDimInfo *Dim, bool IsA16, bool IsG16Supported)
int getMTBUFOpcode(unsigned BaseOpc, unsigned Elements)
bool isGFX13Plus(const MCSubtargetInfo &STI)
unsigned getExpcntBitMask(const IsaVersion &Version)
bool hasArchitectedFlatScratch(const MCSubtargetInfo &STI)
int32_t getMCOpcode(uint32_t Opcode, unsigned Gen)
bool getMUBUFHasSoffset(unsigned Opc)
bool isNotGFX11Plus(const MCSubtargetInfo &STI)
bool isGFX11Plus(const MCSubtargetInfo &STI)
std::optional< unsigned > getInlineEncodingV2F16(uint32_t Literal)
bool isSISrcFPOperand(const MCInstrDesc &Desc, unsigned OpNo)
Is this floating-point operand?
std::tuple< char, unsigned, unsigned > parseAsmConstraintPhysReg(StringRef Constraint)
Returns a valid charcode or 0 in the first entry if this is a valid physical register constraint.
unsigned getHostcallImplicitArgPosition(unsigned CodeObjectVersion)
static unsigned getDefaultCustomOperandEncoding(const CustomOperandVal *Opr, int Size, const MCSubtargetInfo &STI)
static unsigned encodeLoadcnt(const IsaVersion &Version, unsigned Waitcnt, unsigned Loadcnt)
bool isGFX10Plus(const MCSubtargetInfo &STI)
static bool decodeCustomOperand(const CustomOperandVal *Opr, int Size, unsigned Code, int &Idx, StringRef &Name, unsigned &Val, bool &IsDefault, const MCSubtargetInfo &STI)
static bool isValidRegPrefix(char C)
std::optional< int64_t > getSMRDEncodedOffset(const MCSubtargetInfo &ST, int64_t ByteOffset, bool IsBuffer, bool HasSOffset)
bool isGlobalSegment(const GlobalValue *GV)
int64_t encode32BitLiteral(int64_t Imm, OperandType Type, bool IsLit)
@ OPERAND_KIMM32
Operand with 32-bit immediate that uses the constant bus.
@ OPERAND_REG_INLINE_C_LAST
@ OPERAND_REG_INLINE_C_FP64
@ OPERAND_REG_INLINE_C_BF16
@ OPERAND_REG_INLINE_C_V2BF16
@ OPERAND_REG_IMM_V2INT16
@ OPERAND_REG_IMM_INT32
Operands with register, 32-bit, or 64-bit immediate.
@ OPERAND_REG_INLINE_AC_FIRST
@ OPERAND_REG_IMM_V2FP16_SPLAT
@ OPERAND_REG_IMM_NOINLINE_V2FP16
@ OPERAND_REG_INLINE_C_V2FP16
@ OPERAND_REG_INLINE_AC_INT32
Operands with an AccVGPR register or inline constant.
@ OPERAND_REG_INLINE_AC_FP32
@ OPERAND_REG_IMM_V2INT32
@ OPERAND_REG_INLINE_C_FIRST
@ OPERAND_REG_INLINE_C_FP32
@ OPERAND_REG_INLINE_AC_LAST
@ OPERAND_REG_INLINE_C_INT32
@ OPERAND_REG_INLINE_C_V2INT16
@ OPERAND_REG_INLINE_AC_FP64
@ OPERAND_REG_INLINE_C_FP16
@ OPERAND_INLINE_SPLIT_BARRIER_INT32
std::optional< unsigned > getPKFMACF16InlineEncoding(uint32_t Literal, bool IsGFX11Plus)
void initDefaultAMDKernelCodeT(AMDGPUMCKernelCodeT &KernelCode, const MCSubtargetInfo *STI)
bool isNotGFX9Plus(const MCSubtargetInfo &STI)
bool isDPALU_DPP(const MCInstrDesc &OpDesc, const MCInstrInfo &MII, const MCSubtargetInfo &ST)
bool hasGDS(const MCSubtargetInfo &STI)
bool isLegalSMRDEncodedUnsignedOffset(const MCSubtargetInfo &ST, int64_t EncodedOffset)
bool isGFX9Plus(const MCSubtargetInfo &STI)
bool hasDPPSrc1SGPR(const MCSubtargetInfo &STI)
const int OPR_ID_DUPLICATE
bool isVOPD(unsigned Opc)
VOPD::InstInfo getVOPDInstInfo(const MCInstrDesc &OpX, const MCInstrDesc &OpY)
unsigned encodeVmcnt(const IsaVersion &Version, unsigned Waitcnt, unsigned Vmcnt)
unsigned decodeExpcnt(const IsaVersion &Version, unsigned Waitcnt)
bool isCvt_F32_Fp8_Bf8_e64(unsigned Opc)
std::optional< unsigned > getInlineEncodingV2I16(uint32_t Literal)
unsigned getRegBitWidth(const TargetRegisterClass &RC)
Get the size in bits of a register from the register class RC.
unsigned encodeStorecntDscnt(const IsaVersion &Version, const Waitcnt &Decoded)
bool isGFX1250(const MCSubtargetInfo &STI)
const MIMGBaseOpcodeInfo * getMIMGBaseOpcode(unsigned Opc)
bool isVI(const MCSubtargetInfo &STI)
bool isTensorStore(unsigned Opc)
bool getMUBUFIsBufferInv(unsigned Opc)
bool supportsScaleOffset(const MCInstrInfo &MII, unsigned Opcode)
MCRegister mc2PseudoReg(MCRegister Reg)
Convert hardware register Reg to a pseudo register.
std::optional< unsigned > getInlineEncodingV2BF16(uint32_t Literal)
static int encodeCustomOperand(const CustomOperandVal *Opr, int Size, const StringRef Name, int64_t InputVal, unsigned &UsedOprMask, const MCSubtargetInfo &STI)
unsigned hasKernargPreload(const MCSubtargetInfo &STI)
bool supportsWGP(const MCSubtargetInfo &STI)
bool isCI(const MCSubtargetInfo &STI)
unsigned encodeLgkmcnt(const IsaVersion &Version, unsigned Waitcnt, unsigned Lgkmcnt)
bool getVOP2IsSingle(unsigned Opc)
bool getMAIIsDGEMM(unsigned Opc)
Returns true if MAI operation is a double precision GEMM.
LLVM_READONLY const MIMGBaseOpcodeInfo * getMIMGBaseOpcodeInfo(unsigned BaseOpcode)
unsigned getCompletionActionImplicitArgPosition(unsigned CodeObjectVersion)
SmallVector< unsigned > getIntegerVecAttribute(const Function &F, StringRef Name, unsigned Size, unsigned DefaultVal)
unsigned decodeStorecnt(const IsaVersion &Version, unsigned Waitcnt)
bool isGFX1250Plus(const MCSubtargetInfo &STI)
int getMaskedMIMGOp(unsigned Opc, unsigned NewChannels)
bool isNotGFX12Plus(const MCSubtargetInfo &STI)
bool getMTBUFHasVAddr(unsigned Opc)
unsigned decodeVmcnt(const IsaVersion &Version, unsigned Waitcnt)
uint8_t getELFABIVersion(const Triple &T, unsigned CodeObjectVersion)
std::pair< unsigned, unsigned > getIntegerPairAttribute(const Function &F, StringRef Name, std::pair< unsigned, unsigned > Default, bool OnlyFirstRequired)
unsigned getLoadcntBitMask(const IsaVersion &Version)
bool isInlinableLiteralI16(int32_t Literal, bool HasInv2Pi)
bool hasVOPD(const MCSubtargetInfo &STI)
int getVOPDFull(unsigned OpX, unsigned OpY, unsigned EncodingFamily, bool VOPD3)
static unsigned encodeDscnt(const IsaVersion &Version, unsigned Waitcnt, unsigned Dscnt)
bool isInlinableLiteral64(int64_t Literal, bool HasInv2Pi)
Is this literal inlinable.
const MFMA_F8F6F4_Info * getMFMA_F8F6F4_WithFormatArgs(unsigned CBSZ, unsigned BLGP, unsigned F8F8Opcode)
unsigned decodeLoadcnt(const IsaVersion &Version, unsigned Waitcnt)
unsigned getMultigridSyncArgImplicitArgPosition(unsigned CodeObjectVersion)
bool isGFX9_GFX10_GFX11(const MCSubtargetInfo &STI)
bool isGFX9_GFX10(const MCSubtargetInfo &STI)
int getMUBUFElements(unsigned Opc)
const GcnBufferFormatInfo * getGcnBufferFormatInfo(uint8_t BitsPerComp, uint8_t NumComponents, uint8_t NumFormat, const MCSubtargetInfo &STI)
unsigned mapWMMA3AddrTo2AddrOpcode(unsigned Opc)
bool isPermlane16(unsigned Opc)
bool getMUBUFHasSrsrc(unsigned Opc)
unsigned getDscntBitMask(const IsaVersion &Version)
bool hasAny64BitVGPROperands(const MCInstrDesc &OpDesc, const MCInstrInfo &MII, const MCSubtargetInfo &ST)
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ AMDGPU_CS
Used for Mesa/AMDPAL compute shaders.
@ AMDGPU_VS
Used for Mesa vertex shaders, or AMDPAL last shader stage before rasterization (vertex shader if tess...
@ AMDGPU_KERNEL
Used for AMDGPU code object kernels.
@ AMDGPU_Gfx
Used for AMD graphics targets.
@ AMDGPU_CS_ChainPreserve
Used on AMDGPUs to give the middle-end more control over argument placement.
@ AMDGPU_HS
Used for Mesa/AMDPAL hull shaders (= tessellation control shaders).
@ AMDGPU_GS
Used for Mesa/AMDPAL geometry shaders.
@ AMDGPU_CS_Chain
Used on AMDGPUs to give the middle-end more control over argument placement.
@ AMDGPU_PS
Used for Mesa/AMDPAL pixel shaders.
@ SPIR_KERNEL
Used for SPIR kernel functions.
@ AMDGPU_ES
Used for AMDPAL shader stage before geometry shader if geometry is in use.
@ AMDGPU_LS
Used for AMDPAL vertex shader if tessellation is in use.
@ C
The default llvm calling convention, compatible with C.
@ ELFABIVERSION_AMDGPU_HSA_V4
@ ELFABIVERSION_AMDGPU_HSA_V5
@ ELFABIVERSION_AMDGPU_HSA_V6
initializer< Ty > init(const Ty &Val)
std::enable_if_t< detail::IsValidPointer< X, Y >::value, X * > extract_or_null(Y &&MD)
Extract a Value from Metadata, allowing null.
std::enable_if_t< detail::IsValidPointer< X, Y >::value, X * > extract(Y &&MD)
Extract a Value from Metadata.
This is an optimization pass for GlobalISel generic memory operations.
@ Low
Lower the current thread's priority such that it does not affect foreground tasks significantly.
constexpr T rotr(T V, int R)
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
testing::Matcher< const detail::ErrorHolder & > Failed()
constexpr T alignDown(U Value, V Align, W Skew=0)
Returns the largest unsigned integer less than or equal to Value and is Skew mod Align.
std::string utostr(uint64_t X, bool isNeg=false)
constexpr auto equal_to(T &&Arg)
Functor variant of std::equal_to that can be used as a UnaryPredicate in functional algorithms like a...
FunctionAddr VTableAddr uintptr_t uintptr_t Version
constexpr uint32_t Hi_32(uint64_t Value)
Return the high 32 bits of a 64 bit value.
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
constexpr uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
constexpr bool isUInt(uint64_t x)
Checks if an unsigned integer fits into the given bit width.
constexpr uint32_t Lo_32(uint64_t Value)
Return the low 32 bits of a 64 bit value.
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
constexpr T divideCeil(U Numerator, V Denominator)
Returns the integer ceil(Numerator / Denominator).
To bit_cast(const From &from) noexcept
DWARFExpression::Operation Op
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
constexpr int countr_zero_constexpr(T Val)
Count number of 0's from the least significant bit to the most stopping at the first 1.
constexpr T maskTrailingOnes(unsigned N)
Create a bitmask with the N right-most bits set to 1, and all other bits set to 0.
@ AlwaysUniform
The result value is always uniform.
@ Default
The result value is uniform if and only if all operands are uniform.
AMD Kernel Code Object (amd_kernel_code_t).
uint16_t amd_machine_version_major
uint16_t amd_machine_kind
uint16_t amd_machine_version_stepping
uint8_t private_segment_alignment
int64_t kernel_code_entry_byte_offset
uint32_t amd_kernel_code_version_major
uint16_t amd_machine_version_minor
uint8_t group_segment_alignment
uint8_t kernarg_segment_alignment
uint32_t amd_kernel_code_version_minor
uint64_t compute_pgm_resource_registers
static std::tuple< typename Fields::ValueType... > decode(uint64_t Encoded)
Instruction set architecture version.