[PATCH] D124099: [AMDGPU][MC][NFC][GFX940] Corrected an error position

Dmitry Preobrazhensky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 20 09:17:30 PDT 2022


dp created this revision.
dp added reviewers: rampitec, foad.
Herald added subscribers: hsmhsm, kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl, arsenm.
Herald added a project: All.
dp requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

https://reviews.llvm.org/D124099

Files:
  llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
  llvm/test/MC/AMDGPU/gfx940_err_pos.s


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:{{^}}                                 ^
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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124099.423928.patch
Type: text/x-patch
Size: 1556 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220420/0d1941b5/attachment.bin>


More information about the llvm-commits mailing list