[AMDGPU] Introduce and use isGFX10Plus. NFC.

It's more future-proof to use isGFX10Plus from the start, on the
assumption that future architectures will be based on current
architectures.

Also make use of the existing isGFX9Plus in a few places.

Differential Revision: https://reviews.llvm.org/D92092
This commit is contained in:
Jay Foad 2020-11-25 11:51:23 +00:00
parent a5f98b5419
commit 4f87d30a06
10 changed files with 105 additions and 96 deletions

View File

@ -338,7 +338,7 @@ bool AMDGPUAsmPrinter::doFinalization(Module &M) {
// causing stale data in caches. Arguably this should be done by the linker, // causing stale data in caches. Arguably this should be done by the linker,
// which is why this isn't done for Mesa. // which is why this isn't done for Mesa.
const MCSubtargetInfo &STI = *getGlobalSTI(); const MCSubtargetInfo &STI = *getGlobalSTI();
if (AMDGPU::isGFX10(STI) && if (AMDGPU::isGFX10Plus(STI) &&
(STI.getTargetTriple().getOS() == Triple::AMDHSA || (STI.getTargetTriple().getOS() == Triple::AMDHSA ||
STI.getTargetTriple().getOS() == Triple::AMDPAL)) { STI.getTargetTriple().getOS() == Triple::AMDPAL)) {
OutStreamer->SwitchSection(getObjFileLowering().getTextSection()); OutStreamer->SwitchSection(getObjFileLowering().getTextSection());

View File

@ -1485,7 +1485,7 @@ bool AMDGPUInstructionSelector::selectImageIntrinsic(
const AMDGPU::MIMGMIPMappingInfo *MIPMappingInfo = const AMDGPU::MIMGMIPMappingInfo *MIPMappingInfo =
AMDGPU::getMIMGMIPMappingInfo(Intr->BaseOpcode); AMDGPU::getMIMGMIPMappingInfo(Intr->BaseOpcode);
unsigned IntrOpcode = Intr->BaseOpcode; unsigned IntrOpcode = Intr->BaseOpcode;
const bool IsGFX10 = STI.getGeneration() >= AMDGPUSubtarget::GFX10; const bool IsGFX10Plus = AMDGPU::isGFX10Plus(STI);
const unsigned ArgOffset = MI.getNumExplicitDefs() + 1; const unsigned ArgOffset = MI.getNumExplicitDefs() + 1;
@ -1603,12 +1603,12 @@ bool AMDGPUInstructionSelector::selectImageIntrinsic(
GLC = true; // TODO no-return optimization GLC = true; // TODO no-return optimization
if (!parseCachePolicy( if (!parseCachePolicy(
MI.getOperand(ArgOffset + Intr->CachePolicyIndex).getImm(), nullptr, MI.getOperand(ArgOffset + Intr->CachePolicyIndex).getImm(), nullptr,
&SLC, IsGFX10 ? &DLC : nullptr)) &SLC, IsGFX10Plus ? &DLC : nullptr))
return false; return false;
} else { } else {
if (!parseCachePolicy( if (!parseCachePolicy(
MI.getOperand(ArgOffset + Intr->CachePolicyIndex).getImm(), &GLC, MI.getOperand(ArgOffset + Intr->CachePolicyIndex).getImm(), &GLC,
&SLC, IsGFX10 ? &DLC : nullptr)) &SLC, IsGFX10Plus ? &DLC : nullptr))
return false; return false;
} }
@ -1641,7 +1641,7 @@ bool AMDGPUInstructionSelector::selectImageIntrinsic(
++NumVDataDwords; ++NumVDataDwords;
int Opcode = -1; int Opcode = -1;
if (IsGFX10) { if (IsGFX10Plus) {
Opcode = AMDGPU::getMIMGOpcode(IntrOpcode, Opcode = AMDGPU::getMIMGOpcode(IntrOpcode,
UseNSA ? AMDGPU::MIMGEncGfx10NSA UseNSA ? AMDGPU::MIMGEncGfx10NSA
: AMDGPU::MIMGEncGfx10Default, : AMDGPU::MIMGEncGfx10Default,
@ -1693,22 +1693,22 @@ bool AMDGPUInstructionSelector::selectImageIntrinsic(
MIB.addImm(DMask); // dmask MIB.addImm(DMask); // dmask
if (IsGFX10) if (IsGFX10Plus)
MIB.addImm(DimInfo->Encoding); MIB.addImm(DimInfo->Encoding);
MIB.addImm(Unorm); MIB.addImm(Unorm);
if (IsGFX10) if (IsGFX10Plus)
MIB.addImm(DLC); MIB.addImm(DLC);
MIB.addImm(GLC); MIB.addImm(GLC);
MIB.addImm(SLC); MIB.addImm(SLC);
MIB.addImm(IsA16 && // a16 or r128 MIB.addImm(IsA16 && // a16 or r128
STI.hasFeature(AMDGPU::FeatureR128A16) ? -1 : 0); STI.hasFeature(AMDGPU::FeatureR128A16) ? -1 : 0);
if (IsGFX10) if (IsGFX10Plus)
MIB.addImm(IsA16 ? -1 : 0); MIB.addImm(IsA16 ? -1 : 0);
MIB.addImm(TFE); // tfe MIB.addImm(TFE); // tfe
MIB.addImm(LWE); // lwe MIB.addImm(LWE); // lwe
if (!IsGFX10) if (!IsGFX10Plus)
MIB.addImm(DimInfo->DA ? -1 : 0); MIB.addImm(DimInfo->DA ? -1 : 0);
if (BaseOpcode->HasD16) if (BaseOpcode->HasD16)
MIB.addImm(IsD16 ? -1 : 0); MIB.addImm(IsD16 ? -1 : 0);

View File

@ -1232,6 +1232,8 @@ public:
return AMDGPU::isGFX10(getSTI()); return AMDGPU::isGFX10(getSTI());
} }
bool isGFX10Plus() const { return AMDGPU::isGFX10Plus(getSTI()); }
bool isGFX10_BEncoding() const { bool isGFX10_BEncoding() const {
return AMDGPU::isGFX10_BEncoding(getSTI()); return AMDGPU::isGFX10_BEncoding(getSTI());
} }
@ -1248,9 +1250,7 @@ public:
return !isVI() && !isGFX9(); return !isVI() && !isGFX9();
} }
bool hasSGPR104_SGPR105() const { bool hasSGPR104_SGPR105() const { return isGFX10Plus(); }
return isGFX10();
}
bool hasIntClamp() const { bool hasIntClamp() const {
return getFeatureBits()[AMDGPU::FeatureIntClamp]; return getFeatureBits()[AMDGPU::FeatureIntClamp];
@ -1752,7 +1752,7 @@ bool AMDGPUOperand::isRegClass(unsigned RCID) const {
bool AMDGPUOperand::isSDWAOperand(MVT type) const { bool AMDGPUOperand::isSDWAOperand(MVT type) const {
if (AsmParser->isVI()) if (AsmParser->isVI())
return isVReg32(); return isVReg32();
else if (AsmParser->isGFX9() || AsmParser->isGFX10()) else if (AsmParser->isGFX9Plus())
return isRegClass(AMDGPU::VS_32RegClassID) || isInlinableImm(type); return isRegClass(AMDGPU::VS_32RegClassID) || isInlinableImm(type);
else else
return false; return false;
@ -3028,7 +3028,7 @@ bool AMDGPUAsmParser::isInlineConstant(const MCInst &Inst,
} }
unsigned AMDGPUAsmParser::getConstantBusLimit(unsigned Opcode) const { unsigned AMDGPUAsmParser::getConstantBusLimit(unsigned Opcode) const {
if (!isGFX10()) if (!isGFX10Plus())
return 1; return 1;
switch (Opcode) { switch (Opcode) {
@ -3244,7 +3244,7 @@ bool AMDGPUAsmParser::validateMIMGAddrSize(const MCInst &Inst) {
const unsigned Opc = Inst.getOpcode(); const unsigned Opc = Inst.getOpcode();
const MCInstrDesc &Desc = MII.get(Opc); const MCInstrDesc &Desc = MII.get(Opc);
if ((Desc.TSFlags & SIInstrFlags::MIMG) == 0 || !isGFX10()) if ((Desc.TSFlags & SIInstrFlags::MIMG) == 0 || !isGFX10Plus())
return true; return true;
const AMDGPU::MIMGInfo *Info = AMDGPU::getMIMGInfo(Opc); const AMDGPU::MIMGInfo *Info = AMDGPU::getMIMGInfo(Opc);
@ -4514,7 +4514,7 @@ bool AMDGPUAsmParser::ParseAMDKernelCodeTValue(StringRef ID,
if (ID == "enable_wavefront_size32") { if (ID == "enable_wavefront_size32") {
if (Header.code_properties & AMD_CODE_PROPERTY_ENABLE_WAVEFRONT_SIZE32) { if (Header.code_properties & AMD_CODE_PROPERTY_ENABLE_WAVEFRONT_SIZE32) {
if (!isGFX10()) if (!isGFX10Plus())
return TokError("enable_wavefront_size32=1 is only allowed on GFX10+"); return TokError("enable_wavefront_size32=1 is only allowed on GFX10+");
if (!getFeatureBits()[AMDGPU::FeatureWavefrontSize32]) if (!getFeatureBits()[AMDGPU::FeatureWavefrontSize32])
return TokError("enable_wavefront_size32=1 requires +WavefrontSize32"); return TokError("enable_wavefront_size32=1 requires +WavefrontSize32");
@ -4526,7 +4526,7 @@ bool AMDGPUAsmParser::ParseAMDKernelCodeTValue(StringRef ID,
if (ID == "wavefront_size") { if (ID == "wavefront_size") {
if (Header.wavefront_size == 5) { if (Header.wavefront_size == 5) {
if (!isGFX10()) if (!isGFX10Plus())
return TokError("wavefront_size=5 is only allowed on GFX10+"); return TokError("wavefront_size=5 is only allowed on GFX10+");
if (!getFeatureBits()[AMDGPU::FeatureWavefrontSize32]) if (!getFeatureBits()[AMDGPU::FeatureWavefrontSize32])
return TokError("wavefront_size=5 requires +WavefrontSize32"); return TokError("wavefront_size=5 requires +WavefrontSize32");
@ -4537,17 +4537,20 @@ bool AMDGPUAsmParser::ParseAMDKernelCodeTValue(StringRef ID,
} }
if (ID == "enable_wgp_mode") { if (ID == "enable_wgp_mode") {
if (G_00B848_WGP_MODE(Header.compute_pgm_resource_registers) && !isGFX10()) if (G_00B848_WGP_MODE(Header.compute_pgm_resource_registers) &&
!isGFX10Plus())
return TokError("enable_wgp_mode=1 is only allowed on GFX10+"); return TokError("enable_wgp_mode=1 is only allowed on GFX10+");
} }
if (ID == "enable_mem_ordered") { if (ID == "enable_mem_ordered") {
if (G_00B848_MEM_ORDERED(Header.compute_pgm_resource_registers) && !isGFX10()) if (G_00B848_MEM_ORDERED(Header.compute_pgm_resource_registers) &&
!isGFX10Plus())
return TokError("enable_mem_ordered=1 is only allowed on GFX10+"); return TokError("enable_mem_ordered=1 is only allowed on GFX10+");
} }
if (ID == "enable_fwd_progress") { if (ID == "enable_fwd_progress") {
if (G_00B848_FWD_PROGRESS(Header.compute_pgm_resource_registers) && !isGFX10()) if (G_00B848_FWD_PROGRESS(Header.compute_pgm_resource_registers) &&
!isGFX10Plus())
return TokError("enable_fwd_progress=1 is only allowed on GFX10+"); return TokError("enable_fwd_progress=1 is only allowed on GFX10+");
} }
@ -4870,13 +4873,13 @@ bool AMDGPUAsmParser::subtargetHasRegister(const MCRegisterInfo &MRI,
case AMDGPU::TMA: case AMDGPU::TMA:
case AMDGPU::TMA_LO: case AMDGPU::TMA_LO:
case AMDGPU::TMA_HI: case AMDGPU::TMA_HI:
return !isGFX9() && !isGFX10(); return !isGFX9Plus();
case AMDGPU::XNACK_MASK: case AMDGPU::XNACK_MASK:
case AMDGPU::XNACK_MASK_LO: case AMDGPU::XNACK_MASK_LO:
case AMDGPU::XNACK_MASK_HI: case AMDGPU::XNACK_MASK_HI:
return !isCI() && !isSI() && !isGFX10() && hasXNACK(); return !isCI() && !isSI() && !isGFX10Plus() && hasXNACK();
case AMDGPU::SGPR_NULL: case AMDGPU::SGPR_NULL:
return isGFX10(); return isGFX10Plus();
default: default:
break; break;
} }
@ -4884,7 +4887,7 @@ bool AMDGPUAsmParser::subtargetHasRegister(const MCRegisterInfo &MRI,
if (isCI()) if (isCI())
return true; return true;
if (isSI() || isGFX10()) { if (isSI() || isGFX10Plus()) {
// No flat_scr on SI. // No flat_scr on SI.
// On GFX10 flat scratch is not a valid register operand and can only be // On GFX10 flat scratch is not a valid register operand and can only be
// accessed with s_setreg/s_getreg. // accessed with s_setreg/s_getreg.
@ -4990,7 +4993,7 @@ bool AMDGPUAsmParser::ParseInstruction(ParseInstructionInfo &Info,
while (!getLexer().is(AsmToken::EndOfStatement)) { while (!getLexer().is(AsmToken::EndOfStatement)) {
OperandMode Mode = OperandMode_Default; OperandMode Mode = OperandMode_Default;
if (IsMIMG && isGFX10() && Operands.size() == 2) if (IsMIMG && isGFX10Plus() && Operands.size() == 2)
Mode = OperandMode_NSA; Mode = OperandMode_NSA;
OperandMatchResultTy Res = parseOperand(Operands, Name, Mode); OperandMatchResultTy Res = parseOperand(Operands, Name, Mode);
@ -5127,7 +5130,7 @@ AMDGPUAsmParser::parseNamedBit(const char *Name, OperandVector &Operands,
} }
} }
if (!isGFX10() && ImmTy == AMDGPUOperand::ImmTyDLC) if (!isGFX10Plus() && ImmTy == AMDGPUOperand::ImmTyDLC)
return MatchOperand_ParseFail; return MatchOperand_ParseFail;
if (isGFX9() && ImmTy == AMDGPUOperand::ImmTyA16) if (isGFX9() && ImmTy == AMDGPUOperand::ImmTyA16)
@ -5304,7 +5307,7 @@ AMDGPUAsmParser::parseSymbolicSplitFormat(StringRef FormatStr,
Dfmt = (Dfmt == DFMT_UNDEF) ? DFMT_DEFAULT : Dfmt; Dfmt = (Dfmt == DFMT_UNDEF) ? DFMT_DEFAULT : Dfmt;
Nfmt = (Nfmt == NFMT_UNDEF) ? NFMT_DEFAULT : Nfmt; Nfmt = (Nfmt == NFMT_UNDEF) ? NFMT_DEFAULT : Nfmt;
if (isGFX10()) { if (isGFX10Plus()) {
auto Ufmt = convertDfmtNfmt2Ufmt(Dfmt, Nfmt); auto Ufmt = convertDfmtNfmt2Ufmt(Dfmt, Nfmt);
if (Ufmt == UFMT_UNDEF) { if (Ufmt == UFMT_UNDEF) {
Error(FormatLoc, "unsupported format"); Error(FormatLoc, "unsupported format");
@ -5328,7 +5331,7 @@ AMDGPUAsmParser::parseSymbolicUnifiedFormat(StringRef FormatStr,
if (Id == UFMT_UNDEF) if (Id == UFMT_UNDEF)
return MatchOperand_NoMatch; return MatchOperand_NoMatch;
if (!isGFX10()) { if (!isGFX10Plus()) {
Error(Loc, "unified format is not supported on this GPU"); Error(Loc, "unified format is not supported on this GPU");
return MatchOperand_ParseFail; return MatchOperand_ParseFail;
} }
@ -5389,7 +5392,7 @@ AMDGPUAsmParser::parseFORMAT(OperandVector &Operands) {
SMLoc Loc = getLoc(); SMLoc Loc = getLoc();
// Parse legacy format syntax. // Parse legacy format syntax.
Res = isGFX10() ? parseUfmt(Format) : parseDfmtNfmt(Format); Res = isGFX10Plus() ? parseUfmt(Format) : parseDfmtNfmt(Format);
if (Res == MatchOperand_ParseFail) if (Res == MatchOperand_ParseFail)
return Res; return Res;
@ -5968,14 +5971,14 @@ OperandMatchResultTy AMDGPUAsmParser::parseExpTgtImpl(StringRef Str,
if (Str.getAsInteger(10, Val)) if (Str.getAsInteger(10, Val))
return MatchOperand_ParseFail; return MatchOperand_ParseFail;
if (Val > (isGFX10() ? 4 : 3)) if (Val > (isGFX10Plus() ? 4 : 3))
return MatchOperand_ParseFail; return MatchOperand_ParseFail;
Val += Exp::ET_POS0; Val += Exp::ET_POS0;
return MatchOperand_Success; return MatchOperand_Success;
} }
if (isGFX10() && Str == "prim") { if (isGFX10Plus() && Str == "prim") {
Val = Exp::ET_PRIM; Val = Exp::ET_PRIM;
return MatchOperand_Success; return MatchOperand_Success;
} }
@ -6674,7 +6677,7 @@ void AMDGPUAsmParser::cvtMubufImpl(MCInst &Inst,
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyTFE); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyTFE);
} }
if (isGFX10()) if (isGFX10Plus())
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyDLC); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyDLC);
} }
@ -6714,7 +6717,7 @@ void AMDGPUAsmParser::cvtMtbuf(MCInst &Inst, const OperandVector &Operands) {
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySLC); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySLC);
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyTFE); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyTFE);
if (isGFX10()) if (isGFX10Plus())
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyDLC); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyDLC);
} }
@ -6751,22 +6754,22 @@ void AMDGPUAsmParser::cvtMIMG(MCInst &Inst, const OperandVector &Operands,
} }
} }
bool IsGFX10 = isGFX10(); bool IsGFX10Plus = isGFX10Plus();
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyDMask); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyDMask);
if (IsGFX10) if (IsGFX10Plus)
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyDim, -1); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyDim, -1);
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyUNorm); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyUNorm);
if (IsGFX10) if (IsGFX10Plus)
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyDLC); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyDLC);
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyGLC); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyGLC);
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySLC); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySLC);
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyR128A16); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyR128A16);
if (IsGFX10) if (IsGFX10Plus)
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyA16); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyA16);
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyTFE); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyTFE);
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyLWE); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyLWE);
if (!IsGFX10) if (!IsGFX10Plus)
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyDA); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyDA);
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyD16); addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyD16);
} }
@ -7267,7 +7270,7 @@ bool AMDGPUOperand::isU16Imm() const {
} }
OperandMatchResultTy AMDGPUAsmParser::parseDim(OperandVector &Operands) { OperandMatchResultTy AMDGPUAsmParser::parseDim(OperandVector &Operands) {
if (!isGFX10()) if (!isGFX10Plus())
return MatchOperand_NoMatch; return MatchOperand_NoMatch;
SMLoc S = Parser.getTok().getLoc(); SMLoc S = Parser.getTok().getLoc();
@ -7324,7 +7327,7 @@ OperandMatchResultTy AMDGPUAsmParser::parseDPP8(OperandVector &Operands) {
if (Prefix != "dpp8") if (Prefix != "dpp8")
return parseDPPCtrl(Operands); return parseDPPCtrl(Operands);
if (!isGFX10()) if (!isGFX10Plus())
return MatchOperand_NoMatch; return MatchOperand_NoMatch;
// dpp8:[%d,%d,%d,%d,%d,%d,%d,%d] // dpp8:[%d,%d,%d,%d,%d,%d,%d,%d]
@ -7404,7 +7407,7 @@ AMDGPUAsmParser::parseDPPCtrl(OperandVector &Operands) {
return MatchOperand_NoMatch; return MatchOperand_NoMatch;
} }
if (!isGFX10() && (Prefix == "row_share" || Prefix == "row_xmask")) if (!isGFX10Plus() && (Prefix == "row_share" || Prefix == "row_xmask"))
return MatchOperand_NoMatch; return MatchOperand_NoMatch;
if (!isVI() && !isGFX9() && if (!isVI() && !isGFX9() &&

View File

@ -52,8 +52,9 @@ using namespace llvm;
#define DEBUG_TYPE "amdgpu-disassembler" #define DEBUG_TYPE "amdgpu-disassembler"
#define SGPR_MAX (isGFX10() ? AMDGPU::EncValues::SGPR_MAX_GFX10 \ #define SGPR_MAX \
: AMDGPU::EncValues::SGPR_MAX_SI) (isGFX10Plus() ? AMDGPU::EncValues::SGPR_MAX_GFX10 \
: AMDGPU::EncValues::SGPR_MAX_SI)
using DecodeStatus = llvm::MCDisassembler::DecodeStatus; using DecodeStatus = llvm::MCDisassembler::DecodeStatus;
@ -64,7 +65,7 @@ AMDGPUDisassembler::AMDGPUDisassembler(const MCSubtargetInfo &STI,
TargetMaxInstBytes(Ctx.getAsmInfo()->getMaxInstLength(&STI)) { TargetMaxInstBytes(Ctx.getAsmInfo()->getMaxInstLength(&STI)) {
// ToDo: AMDGPUDisassembler supports only VI ISA. // ToDo: AMDGPUDisassembler supports only VI ISA.
if (!STI.getFeatureBits()[AMDGPU::FeatureGCN3Encoding] && !isGFX10()) if (!STI.getFeatureBits()[AMDGPU::FeatureGCN3Encoding] && !isGFX10Plus())
report_fatal_error("Disassembly not yet supported for subtarget"); report_fatal_error("Disassembly not yet supported for subtarget");
} }
@ -1016,10 +1017,8 @@ unsigned AMDGPUDisassembler::getTtmpClassId(const OpWidthTy Width) const {
int AMDGPUDisassembler::getTTmpIdx(unsigned Val) const { int AMDGPUDisassembler::getTTmpIdx(unsigned Val) const {
using namespace AMDGPU::EncValues; using namespace AMDGPU::EncValues;
unsigned TTmpMin = unsigned TTmpMin = isGFX9Plus() ? TTMP_GFX9_GFX10_MIN : TTMP_VI_MIN;
(isGFX9() || isGFX10()) ? TTMP_GFX9_GFX10_MIN : TTMP_VI_MIN; unsigned TTmpMax = isGFX9Plus() ? TTMP_GFX9_GFX10_MAX : TTMP_VI_MAX;
unsigned TTmpMax =
(isGFX9() || isGFX10()) ? TTMP_GFX9_GFX10_MAX : TTMP_VI_MAX;
return (TTmpMin <= Val && Val <= TTmpMax)? Val - TTmpMin : -1; return (TTmpMin <= Val && Val <= TTmpMax)? Val - TTmpMin : -1;
} }
@ -1157,8 +1156,8 @@ MCOperand AMDGPUDisassembler::decodeSDWASrc(const OpWidthTy Width,
Val - SDWA9EncValues::SRC_VGPR_MIN); Val - SDWA9EncValues::SRC_VGPR_MIN);
} }
if (SDWA9EncValues::SRC_SGPR_MIN <= Val && if (SDWA9EncValues::SRC_SGPR_MIN <= Val &&
Val <= (isGFX10() ? SDWA9EncValues::SRC_SGPR_MAX_GFX10 Val <= (isGFX10Plus() ? SDWA9EncValues::SRC_SGPR_MAX_GFX10
: SDWA9EncValues::SRC_SGPR_MAX_SI)) { : SDWA9EncValues::SRC_SGPR_MAX_SI)) {
return createSRegOperand(getSgprClassId(Width), return createSRegOperand(getSgprClassId(Width),
Val - SDWA9EncValues::SRC_SGPR_MIN); Val - SDWA9EncValues::SRC_SGPR_MIN);
} }
@ -1227,12 +1226,14 @@ bool AMDGPUDisassembler::isVI() const {
return STI.getFeatureBits()[AMDGPU::FeatureVolcanicIslands]; return STI.getFeatureBits()[AMDGPU::FeatureVolcanicIslands];
} }
bool AMDGPUDisassembler::isGFX9() const { bool AMDGPUDisassembler::isGFX9() const { return AMDGPU::isGFX9(STI); }
return STI.getFeatureBits()[AMDGPU::FeatureGFX9];
}
bool AMDGPUDisassembler::isGFX10() const { bool AMDGPUDisassembler::isGFX9Plus() const { return AMDGPU::isGFX9Plus(STI); }
return STI.getFeatureBits()[AMDGPU::FeatureGFX10];
bool AMDGPUDisassembler::isGFX10() const { return AMDGPU::isGFX10(STI); }
bool AMDGPUDisassembler::isGFX10Plus() const {
return AMDGPU::isGFX10Plus(STI);
} }
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
@ -1287,7 +1288,7 @@ MCDisassembler::DecodeStatus AMDGPUDisassembler::decodeCOMPUTE_PGM_RSRC1(
(FourByteBuffer & COMPUTE_PGM_RSRC1_GRANULATED_WAVEFRONT_SGPR_COUNT) >> (FourByteBuffer & COMPUTE_PGM_RSRC1_GRANULATED_WAVEFRONT_SGPR_COUNT) >>
COMPUTE_PGM_RSRC1_GRANULATED_WAVEFRONT_SGPR_COUNT_SHIFT; COMPUTE_PGM_RSRC1_GRANULATED_WAVEFRONT_SGPR_COUNT_SHIFT;
if (isGFX10() && GranulatedWavefrontSGPRCount) if (isGFX10Plus() && GranulatedWavefrontSGPRCount)
return MCDisassembler::Fail; return MCDisassembler::Fail;
uint32_t NextFreeSGPR = (GranulatedWavefrontSGPRCount + 1) * uint32_t NextFreeSGPR = (GranulatedWavefrontSGPRCount + 1) *
@ -1331,7 +1332,7 @@ MCDisassembler::DecodeStatus AMDGPUDisassembler::decodeCOMPUTE_PGM_RSRC1(
if (FourByteBuffer & COMPUTE_PGM_RSRC1_RESERVED0) if (FourByteBuffer & COMPUTE_PGM_RSRC1_RESERVED0)
return MCDisassembler::Fail; return MCDisassembler::Fail;
if (isGFX10()) { if (isGFX10Plus()) {
PRINT_DIRECTIVE(".amdhsa_workgroup_processor_mode", PRINT_DIRECTIVE(".amdhsa_workgroup_processor_mode",
COMPUTE_PGM_RSRC1_WGP_MODE); COMPUTE_PGM_RSRC1_WGP_MODE);
PRINT_DIRECTIVE(".amdhsa_memory_ordered", COMPUTE_PGM_RSRC1_MEM_ORDERED); PRINT_DIRECTIVE(".amdhsa_memory_ordered", COMPUTE_PGM_RSRC1_MEM_ORDERED);
@ -1456,7 +1457,7 @@ AMDGPUDisassembler::decodeKernelDescriptorDirective(
// - Only set for GFX10, GFX6-9 have this to be 0. // - Only set for GFX10, GFX6-9 have this to be 0.
// - Currently no directives directly control this. // - Currently no directives directly control this.
FourByteBuffer = DE.getU32(Cursor); FourByteBuffer = DE.getU32(Cursor);
if (!isGFX10() && FourByteBuffer) { if (!isGFX10Plus() && FourByteBuffer) {
return MCDisassembler::Fail; return MCDisassembler::Fail;
} }
return MCDisassembler::Success; return MCDisassembler::Success;
@ -1503,7 +1504,7 @@ AMDGPUDisassembler::decodeKernelDescriptorDirective(
if (isGFX9() && if (isGFX9() &&
(TwoByteBuffer & KERNEL_CODE_PROPERTY_ENABLE_WAVEFRONT_SIZE32)) { (TwoByteBuffer & KERNEL_CODE_PROPERTY_ENABLE_WAVEFRONT_SIZE32)) {
return MCDisassembler::Fail; return MCDisassembler::Fail;
} else if (isGFX10()) { } else if (isGFX10Plus()) {
PRINT_DIRECTIVE(".amdhsa_wavefront_size32", PRINT_DIRECTIVE(".amdhsa_wavefront_size32",
KERNEL_CODE_PROPERTY_ENABLE_WAVEFRONT_SIZE32); KERNEL_CODE_PROPERTY_ENABLE_WAVEFRONT_SIZE32);
} }

View File

@ -168,7 +168,9 @@ public:
bool isVI() const; bool isVI() const;
bool isGFX9() const; bool isGFX9() const;
bool isGFX9Plus() const;
bool isGFX10() const; bool isGFX10() const;
bool isGFX10Plus() const;
}; };
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//

View File

@ -155,7 +155,7 @@ void AMDGPUInstPrinter::printFlatOffset(const MCInst *MI, unsigned OpNo,
if (IsFlatSeg) { // Unsigned offset if (IsFlatSeg) { // Unsigned offset
printU16ImmDecOperand(MI, OpNo, O); printU16ImmDecOperand(MI, OpNo, O);
} else { // Signed offset } else { // Signed offset
if (AMDGPU::isGFX10(STI)) { if (AMDGPU::isGFX10Plus(STI)) {
O << formatDec(SignExtend32<12>(MI->getOperand(OpNo).getImm())); O << formatDec(SignExtend32<12>(MI->getOperand(OpNo).getImm()));
} else { } else {
O << formatDec(SignExtend32<13>(MI->getOperand(OpNo).getImm())); O << formatDec(SignExtend32<13>(MI->getOperand(OpNo).getImm()));
@ -207,7 +207,7 @@ void AMDGPUInstPrinter::printGDS(const MCInst *MI, unsigned OpNo,
void AMDGPUInstPrinter::printDLC(const MCInst *MI, unsigned OpNo, void AMDGPUInstPrinter::printDLC(const MCInst *MI, unsigned OpNo,
const MCSubtargetInfo &STI, raw_ostream &O) { const MCSubtargetInfo &STI, raw_ostream &O) {
if (AMDGPU::isGFX10(STI)) if (AMDGPU::isGFX10Plus(STI))
printNamedBit(MI, OpNo, O, "dlc"); printNamedBit(MI, OpNo, O, "dlc");
} }
@ -310,7 +310,7 @@ void AMDGPUInstPrinter::printSymbolicFormat(const MCInst *MI,
assert(OpNo != -1); assert(OpNo != -1);
unsigned Val = MI->getOperand(OpNo).getImm(); unsigned Val = MI->getOperand(OpNo).getImm();
if (AMDGPU::isGFX10(STI)) { if (AMDGPU::isGFX10Plus(STI)) {
if (Val == UFMT_DEFAULT) if (Val == UFMT_DEFAULT)
return; return;
if (isValidUnifiedFormat(Val)) { if (isValidUnifiedFormat(Val)) {
@ -780,7 +780,7 @@ void AMDGPUInstPrinter::printOperandAndIntInputMods(const MCInst *MI,
void AMDGPUInstPrinter::printDPP8(const MCInst *MI, unsigned OpNo, void AMDGPUInstPrinter::printDPP8(const MCInst *MI, unsigned OpNo,
const MCSubtargetInfo &STI, const MCSubtargetInfo &STI,
raw_ostream &O) { raw_ostream &O) {
if (!AMDGPU::isGFX10(STI)) if (!AMDGPU::isGFX10Plus(STI))
llvm_unreachable("dpp8 is not supported on ASICs earlier than GFX10"); llvm_unreachable("dpp8 is not supported on ASICs earlier than GFX10");
unsigned Imm = MI->getOperand(OpNo).getImm(); unsigned Imm = MI->getOperand(OpNo).getImm();
@ -816,25 +816,25 @@ void AMDGPUInstPrinter::printDPPCtrl(const MCInst *MI, unsigned OpNo,
O << "row_ror:"; O << "row_ror:";
printU4ImmDecOperand(MI, OpNo, O); printU4ImmDecOperand(MI, OpNo, O);
} else if (Imm == DppCtrl::WAVE_SHL1) { } else if (Imm == DppCtrl::WAVE_SHL1) {
if (!AMDGPU::isVI(STI) && !AMDGPU::isGFX9(STI)) { if (AMDGPU::isGFX10Plus(STI)) {
O << "/* wave_shl is not supported starting from GFX10 */"; O << "/* wave_shl is not supported starting from GFX10 */";
return; return;
} }
O << "wave_shl:1"; O << "wave_shl:1";
} else if (Imm == DppCtrl::WAVE_ROL1) { } else if (Imm == DppCtrl::WAVE_ROL1) {
if (!AMDGPU::isVI(STI) && !AMDGPU::isGFX9(STI)) { if (AMDGPU::isGFX10Plus(STI)) {
O << "/* wave_rol is not supported starting from GFX10 */"; O << "/* wave_rol is not supported starting from GFX10 */";
return; return;
} }
O << "wave_rol:1"; O << "wave_rol:1";
} else if (Imm == DppCtrl::WAVE_SHR1) { } else if (Imm == DppCtrl::WAVE_SHR1) {
if (!AMDGPU::isVI(STI) && !AMDGPU::isGFX9(STI)) { if (AMDGPU::isGFX10Plus(STI)) {
O << "/* wave_shr is not supported starting from GFX10 */"; O << "/* wave_shr is not supported starting from GFX10 */";
return; return;
} }
O << "wave_shr:1"; O << "wave_shr:1";
} else if (Imm == DppCtrl::WAVE_ROR1) { } else if (Imm == DppCtrl::WAVE_ROR1) {
if (!AMDGPU::isVI(STI) && !AMDGPU::isGFX9(STI)) { if (AMDGPU::isGFX10Plus(STI)) {
O << "/* wave_ror is not supported starting from GFX10 */"; O << "/* wave_ror is not supported starting from GFX10 */";
return; return;
} }
@ -844,20 +844,20 @@ void AMDGPUInstPrinter::printDPPCtrl(const MCInst *MI, unsigned OpNo,
} else if (Imm == DppCtrl::ROW_HALF_MIRROR) { } else if (Imm == DppCtrl::ROW_HALF_MIRROR) {
O << "row_half_mirror"; O << "row_half_mirror";
} else if (Imm == DppCtrl::BCAST15) { } else if (Imm == DppCtrl::BCAST15) {
if (!AMDGPU::isVI(STI) && !AMDGPU::isGFX9(STI)) { if (AMDGPU::isGFX10Plus(STI)) {
O << "/* row_bcast is not supported starting from GFX10 */"; O << "/* row_bcast is not supported starting from GFX10 */";
return; return;
} }
O << "row_bcast:15"; O << "row_bcast:15";
} else if (Imm == DppCtrl::BCAST31) { } else if (Imm == DppCtrl::BCAST31) {
if (!AMDGPU::isVI(STI) && !AMDGPU::isGFX9(STI)) { if (AMDGPU::isGFX10Plus(STI)) {
O << "/* row_bcast is not supported starting from GFX10 */"; O << "/* row_bcast is not supported starting from GFX10 */";
return; return;
} }
O << "row_bcast:31"; O << "row_bcast:31";
} else if ((Imm >= DppCtrl::ROW_SHARE_FIRST) && } else if ((Imm >= DppCtrl::ROW_SHARE_FIRST) &&
(Imm <= DppCtrl::ROW_SHARE_LAST)) { (Imm <= DppCtrl::ROW_SHARE_LAST)) {
if (!AMDGPU::isGFX10(STI)) { if (!AMDGPU::isGFX10Plus(STI)) {
O << "/* row_share is not supported on ASICs earlier than GFX10 */"; O << "/* row_share is not supported on ASICs earlier than GFX10 */";
return; return;
} }
@ -865,7 +865,7 @@ void AMDGPUInstPrinter::printDPPCtrl(const MCInst *MI, unsigned OpNo,
printU4ImmDecOperand(MI, OpNo, O); printU4ImmDecOperand(MI, OpNo, O);
} else if ((Imm >= DppCtrl::ROW_XMASK_FIRST) && } else if ((Imm >= DppCtrl::ROW_XMASK_FIRST) &&
(Imm <= DppCtrl::ROW_XMASK_LAST)) { (Imm <= DppCtrl::ROW_XMASK_LAST)) {
if (!AMDGPU::isGFX10(STI)) { if (!AMDGPU::isGFX10Plus(STI)) {
O << "/* row_xmask is not supported on ASICs earlier than GFX10 */"; O << "/* row_xmask is not supported on ASICs earlier than GFX10 */";
return; return;
} }
@ -1023,9 +1023,9 @@ void AMDGPUInstPrinter::printExpTgt(const MCInst *MI, unsigned OpNo,
else if (Tgt == Exp::ET_NULL) else if (Tgt == Exp::ET_NULL)
O << " null"; O << " null";
else if (Tgt >= Exp::ET_POS0 && else if (Tgt >= Exp::ET_POS0 &&
Tgt <= uint32_t(isGFX10(STI) ? Exp::ET_POS4 : Exp::ET_POS3)) Tgt <= uint32_t(isGFX10Plus(STI) ? Exp::ET_POS4 : Exp::ET_POS3))
O << " pos" << Tgt - Exp::ET_POS0; O << " pos" << Tgt - Exp::ET_POS0;
else if (isGFX10(STI) && Tgt == Exp::ET_PRIM) else if (isGFX10Plus(STI) && Tgt == Exp::ET_PRIM)
O << " prim"; O << " prim";
else if (Tgt >= Exp::ET_PARAM0 && Tgt <= Exp::ET_PARAM31) else if (Tgt >= Exp::ET_PARAM0 && Tgt <= Exp::ET_PARAM31)
O << " param" << Tgt - Exp::ET_PARAM0; O << " param" << Tgt - Exp::ET_PARAM0;

View File

@ -303,7 +303,7 @@ void SIMCCodeEmitter::encodeInstruction(const MCInst &MI, raw_ostream &OS,
} }
// NSA encoding. // NSA encoding.
if (AMDGPU::isGFX10(STI) && Desc.TSFlags & SIInstrFlags::MIMG) { if (AMDGPU::isGFX10Plus(STI) && Desc.TSFlags & SIInstrFlags::MIMG) {
int vaddr0 = AMDGPU::getNamedOperandIdx(MI.getOpcode(), int vaddr0 = AMDGPU::getNamedOperandIdx(MI.getOpcode(),
AMDGPU::OpName::vaddr0); AMDGPU::OpName::vaddr0);
int srsrc = AMDGPU::getNamedOperandIdx(MI.getOpcode(), int srsrc = AMDGPU::getNamedOperandIdx(MI.getOpcode(),

View File

@ -5987,7 +5987,7 @@ SDValue SITargetLowering::lowerImage(SDValue Op,
const AMDGPU::MIMGMIPMappingInfo *MIPMappingInfo = const AMDGPU::MIMGMIPMappingInfo *MIPMappingInfo =
AMDGPU::getMIMGMIPMappingInfo(Intr->BaseOpcode); AMDGPU::getMIMGMIPMappingInfo(Intr->BaseOpcode);
unsigned IntrOpcode = Intr->BaseOpcode; unsigned IntrOpcode = Intr->BaseOpcode;
bool IsGFX10 = Subtarget->getGeneration() >= AMDGPUSubtarget::GFX10; bool IsGFX10Plus = AMDGPU::isGFX10Plus(*Subtarget);
SmallVector<EVT, 3> ResultTypes(Op->value_begin(), Op->value_end()); SmallVector<EVT, 3> ResultTypes(Op->value_begin(), Op->value_end());
SmallVector<EVT, 3> OrigResultTypes(Op->value_begin(), Op->value_end()); SmallVector<EVT, 3> OrigResultTypes(Op->value_begin(), Op->value_end());
@ -6235,11 +6235,11 @@ SDValue SITargetLowering::lowerImage(SDValue Op,
if (BaseOpcode->Atomic) { if (BaseOpcode->Atomic) {
GLC = True; // TODO no-return optimization GLC = True; // TODO no-return optimization
if (!parseCachePolicy(Op.getOperand(ArgOffset + Intr->CachePolicyIndex), if (!parseCachePolicy(Op.getOperand(ArgOffset + Intr->CachePolicyIndex),
DAG, nullptr, &SLC, IsGFX10 ? &DLC : nullptr)) DAG, nullptr, &SLC, IsGFX10Plus ? &DLC : nullptr))
return Op; return Op;
} else { } else {
if (!parseCachePolicy(Op.getOperand(ArgOffset + Intr->CachePolicyIndex), if (!parseCachePolicy(Op.getOperand(ArgOffset + Intr->CachePolicyIndex),
DAG, &GLC, &SLC, IsGFX10 ? &DLC : nullptr)) DAG, &GLC, &SLC, IsGFX10Plus ? &DLC : nullptr))
return Op; return Op;
} }
@ -6256,20 +6256,20 @@ SDValue SITargetLowering::lowerImage(SDValue Op,
if (BaseOpcode->Sampler) if (BaseOpcode->Sampler)
Ops.push_back(Op.getOperand(ArgOffset + Intr->SampIndex)); Ops.push_back(Op.getOperand(ArgOffset + Intr->SampIndex));
Ops.push_back(DAG.getTargetConstant(DMask, DL, MVT::i32)); Ops.push_back(DAG.getTargetConstant(DMask, DL, MVT::i32));
if (IsGFX10) if (IsGFX10Plus)
Ops.push_back(DAG.getTargetConstant(DimInfo->Encoding, DL, MVT::i32)); Ops.push_back(DAG.getTargetConstant(DimInfo->Encoding, DL, MVT::i32));
Ops.push_back(Unorm); Ops.push_back(Unorm);
if (IsGFX10) if (IsGFX10Plus)
Ops.push_back(DLC); Ops.push_back(DLC);
Ops.push_back(GLC); Ops.push_back(GLC);
Ops.push_back(SLC); Ops.push_back(SLC);
Ops.push_back(IsA16 && // r128, a16 for gfx9 Ops.push_back(IsA16 && // r128, a16 for gfx9
ST->hasFeature(AMDGPU::FeatureR128A16) ? True : False); ST->hasFeature(AMDGPU::FeatureR128A16) ? True : False);
if (IsGFX10) if (IsGFX10Plus)
Ops.push_back(IsA16 ? True : False); Ops.push_back(IsA16 ? True : False);
Ops.push_back(TFE); Ops.push_back(TFE);
Ops.push_back(LWE); Ops.push_back(LWE);
if (!IsGFX10) if (!IsGFX10Plus)
Ops.push_back(DimInfo->DA ? True : False); Ops.push_back(DimInfo->DA ? True : False);
if (BaseOpcode->HasD16) if (BaseOpcode->HasD16)
Ops.push_back(IsD16 ? True : False); Ops.push_back(IsD16 ? True : False);
@ -6280,7 +6280,7 @@ SDValue SITargetLowering::lowerImage(SDValue Op,
UseNSA ? VAddrs.size() : VAddr.getValueType().getSizeInBits() / 32; UseNSA ? VAddrs.size() : VAddr.getValueType().getSizeInBits() / 32;
int Opcode = -1; int Opcode = -1;
if (IsGFX10) { if (IsGFX10Plus) {
Opcode = AMDGPU::getMIMGOpcode(IntrOpcode, Opcode = AMDGPU::getMIMGOpcode(IntrOpcode,
UseNSA ? AMDGPU::MIMGEncGfx10NSA UseNSA ? AMDGPU::MIMGEncGfx10NSA
: AMDGPU::MIMGEncGfx10Default, : AMDGPU::MIMGEncGfx10Default,
@ -6559,11 +6559,11 @@ SDValue SITargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op,
return DAG.getConstant(MF.getSubtarget<GCNSubtarget>().getWavefrontSize(), return DAG.getConstant(MF.getSubtarget<GCNSubtarget>().getWavefrontSize(),
SDLoc(Op), MVT::i32); SDLoc(Op), MVT::i32);
case Intrinsic::amdgcn_s_buffer_load: { case Intrinsic::amdgcn_s_buffer_load: {
bool IsGFX10 = Subtarget->getGeneration() >= AMDGPUSubtarget::GFX10; bool IsGFX10Plus = AMDGPU::isGFX10Plus(*Subtarget);
SDValue GLC; SDValue GLC;
SDValue DLC = DAG.getTargetConstant(0, DL, MVT::i1); SDValue DLC = DAG.getTargetConstant(0, DL, MVT::i1);
if (!parseCachePolicy(Op.getOperand(3), DAG, &GLC, nullptr, if (!parseCachePolicy(Op.getOperand(3), DAG, &GLC, nullptr,
IsGFX10 ? &DLC : nullptr)) IsGFX10Plus ? &DLC : nullptr))
return Op; return Op;
return lowerSBuffer(VT, DL, Op.getOperand(1), Op.getOperand(2), Op.getOperand(3), return lowerSBuffer(VT, DL, Op.getOperand(1), Op.getOperand(2), Op.getOperand(3),
DAG); DAG);

View File

@ -310,7 +310,7 @@ unsigned getEUsPerCU(const MCSubtargetInfo *STI) {
// "Per CU" really means "per whatever functional block the waves of a // "Per CU" really means "per whatever functional block the waves of a
// workgroup must share". For gfx10 in CU mode this is the CU, which contains // workgroup must share". For gfx10 in CU mode this is the CU, which contains
// two SIMDs. // two SIMDs.
if (isGFX10(*STI) && STI->getFeatureBits().test(FeatureCuMode)) if (isGFX10Plus(*STI) && STI->getFeatureBits().test(FeatureCuMode))
return 2; return 2;
// Pre-gfx10 a CU contains four SIMDs. For gfx10 in WGP mode the WGP contains // Pre-gfx10 a CU contains four SIMDs. For gfx10 in WGP mode the WGP contains
// two CUs, so a total of four SIMDs. // two CUs, so a total of four SIMDs.
@ -335,7 +335,7 @@ unsigned getMinWavesPerEU(const MCSubtargetInfo *STI) {
unsigned getMaxWavesPerEU(const MCSubtargetInfo *STI) { unsigned getMaxWavesPerEU(const MCSubtargetInfo *STI) {
// FIXME: Need to take scratch memory into account. // FIXME: Need to take scratch memory into account.
if (!isGFX10(*STI)) if (!isGFX10Plus(*STI))
return 10; return 10;
return hasGFX10_3Insts(*STI) ? 16 : 20; return hasGFX10_3Insts(*STI) ? 16 : 20;
} }
@ -485,7 +485,7 @@ unsigned getVGPREncodingGranule(const MCSubtargetInfo *STI,
} }
unsigned getTotalNumVGPRs(const MCSubtargetInfo *STI) { unsigned getTotalNumVGPRs(const MCSubtargetInfo *STI) {
if (!isGFX10(*STI)) if (!isGFX10Plus(*STI))
return 256; return 256;
return STI->getFeatureBits().test(FeatureWavefrontSize32) ? 1024 : 512; return STI->getFeatureBits().test(FeatureWavefrontSize32) ? 1024 : 512;
} }
@ -896,11 +896,11 @@ int64_t convertDfmtNfmt2Ufmt(unsigned Dfmt, unsigned Nfmt) {
} }
bool isValidFormatEncoding(unsigned Val, const MCSubtargetInfo &STI) { bool isValidFormatEncoding(unsigned Val, const MCSubtargetInfo &STI) {
return isGFX10(STI) ? (Val <= UFMT_MAX) : (Val <= DFMT_NFMT_MAX); return isGFX10Plus(STI) ? (Val <= UFMT_MAX) : (Val <= DFMT_NFMT_MAX);
} }
unsigned getDefaultFormatEncoding(const MCSubtargetInfo &STI) { unsigned getDefaultFormatEncoding(const MCSubtargetInfo &STI) {
if (isGFX10(STI)) if (isGFX10Plus(STI))
return UFMT_DEFAULT; return UFMT_DEFAULT;
return DFMT_NFMT_DEFAULT; return DFMT_NFMT_DEFAULT;
} }
@ -928,7 +928,7 @@ static bool isValidMsgId(int64_t MsgId) {
bool isValidMsgId(int64_t MsgId, const MCSubtargetInfo &STI, bool Strict) { bool isValidMsgId(int64_t MsgId, const MCSubtargetInfo &STI, bool Strict) {
if (Strict) { if (Strict) {
if (MsgId == ID_GS_ALLOC_REQ || MsgId == ID_GET_DOORBELL) if (MsgId == ID_GS_ALLOC_REQ || MsgId == ID_GET_DOORBELL)
return isGFX9(STI) || isGFX10(STI); return isGFX9Plus(STI);
else else
return isValidMsgId(MsgId); return isValidMsgId(MsgId);
} else { } else {
@ -1109,13 +1109,15 @@ bool isGFX9(const MCSubtargetInfo &STI) {
} }
bool isGFX9Plus(const MCSubtargetInfo &STI) { bool isGFX9Plus(const MCSubtargetInfo &STI) {
return isGFX9(STI) || isGFX10(STI); return isGFX9(STI) || isGFX10Plus(STI);
} }
bool isGFX10(const MCSubtargetInfo &STI) { bool isGFX10(const MCSubtargetInfo &STI) {
return STI.getFeatureBits()[AMDGPU::FeatureGFX10]; return STI.getFeatureBits()[AMDGPU::FeatureGFX10];
} }
bool isGFX10Plus(const MCSubtargetInfo &STI) { return isGFX10(STI); }
bool isGCN3Encoding(const MCSubtargetInfo &STI) { bool isGCN3Encoding(const MCSubtargetInfo &STI) {
return STI.getFeatureBits()[AMDGPU::FeatureGCN3Encoding]; return STI.getFeatureBits()[AMDGPU::FeatureGCN3Encoding];
} }
@ -1455,11 +1457,11 @@ bool isArgPassedInSGPR(const Argument *A) {
} }
static bool hasSMEMByteOffset(const MCSubtargetInfo &ST) { static bool hasSMEMByteOffset(const MCSubtargetInfo &ST) {
return isGCN3Encoding(ST) || isGFX10(ST); return isGCN3Encoding(ST) || isGFX10Plus(ST);
} }
static bool hasSMRDSignedImmOffset(const MCSubtargetInfo &ST) { static bool hasSMRDSignedImmOffset(const MCSubtargetInfo &ST) {
return isGFX9(ST) || isGFX10(ST); return isGFX9Plus(ST);
} }
bool isLegalSMRDEncodedUnsignedOffset(const MCSubtargetInfo &ST, bool isLegalSMRDEncodedUnsignedOffset(const MCSubtargetInfo &ST,
@ -1616,7 +1618,7 @@ const GcnBufferFormatInfo *getGcnBufferFormatInfo(uint8_t BitsPerComp,
uint8_t NumComponents, uint8_t NumComponents,
uint8_t NumFormat, uint8_t NumFormat,
const MCSubtargetInfo &STI) { const MCSubtargetInfo &STI) {
return isGFX10(STI) return isGFX10Plus(STI)
? getGfx10PlusBufferFormatInfo(BitsPerComp, NumComponents, ? getGfx10PlusBufferFormatInfo(BitsPerComp, NumComponents,
NumFormat) NumFormat)
: getGfx9BufferFormatInfo(BitsPerComp, NumComponents, NumFormat); : getGfx9BufferFormatInfo(BitsPerComp, NumComponents, NumFormat);
@ -1624,8 +1626,8 @@ const GcnBufferFormatInfo *getGcnBufferFormatInfo(uint8_t BitsPerComp,
const GcnBufferFormatInfo *getGcnBufferFormatInfo(uint8_t Format, const GcnBufferFormatInfo *getGcnBufferFormatInfo(uint8_t Format,
const MCSubtargetInfo &STI) { const MCSubtargetInfo &STI) {
return isGFX10(STI) ? getGfx10PlusBufferFormatInfo(Format) return isGFX10Plus(STI) ? getGfx10PlusBufferFormatInfo(Format)
: getGfx9BufferFormatInfo(Format); : getGfx9BufferFormatInfo(Format);
} }
} // namespace AMDGPU } // namespace AMDGPU

View File

@ -601,6 +601,7 @@ bool isVI(const MCSubtargetInfo &STI);
bool isGFX9(const MCSubtargetInfo &STI); bool isGFX9(const MCSubtargetInfo &STI);
bool isGFX9Plus(const MCSubtargetInfo &STI); bool isGFX9Plus(const MCSubtargetInfo &STI);
bool isGFX10(const MCSubtargetInfo &STI); bool isGFX10(const MCSubtargetInfo &STI);
bool isGFX10Plus(const MCSubtargetInfo &STI);
bool isGCN3Encoding(const MCSubtargetInfo &STI); bool isGCN3Encoding(const MCSubtargetInfo &STI);
bool isGFX10_BEncoding(const MCSubtargetInfo &STI); bool isGFX10_BEncoding(const MCSubtargetInfo &STI);
bool hasGFX10_3Insts(const MCSubtargetInfo &STI); bool hasGFX10_3Insts(const MCSubtargetInfo &STI);