1 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
3 ; CHECK-DAG: OpName %[[#BAR:]] "bar"
4 ; CHECK-DAG: OpName %[[#FOO:]] "foo"
5 ; CHECK-DAG: OpName %[[#GOO:]] "goo"
7 ; CHECK-DAG: %[[#INT:]] = OpTypeInt 32
8 ; CHECK-DAG: %[[#STACK_PTR_INT:]] = OpTypePointer Function %[[#INT]]
9 ; CHECK-DAG: %[[#GLOBAL_PTR_INT:]] = OpTypePointer CrossWorkgroup %[[#INT]]
10 ; CHECK-DAG: %[[#FN1:]] = OpTypeFunction %[[#INT]] %[[#INT]]
11 ; CHECK-DAG: %[[#FN2:]] = OpTypeFunction %[[#INT]] %[[#INT]] %[[#GLOBAL_PTR_INT]]
13 define i32 @bar(i32 %a) {
16 %b = load i32, i32* %p
20 ; CHECK: %[[#BAR]] = OpFunction %[[#INT]] None %[[#FN1]]
21 ; CHECK: %[[#A:]] = OpFunctionParameter %[[#INT]]
23 ; CHECK: %[[#P:]] = OpVariable %[[#STACK_PTR_INT]] Function
24 ; CHECK: OpStore %[[#P]] %[[#A]]
25 ; CHECK: %[[#B:]] = OpLoad %[[#INT]] %[[#P]]
26 ; CHECK: OpReturnValue %[[#B]]
27 ; CHECK: OpFunctionEnd
30 define i32 @foo(i32 %a) {
32 store volatile i32 %a, i32* %p
33 %b = load volatile i32, i32* %p
37 ; CHECK: %[[#FOO]] = OpFunction %[[#INT]] None %[[#FN1]]
38 ; CHECK: %[[#A:]] = OpFunctionParameter %[[#INT]]
40 ; CHECK: %[[#P:]] = OpVariable %[[#STACK_PTR_INT]] Function
41 ; CHECK: OpStore %[[#P]] %[[#A]] Volatile
42 ; CHECK: %[[#B:]] = OpLoad %[[#INT]] %[[#P]] Volatile
43 ; CHECK: OpReturnValue %[[#B]]
44 ; CHECK: OpFunctionEnd
47 ;; Test load and store in global address space.
48 define i32 @goo(i32 %a, ptr addrspace(1) %p) {
49 store i32 %a, i32 addrspace(1)* %p
50 %b = load i32, i32 addrspace(1)* %p
54 ; CHECK: %[[#GOO]] = OpFunction %[[#INT]] None %[[#FN2]]
55 ; CHECK: %[[#A:]] = OpFunctionParameter %[[#INT]]
56 ; CHECK: %[[#P:]] = OpFunctionParameter %[[#GLOBAL_PTR_INT]]
58 ; CHECK: OpStore %[[#P]] %[[#A]]
59 ; CHECK: %[[#B:]] = OpLoad %[[#INT]] %[[#P]]
60 ; CHECK: OpReturnValue %[[#B]]
61 ; CHECK: OpFunctionEnd