Skip to content

Commit

Permalink
[AMDGPU][MC][GFX11][NFC] Improve error message when a VOPD opcode is …
Browse files Browse the repository at this point in the history
…used with WS64

Differential Revision: https://reviews.llvm.org/D136168
  • Loading branch information
dpreobra committed Oct 20, 2022
1 parent d7d05ff commit db3e858
Show file tree
Hide file tree
Showing 2 changed files with 3,719 additions and 3,705 deletions.
16 changes: 15 additions & 1 deletion llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
Expand Up @@ -4805,7 +4805,7 @@ bool AMDGPUAsmParser::isSupportedMnemo(StringRef Mnemo,

bool AMDGPUAsmParser::checkUnsupportedInstruction(StringRef Mnemo,
const SMLoc &IDLoc) {
FeatureBitset FBS = ComputeAvailableFeatures(getSTI().getFeatureBits());
FeatureBitset FBS = ComputeAvailableFeatures(getFeatureBits());

// Check if requested instruction variant is supported.
if (isSupportedMnemo(Mnemo, FBS, getMatchedVariants()))
Expand All @@ -4824,6 +4824,20 @@ bool AMDGPUAsmParser::checkUnsupportedInstruction(StringRef Mnemo,
" variant of this instruction is not supported"));
}

// Check if this instruction may be used with a different wavesize.
if (isGFX10Plus() && getFeatureBits()[AMDGPU::FeatureWavefrontSize64] &&
!getFeatureBits()[AMDGPU::FeatureWavefrontSize32]) {

FeatureBitset FeaturesWS32 = getFeatureBits();
FeaturesWS32.flip(AMDGPU::FeatureWavefrontSize64)
.flip(AMDGPU::FeatureWavefrontSize32);
FeatureBitset AvailableFeaturesWS32 =
ComputeAvailableFeatures(FeaturesWS32);

if (isSupportedMnemo(Mnemo, AvailableFeaturesWS32, getMatchedVariants()))
return Error(IDLoc, "instruction requires wavesize=32");
}

// Finally check if this instruction is supported on any other GPU.
if (isSupportedMnemo(Mnemo, FeatureBitset().set())) {
return Error(IDLoc, "instruction not supported on this GPU");
Expand Down

0 comments on commit db3e858

Please sign in to comment.