1 ; RUN: opt -S -mtriple=amdgcn-unknown-unknown -amdgpu-annotate-kernel-features < %s | FileCheck -check-prefix=NOHSA -check-prefix=ALL %s
3 declare i32 @llvm.r600.read.tgid.x() #0
4 declare i32 @llvm.r600.read.tgid.y() #0
5 declare i32 @llvm.r600.read.tgid.z() #0
7 declare i32 @llvm.r600.read.tidig.x() #0
8 declare i32 @llvm.r600.read.tidig.y() #0
9 declare i32 @llvm.r600.read.tidig.z() #0
11 declare i32 @llvm.r600.read.local.size.x() #0
12 declare i32 @llvm.r600.read.local.size.y() #0
13 declare i32 @llvm.r600.read.local.size.z() #0
15 ; ALL: define amdgpu_kernel void @use_tgid_x(i32 addrspace(1)* %ptr) #1 {
16 define amdgpu_kernel void @use_tgid_x(i32 addrspace(1)* %ptr) #1 {
17 %val = call i32 @llvm.r600.read.tgid.x()
18 store i32 %val, i32 addrspace(1)* %ptr
22 ; ALL: define amdgpu_kernel void @use_tgid_y(i32 addrspace(1)* %ptr) #2 {
23 define amdgpu_kernel void @use_tgid_y(i32 addrspace(1)* %ptr) #1 {
24 %val = call i32 @llvm.r600.read.tgid.y()
25 store i32 %val, i32 addrspace(1)* %ptr
29 ; ALL: define amdgpu_kernel void @multi_use_tgid_y(i32 addrspace(1)* %ptr) #2 {
30 define amdgpu_kernel void @multi_use_tgid_y(i32 addrspace(1)* %ptr) #1 {
31 %val0 = call i32 @llvm.r600.read.tgid.y()
32 store volatile i32 %val0, i32 addrspace(1)* %ptr
33 %val1 = call i32 @llvm.r600.read.tgid.y()
34 store volatile i32 %val1, i32 addrspace(1)* %ptr
38 ; ALL: define amdgpu_kernel void @use_tgid_x_y(i32 addrspace(1)* %ptr) #2 {
39 define amdgpu_kernel void @use_tgid_x_y(i32 addrspace(1)* %ptr) #1 {
40 %val0 = call i32 @llvm.r600.read.tgid.x()
41 %val1 = call i32 @llvm.r600.read.tgid.y()
42 store volatile i32 %val0, i32 addrspace(1)* %ptr
43 store volatile i32 %val1, i32 addrspace(1)* %ptr
47 ; ALL: define amdgpu_kernel void @use_tgid_z(i32 addrspace(1)* %ptr) #3 {
48 define amdgpu_kernel void @use_tgid_z(i32 addrspace(1)* %ptr) #1 {
49 %val = call i32 @llvm.r600.read.tgid.z()
50 store i32 %val, i32 addrspace(1)* %ptr
54 ; ALL: define amdgpu_kernel void @use_tgid_x_z(i32 addrspace(1)* %ptr) #3 {
55 define amdgpu_kernel void @use_tgid_x_z(i32 addrspace(1)* %ptr) #1 {
56 %val0 = call i32 @llvm.r600.read.tgid.x()
57 %val1 = call i32 @llvm.r600.read.tgid.z()
58 store volatile i32 %val0, i32 addrspace(1)* %ptr
59 store volatile i32 %val1, i32 addrspace(1)* %ptr
63 ; ALL: define amdgpu_kernel void @use_tgid_y_z(i32 addrspace(1)* %ptr) #4 {
64 define amdgpu_kernel void @use_tgid_y_z(i32 addrspace(1)* %ptr) #1 {
65 %val0 = call i32 @llvm.r600.read.tgid.y()
66 %val1 = call i32 @llvm.r600.read.tgid.z()
67 store volatile i32 %val0, i32 addrspace(1)* %ptr
68 store volatile i32 %val1, i32 addrspace(1)* %ptr
72 ; ALL: define amdgpu_kernel void @use_tgid_x_y_z(i32 addrspace(1)* %ptr) #4 {
73 define amdgpu_kernel void @use_tgid_x_y_z(i32 addrspace(1)* %ptr) #1 {
74 %val0 = call i32 @llvm.r600.read.tgid.x()
75 %val1 = call i32 @llvm.r600.read.tgid.y()
76 %val2 = call i32 @llvm.r600.read.tgid.z()
77 store volatile i32 %val0, i32 addrspace(1)* %ptr
78 store volatile i32 %val1, i32 addrspace(1)* %ptr
79 store volatile i32 %val2, i32 addrspace(1)* %ptr
83 ; ALL: define amdgpu_kernel void @use_tidig_x(i32 addrspace(1)* %ptr) #1 {
84 define amdgpu_kernel void @use_tidig_x(i32 addrspace(1)* %ptr) #1 {
85 %val = call i32 @llvm.r600.read.tidig.x()
86 store i32 %val, i32 addrspace(1)* %ptr
90 ; ALL: define amdgpu_kernel void @use_tidig_y(i32 addrspace(1)* %ptr) #5 {
91 define amdgpu_kernel void @use_tidig_y(i32 addrspace(1)* %ptr) #1 {
92 %val = call i32 @llvm.r600.read.tidig.y()
93 store i32 %val, i32 addrspace(1)* %ptr
97 ; ALL: define amdgpu_kernel void @use_tidig_z(i32 addrspace(1)* %ptr) #6 {
98 define amdgpu_kernel void @use_tidig_z(i32 addrspace(1)* %ptr) #1 {
99 %val = call i32 @llvm.r600.read.tidig.z()
100 store i32 %val, i32 addrspace(1)* %ptr
104 ; ALL: define amdgpu_kernel void @use_tidig_x_tgid_x(i32 addrspace(1)* %ptr) #1 {
105 define amdgpu_kernel void @use_tidig_x_tgid_x(i32 addrspace(1)* %ptr) #1 {
106 %val0 = call i32 @llvm.r600.read.tidig.x()
107 %val1 = call i32 @llvm.r600.read.tgid.x()
108 store volatile i32 %val0, i32 addrspace(1)* %ptr
109 store volatile i32 %val1, i32 addrspace(1)* %ptr
113 ; ALL: define amdgpu_kernel void @use_tidig_y_tgid_y(i32 addrspace(1)* %ptr) #7 {
114 define amdgpu_kernel void @use_tidig_y_tgid_y(i32 addrspace(1)* %ptr) #1 {
115 %val0 = call i32 @llvm.r600.read.tidig.y()
116 %val1 = call i32 @llvm.r600.read.tgid.y()
117 store volatile i32 %val0, i32 addrspace(1)* %ptr
118 store volatile i32 %val1, i32 addrspace(1)* %ptr
122 ; ALL: define amdgpu_kernel void @use_tidig_x_y_z(i32 addrspace(1)* %ptr) #8 {
123 define amdgpu_kernel void @use_tidig_x_y_z(i32 addrspace(1)* %ptr) #1 {
124 %val0 = call i32 @llvm.r600.read.tidig.x()
125 %val1 = call i32 @llvm.r600.read.tidig.y()
126 %val2 = call i32 @llvm.r600.read.tidig.z()
127 store volatile i32 %val0, i32 addrspace(1)* %ptr
128 store volatile i32 %val1, i32 addrspace(1)* %ptr
129 store volatile i32 %val2, i32 addrspace(1)* %ptr
133 ; ALL: define amdgpu_kernel void @use_all_workitems(i32 addrspace(1)* %ptr) #9 {
134 define amdgpu_kernel void @use_all_workitems(i32 addrspace(1)* %ptr) #1 {
135 %val0 = call i32 @llvm.r600.read.tidig.x()
136 %val1 = call i32 @llvm.r600.read.tidig.y()
137 %val2 = call i32 @llvm.r600.read.tidig.z()
138 %val3 = call i32 @llvm.r600.read.tgid.x()
139 %val4 = call i32 @llvm.r600.read.tgid.y()
140 %val5 = call i32 @llvm.r600.read.tgid.z()
141 store volatile i32 %val0, i32 addrspace(1)* %ptr
142 store volatile i32 %val1, i32 addrspace(1)* %ptr
143 store volatile i32 %val2, i32 addrspace(1)* %ptr
144 store volatile i32 %val3, i32 addrspace(1)* %ptr
145 store volatile i32 %val4, i32 addrspace(1)* %ptr
146 store volatile i32 %val5, i32 addrspace(1)* %ptr
150 ; HSA: define amdgpu_kernel void @use_get_local_size_x(i32 addrspace(1)* %ptr) #10 {
151 ; NOHSA: define amdgpu_kernel void @use_get_local_size_x(i32 addrspace(1)* %ptr) #1 {
152 define amdgpu_kernel void @use_get_local_size_x(i32 addrspace(1)* %ptr) #1 {
153 %val = call i32 @llvm.r600.read.local.size.x()
154 store i32 %val, i32 addrspace(1)* %ptr
158 ; HSA: define amdgpu_kernel void @use_get_local_size_y(i32 addrspace(1)* %ptr) #10 {
159 ; NOHSA: define amdgpu_kernel void @use_get_local_size_y(i32 addrspace(1)* %ptr) #1 {
160 define amdgpu_kernel void @use_get_local_size_y(i32 addrspace(1)* %ptr) #1 {
161 %val = call i32 @llvm.r600.read.local.size.y()
162 store i32 %val, i32 addrspace(1)* %ptr
166 ; HSA: define amdgpu_kernel void @use_get_local_size_z(i32 addrspace(1)* %ptr) #10 {
167 ; NOHSA: define amdgpu_kernel void @use_get_local_size_z(i32 addrspace(1)* %ptr) #1 {
168 define amdgpu_kernel void @use_get_local_size_z(i32 addrspace(1)* %ptr) #1 {
169 %val = call i32 @llvm.r600.read.local.size.z()
170 store i32 %val, i32 addrspace(1)* %ptr
174 attributes #0 = { nounwind readnone }
175 attributes #1 = { nounwind }
177 ; HSA: attributes #0 = { nounwind readnone }
178 ; HSA: attributes #1 = { nounwind }
179 ; HSA: attributes #2 = { nounwind "amdgpu-work-group-id-y" }
180 ; HSA: attributes #3 = { nounwind "amdgpu-work-group-id-z" }
181 ; HSA: attributes #4 = { nounwind "amdgpu-work-group-id-y" "amdgpu-work-group-id-z" }
182 ; HSA: attributes #5 = { nounwind "amdgpu-work-item-id-y" }
183 ; HSA: attributes #6 = { nounwind "amdgpu-work-item-id-z" }
184 ; HSA: attributes #7 = { nounwind "amdgpu-work-group-id-y" "amdgpu-work-item-id-y" }
185 ; HSA: attributes #8 = { nounwind "amdgpu-work-item-id-y" "amdgpu-work-item-id-z" }
186 ; HSA: attributes #9 = { nounwind "amdgpu-work-group-id-y" "amdgpu-work-group-id-z" "amdgpu-work-item-id-y" "amdgpu-work-item-id-z" }
187 ; HSA: attributes #10 = { nounwind "amdgpu-dispatch-ptr" }