diff --git a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp --- a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp +++ b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp @@ -347,6 +347,8 @@ return isImm() && Imm.Type == ImmT; } + bool isImmLiteral() const { return isImmTy(ImmTyNone); } + bool isImmModifier() const { return isImm() && Imm.Type != ImmTyNone; } @@ -7940,7 +7942,7 @@ //===----------------------------------------------------------------------===// bool AMDGPUOperand::isSMRDOffset8() const { - return isImm() && isUInt<8>(getImm()); + return isImmLiteral() && isUInt<8>(getImm()); } bool AMDGPUOperand::isSMEMOffset() const { @@ -7951,7 +7953,7 @@ bool AMDGPUOperand::isSMRDLiteralOffset() const { // 32-bit literals are only supported on CI and we only want to use them // when the offset is > 8-bits. - return isImm() && !isUInt<8>(getImm()) && isUInt<32>(getImm()); + return isImmLiteral() && !isUInt<8>(getImm()) && isUInt<32>(getImm()); } AMDGPUOperand::Ptr AMDGPUAsmParser::defaultSMRDOffset8() const { @@ -8439,11 +8441,11 @@ } bool AMDGPUOperand::isS16Imm() const { - return isImm() && (isInt<16>(getImm()) || isUInt<16>(getImm())); + return isImmLiteral() && (isInt<16>(getImm()) || isUInt<16>(getImm())); } bool AMDGPUOperand::isU16Imm() const { - return isImm() && isUInt<16>(getImm()); + return isImmLiteral() && isUInt<16>(getImm()); } //===----------------------------------------------------------------------===// diff --git a/llvm/test/MC/AMDGPU/gfx7_unsupported.s b/llvm/test/MC/AMDGPU/gfx7_unsupported.s --- a/llvm/test/MC/AMDGPU/gfx7_unsupported.s +++ b/llvm/test/MC/AMDGPU/gfx7_unsupported.s @@ -3198,3 +3198,10 @@ v_xor_b32_sdwa v255, v1, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD // CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: sdwa variant of this instruction is not supported + +//===----------------------------------------------------------------------===// +// cache policy is not supported for SMRD instructions +//===----------------------------------------------------------------------===// + +s_load_dword s5, s[2:3], glc +// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: cache policy is not supported for SMRD instructions