[llvm] [SPIRV] Let atomic store store pointers (PR #201251)

Nick Sarnie via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 4 08:23:28 PDT 2026


================
@@ -0,0 +1,23 @@
+; RUN: llc -O0 -mtriple=spirv64-- %s -o - | FileCheck %s
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-- %s -o - -filetype=obj | spirv-val %}
+
+; Check that 'store atomic' LLVM IR instructions are lowered correctly to
+; OpAtomicStore when a pointer is passed as value
+
+; CHECK-DAG: %[[#Int64:]] = OpTypeInt 64 0
+; CHECK-DAG: %[[#Int8:]] = OpTypeInt 8 0
+; CHECK-DAG: %[[#Int64Ptr:]] = OpTypePointer Generic %[[#Int64]]
+; CHECK-DAG: %[[#Int8Ptr:]] = OpTypePointer Generic %[[#Int8]]
+; CHECK-DAG: %[[#PtrInt8Ptr:]] = OpTypePointer Generic %[[#Int8Ptr]]
+
+define void @store_ptr(ptr addrspace(4) %ptr, ptr addrspace(4) %val) {
+; CHECK-LABEL: OpFunction %[[#]]
+; CHECK:       %[[#ptr:]] = OpFunctionParameter %[[#PtrInt8Ptr]]
+; CHECK:       %[[#val:]] = OpFunctionParameter %[[#Int8Ptr]]
+; CHECK:       %[[#convertVal:]] = OpConvertPtrToU %[[#Int64:]] %[[#val:]]
----------------
sarnex wrote:

we only use colons in the LIT var name when defining them, for just reading we just do `[[#val]]` or whatever

https://github.com/llvm/llvm-project/pull/201251


More information about the llvm-commits mailing list