Debian Codegraph @

llvm/test/CodeGen/SPIRV/ExecutionMode.ll

raw
1 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
2 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3
4 ; CHECK-DAG: %[[#VOID:]] = OpTypeVoid
5
6 ; CHECK-DAG: OpEntryPoint Kernel %[[#WORKER:]] "worker"
7 ; CHECK-DAG: OpEntryPoint Kernel %[[#INIT:]] "_SPIRV_GLOBAL__I_45b04794_Test_attr.cl"
8 ; CHECK-DAG: OpEntryPoint Kernel %[[#FIN:]] "_SPIRV_GLOBAL__D_45b04794_Test_attr.cl"
9
10 ; CHECK-DAG: OpExecutionMode %[[#WORKER]] LocalSize 10 10 10
11 ; CHECK-DAG: OpExecutionMode %[[#WORKER]] LocalSizeHint 12 10 1
12 ; CHECK-DAG: OpExecutionMode %[[#WORKER]] VecTypeHint 262149
13 ; CHECK-DAG: OpExecutionMode %[[#WORKER]] SubgroupsPerWorkgroup 4
14 ; CHECK-DAG: OpExecutionMode %[[#INIT]] LocalSize 1 1 1
15 ; CHECK-DAG: OpExecutionMode %[[#INIT]] Initializer
16 ; CHECK-DAG: OpExecutionMode %[[#FIN]] LocalSize 1 1 1
17 ; CHECK-DAG: OpExecutionMode %[[#FIN]] Finalizer
18
19 %struct.global_ctor_dtor = type { i32 }
20
21 @g = addrspace(1) global %struct.global_ctor_dtor zeroinitializer, align 4
22
23 define internal spir_func void @__cxx_global_var_init() {
24 entry:
25 call spir_func void @_ZNU3AS416global_ctor_dtorC1Ei(ptr addrspace(4) addrspacecast (ptr addrspace(1) @g to ptr addrspace(4)), i32 12)
26 ret void
27 }
28
29 define linkonce_odr spir_func void @_ZNU3AS416global_ctor_dtorC1Ei(ptr addrspace(4) %this, i32 %i) unnamed_addr align 2 {
30 entry:
31 %this.addr = alloca ptr addrspace(4), align 4
32 %i.addr = alloca i32, align 4
33 store ptr addrspace(4) %this, ptr %this.addr, align 4
34 store i32 %i, ptr %i.addr, align 4
35 %this1 = load ptr addrspace(4), ptr %this.addr
36 %0 = load i32, ptr %i.addr, align 4
37 call spir_func void @_ZNU3AS416global_ctor_dtorC2Ei(ptr addrspace(4) %this1, i32 %0)
38 ret void
39 }
40
41 define linkonce_odr spir_func void @_ZNU3AS416global_ctor_dtorD1Ev(ptr addrspace(4) %this) unnamed_addr align 2 {
42 entry:
43 %this.addr = alloca ptr addrspace(4), align 4
44 store ptr addrspace(4) %this, ptr %this.addr, align 4
45 %this1 = load ptr addrspace(4), ptr %this.addr
46 call spir_func void @_ZNU3AS416global_ctor_dtorD2Ev(ptr addrspace(4) %this1)
47 ret void
48 }
49
50 define internal spir_func void @__dtor_g() {
51 entry:
52 call spir_func void @_ZNU3AS416global_ctor_dtorD1Ev(ptr addrspace(4) addrspacecast (ptr addrspace(1) @g to ptr addrspace(4)))
53 ret void
54 }
55
56 ; CHECK: %[[#WORKER]] = OpFunction %[[#VOID]]
57
58 define spir_kernel void @worker() {
59 entry:
60 ret void
61 }
62
63 define linkonce_odr spir_func void @_ZNU3AS416global_ctor_dtorD2Ev(ptr addrspace(4) %this) unnamed_addr align 2 {
64 entry:
65 %this.addr = alloca ptr addrspace(4), align 4
66 store ptr addrspace(4) %this, ptr %this.addr, align 4
67 %this1 = load ptr addrspace(4), ptr %this.addr
68 %a = getelementptr inbounds %struct.global_ctor_dtor, ptr addrspace(4) %this1, i32 0, i32 0
69 store i32 0, ptr addrspace(4) %a, align 4
70 ret void
71 }
72
73 define linkonce_odr spir_func void @_ZNU3AS416global_ctor_dtorC2Ei(ptr addrspace(4) %this, i32 %i) unnamed_addr align 2 {
74 entry:
75 %this.addr = alloca ptr addrspace(4), align 4
76 %i.addr = alloca i32, align 4
77 store ptr addrspace(4) %this, ptr %this.addr, align 4
78 store i32 %i, ptr %i.addr, align 4
79 %this1 = load ptr addrspace(4), ptr %this.addr
80 %0 = load i32, ptr %i.addr, align 4
81 %a = getelementptr inbounds %struct.global_ctor_dtor, ptr addrspace(4) %this1, i32 0, i32 0
82 store i32 %0, ptr addrspace(4) %a, align 4
83 ret void
84 }
85
86 define internal spir_func void @_GLOBAL__sub_I_Test_attr.cl() {
87 entry:
88 call spir_func void @__cxx_global_var_init()
89 ret void
90 }
91
92 ; CHECK: %[[#INIT]] = OpFunction %[[#VOID]]
93
94 define spir_kernel void @_SPIRV_GLOBAL__I_45b04794_Test_attr.cl() {
95 entry:
96 call spir_func void @_GLOBAL__sub_I_Test_attr.cl()
97 ret void
98 }
99
100 ; CHECK: %[[#FIN]] = OpFunction %[[#VOID]]
101
102 define spir_kernel void @_SPIRV_GLOBAL__D_45b04794_Test_attr.cl() {
103 entry:
104 call spir_func void @__dtor_g()
105 ret void
106 }
107
108 !spirv.ExecutionMode = !{!0, !1, !2, !3, !4, !5, !6, !7}
109
110 !0 = !{ptr @worker, i32 30, i32 262149}
111 !1 = !{ptr @worker, i32 18, i32 12, i32 10, i32 1}
112 !2 = !{ptr @worker, i32 17, i32 10, i32 10, i32 10}
113 !3 = !{ptr @worker, i32 36, i32 4}
114 !4 = !{ptr @_SPIRV_GLOBAL__I_45b04794_Test_attr.cl, i32 33}
115 !5 = !{ptr @_SPIRV_GLOBAL__I_45b04794_Test_attr.cl, i32 17, i32 1, i32 1, i32 1}
116 !6 = !{ptr @_SPIRV_GLOBAL__D_45b04794_Test_attr.cl, i32 34}
117 !7 = !{ptr @_SPIRV_GLOBAL__D_45b04794_Test_attr.cl, i32 17, i32 1, i32 1, i32 1}