[llvm] [SPIRV] Let atomic load load pointers (PR #202823)
Dmitry Sidorov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 10 14:46:14 PDT 2026
================
@@ -0,0 +1,30 @@
+; RUN: llc -O0 -mtriple=spirv32 %s -o - | FileCheck %s --check-prefixes=CHECK,SPIRV32
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-- %s -o - -filetype=obj | spirv-val %}
+
+; RUN: llc -O0 -mtriple=spirv64 %s -o - | FileCheck %s --check-prefixes=CHECK,SPIRV64
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-- %s -o - -filetype=obj | spirv-val %}
+
+
+; Check that 'load atomic' LLVM IR instructions are lowered correctly to
+; OpAtomicLoad when a pointer is passed as value.
+
+; SPIRV32-DAG: %[[#Int32:]] = OpTypeInt 32 0
+; CHECK-DAG: %[[#Int8:]] = OpTypeInt 8 0
+; SPIRV32-DAG: %[[#Int32Ptr:]] = OpTypePointer Generic %[[#Int32]]
+; CHECK-DAG: %[[#Int8Ptr:]] = OpTypePointer Generic %[[#Int8]]
+; CHECK-DAG: %[[#PtrInt8Ptr:]] = OpTypePointer Generic %[[#Int8Ptr]]
+; SPIRV64-DAG: %[[#Int64:]] = OpTypeInt 64 0
+; SPIRV64-DAG: %[[#Int64Ptr:]] = OpTypePointer Generic %[[#Int64]]
+
+define ptr addrspace(4) @load_ptr(ptr addrspace(4) %ptr) {
----------------
MrSidims wrote:
nit:
```suggestion
define ptr addrspace(4) @load_ptr(ptr addrspace(4) %ptr) {
```
https://github.com/llvm/llvm-project/pull/202823
More information about the llvm-commits
mailing list