Debian Codegraph @

llvm/test/CodeGen/SPIRV/instructions/atomic-ptr.ll

raw
1 ; The goal of the test case is to ensure that the Backend doesn't crash on the stage
2 ; of type inference. Result SPIR-V is not expected to be valid from the perspective
3 ; of spirv-val in this case, because there is a difference of accepted return types
4 ; between atomicrmw and OpAtomicExchange.
5
6 ; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
7 ; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
8
9 ; CHECK-DAG: %[[#LongTy:]] = OpTypeInt 64 0
10 ; CHECK-DAG: %[[#PtrLongTy:]] = OpTypePointer CrossWorkgroup %[[#LongTy]]
11 ; CHECK-DAG: %[[#IntTy:]] = OpTypeInt 32 0
12 ; CHECK-DAG: %[[#Scope:]] = OpConstantNull %[[#IntTy]]
13 ; CHECK-DAG: %[[#MemSem:]] = OpConstant %[[#IntTy]] 8
14 ; CHECK-DAG: %[[#PtrPtrLongTy:]] = OpTypePointer CrossWorkgroup %[[#PtrLongTy]]
15
16 ; CHECK: OpFunction
17 ; CHECK: %[[#Arg1:]] = OpFunctionParameter %[[#PtrPtrLongTy]]
18 ; CHECK: %[[#Arg2:]] = OpFunctionParameter %[[#PtrLongTy]]
19 ; CHECK: OpAtomicExchange %[[#PtrLongTy]] %[[#Arg1]] %[[#Scope]] %[[#MemSem]] %[[#Arg2]]
20 ; CHECK: OpFunctionEnd
21
22 define dso_local spir_func void @test1(ptr addrspace(1) %arg1, ptr addrspace(1) byval(i64) %arg_ptr) {
23 entry:
24 %r = atomicrmw xchg ptr addrspace(1) %arg1, ptr addrspace(1) %arg_ptr acq_rel
25 ret void
26 }
27
28 ; CHECK: OpFunction
29 ; CHECK: %[[#Arg3:]] = OpFunctionParameter %[[#PtrLongTy]]
30 ; CHECK: %[[#Arg4:]] = OpFunctionParameter %[[#LongTy]]
31 ; CHECK: OpAtomicExchange %[[#LongTy]] %[[#Arg3]] %[[#Scope]] %[[#MemSem]] %[[#Arg4]]
32 ; CHECK: OpFunctionEnd
33
34 define dso_local spir_func void @test2(ptr addrspace(1) %arg1, i64 %arg_ptr) {
35 entry:
36 %r = atomicrmw xchg ptr addrspace(1) %arg1, i64 %arg_ptr acq_rel
37 ret void
38 }