Index: llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp =================================================================== --- llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp +++ llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp @@ -4394,7 +4394,8 @@ if (CPol & CPol::GLC) { SMLoc S = getImmLoc(AMDGPUOperand::ImmTyCPol, Operands); StringRef CStr(S.getPointer()); - S = SMLoc::getFromPointer(&CStr.data()[CStr.find("glc")]); + S = SMLoc::getFromPointer( + &CStr.data()[CStr.find(isGFX940() ? "sc0" : "glc")]); Error(S, isGFX940() ? "instruction must not use sc0" : "instruction must not use glc"); return false; Index: llvm/test/MC/AMDGPU/gfx940_err_pos.s =================================================================== --- /dev/null +++ llvm/test/MC/AMDGPU/gfx940_err_pos.s @@ -0,0 +1,14 @@ +// RUN: not llvm-mc -arch=amdgcn -mcpu=gfx940 %s 2>&1 | FileCheck %s --implicit-check-not=error: --strict-whitespace + +//============================================================================== +// instruction must not use sc0 + +global_atomic_or v[0:1], v2, off sc1 nt sc0 +// CHECK: error: instruction must not use sc0 +// CHECK-NEXT:{{^}}global_atomic_or v[0:1], v2, off sc1 nt sc0 +// CHECK-NEXT:{{^}} ^ + +global_atomic_or v[0:1], v2, off sc0 sc1 nt +// CHECK: error: instruction must not use sc0 +// CHECK-NEXT:{{^}}global_atomic_or v[0:1], v2, off sc0 sc1 nt +// CHECK-NEXT:{{^}} ^