[PATCH] D159239: [AMDGPU] Incorrect error message regarding SCC modifier

Jun Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 30 16:35:02 PDT 2023


jwanggit86 created this revision.
jwanggit86 added a reviewer: arsenm.
Herald added subscribers: kosarev, foad, kerbowa, hiraditya, tpr, dstuttard, yaxunl, jvesely, kzhuravl.
Herald added a project: All.
jwanggit86 requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

For the AMD GFX90A GPU, the SCC instruction modifier is allowed
for certain classes of instructions. However, the current assembler
generates an error message, "scc is not supported on this GPU",
regardless of the instruciton. This fix modifies the message as well
as the logic for generating the message.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159239

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


Index: llvm/test/MC/AMDGPU/gfx90a_err.s
===================================================================
--- llvm/test/MC/AMDGPU/gfx90a_err.s
+++ llvm/test/MC/AMDGPU/gfx90a_err.s
@@ -195,57 +195,6 @@
 image_sample_b v[0:3], v[0:1], s[4:11], s[16:19] dmask:0xf
 // GFX90A: :[[@LINE-1]]:{{[0-9]+}}: error: instruction not supported on this GPU
 
-global_atomic_add_f32 v0, v[0:1], v2, off glc scc
-// GFX90A: :[[@LINE-1]]:{{[0-9]+}}: error: scc is not supported on this GPU
-
-global_atomic_add_f32 v[0:1], v2, off scc
-// GFX90A: :[[@LINE-1]]:{{[0-9]+}}: error: scc is not supported on this GPU
-
-global_atomic_add_f32 v0, v2, s[0:1] scc
-// GFX90A: :[[@LINE-1]]:{{[0-9]+}}: error: scc is not supported on this GPU
-
-global_atomic_add_f32 v1, v0, v2, s[0:1] glc scc
-// GFX90A: :[[@LINE-1]]:{{[0-9]+}}: error: scc is not supported on this GPU
-
-global_atomic_pk_add_f16 v0, v[0:1], v2, off glc scc
-// GFX90A: :[[@LINE-1]]:{{[0-9]+}}: error: scc is not supported on this GPU
-
-flat_atomic_add_f64 v[0:1], v[0:1], v[2:3] glc scc
-// GFX90A: :[[@LINE-1]]:{{[0-9]+}}: error: scc is not supported on this GPU
-
-flat_atomic_add_f64 v[0:1], v[2:3] scc
-// GFX90A: :[[@LINE-1]]:{{[0-9]+}}: error: scc is not supported on this GPU
-
-flat_atomic_min_f64 v[0:1], v[2:3] scc
-// GFX90A: :[[@LINE-1]]:{{[0-9]+}}: error: scc is not supported on this GPU
-
-flat_atomic_max_f64 v[0:1], v[2:3] scc
-// GFX90A: :[[@LINE-1]]:{{[0-9]+}}: error: scc is not supported on this GPU
-
-global_atomic_add_f64 v[0:1], v[2:3], off scc
-// GFX90A: :[[@LINE-1]]:{{[0-9]+}}: error: scc is not supported on this GPU
-
-global_atomic_min_f64 v[0:1], v[2:3], off scc
-// GFX90A: :[[@LINE-1]]:{{[0-9]+}}: error: scc is not supported on this GPU
-
-global_atomic_max_f64 v[0:1], v[2:3], off scc
-// GFX90A: :[[@LINE-1]]:{{[0-9]+}}: error: scc is not supported on this GPU
-
-buffer_atomic_add_f32 v4, off, s[8:11], s3 scc
-// GFX90A: :[[@LINE-1]]:{{[0-9]+}}: error: scc is not supported on this GPU
-
-buffer_atomic_pk_add_f16 v4, off, s[8:11], s3 scc
-// GFX90A: :[[@LINE-1]]:{{[0-9]+}}: error: scc is not supported on this GPU
-
-buffer_atomic_add_f64 v[4:5], off, s[8:11], s3 scc
-// GFX90A: :[[@LINE-1]]:{{[0-9]+}}: error: scc is not supported on this GPU
-
-buffer_atomic_max_f64 v[4:5], off, s[8:11], s3 scc
-// GFX90A: :[[@LINE-1]]:{{[0-9]+}}: error: scc is not supported on this GPU
-
-buffer_atomic_min_f64 v[4:5], off, s[8:11], s3 scc
-// GFX90A: :[[@LINE-1]]:{{[0-9]+}}: error: scc is not supported on this GPU
-
 v_mov_b32_sdwa v1, src_lds_direct dst_sel:DWORD
 // GFX90A: :[[@LINE-1]]:{{[0-9]+}}: error: lds_direct is not supported on this GPU
 
Index: llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
+++ llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
@@ -4480,11 +4480,13 @@
   }
 
   if (isGFX90A() && !isGFX940() && (CPol & CPol::SCC)) {
-    SMLoc S = getImmLoc(AMDGPUOperand::ImmTyCPol, Operands);
-    StringRef CStr(S.getPointer());
-    S = SMLoc::getFromPointer(&CStr.data()[CStr.find("scc")]);
-    Error(S, "scc is not supported on this GPU");
-    return false;
+    if (!(TSFlags & (SIInstrFlags::MUBUF | SIInstrFlags::MTBUF | SIInstrFlags::MIMG | SIInstrFlags::FLAT))) {
+      SMLoc S = getImmLoc(AMDGPUOperand::ImmTyCPol, Operands);
+      StringRef CStr(S.getPointer());
+      S = SMLoc::getFromPointer(&CStr.data()[CStr.find("scc")]);
+      Error(S, "scc modifier is not supported for this instruction on this GPU");
+      return false;
+    }
   }
 
   if (!(TSFlags & (SIInstrFlags::IsAtomicNoRet | SIInstrFlags::IsAtomicRet)))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159239.554856.patch
Type: text/x-patch
Size: 3674 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230830/ed2b0a40/attachment.bin>


More information about the llvm-commits mailing list