1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-globals
2 ; RUN: opt -mtriple=amdgcn-unknown-amdhsa -S -amdgpu-annotate-kernel-features < %s | FileCheck -check-prefixes=AKF_HSA %s
3 ; RUN: opt -mtriple=amdgcn-unknown-amdhsa -S -amdgpu-attributor < %s | FileCheck -check-prefixes=ATTRIBUTOR_HSA %s
5 ; TODO: The test contains UB which is refined by the Attributor and should be removed.
7 declare i32 @llvm.amdgcn.workgroup.id.x() #0
8 declare i32 @llvm.amdgcn.workgroup.id.y() #0
9 declare i32 @llvm.amdgcn.workgroup.id.z() #0
11 declare i32 @llvm.amdgcn.workitem.id.x() #0
12 declare i32 @llvm.amdgcn.workitem.id.y() #0
13 declare i32 @llvm.amdgcn.workitem.id.z() #0
15 declare i8 addrspace(4)* @llvm.amdgcn.dispatch.ptr() #0
16 declare i8 addrspace(4)* @llvm.amdgcn.queue.ptr() #0
17 declare i8 addrspace(4)* @llvm.amdgcn.kernarg.segment.ptr() #0
18 declare i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr() #0
19 declare i64 @llvm.amdgcn.dispatch.id() #0
21 define void @use_workitem_id_x() #1 {
22 ; AKF_HSA-LABEL: define {{[^@]+}}@use_workitem_id_x
23 ; AKF_HSA-SAME: () #[[ATTR1:[0-9]+]] {
24 ; AKF_HSA-NEXT: [[VAL:%.*]] = call i32 @llvm.amdgcn.workitem.id.x()
25 ; AKF_HSA-NEXT: store volatile i32 [[VAL]], i32 addrspace(1)* undef, align 4
26 ; AKF_HSA-NEXT: ret void
28 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@use_workitem_id_x
29 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1:[0-9]+]] {
30 ; ATTRIBUTOR_HSA-NEXT: store volatile i32 undef, i32 addrspace(1)* undef, align 4
31 ; ATTRIBUTOR_HSA-NEXT: ret void
33 %val = call i32 @llvm.amdgcn.workitem.id.x()
34 store volatile i32 %val, i32 addrspace(1)* undef
38 define void @use_workitem_id_y() #1 {
39 ; AKF_HSA-LABEL: define {{[^@]+}}@use_workitem_id_y
40 ; AKF_HSA-SAME: () #[[ATTR2:[0-9]+]] {
41 ; AKF_HSA-NEXT: [[VAL:%.*]] = call i32 @llvm.amdgcn.workitem.id.y()
42 ; AKF_HSA-NEXT: store volatile i32 [[VAL]], i32 addrspace(1)* undef, align 4
43 ; AKF_HSA-NEXT: ret void
45 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@use_workitem_id_y
46 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
47 ; ATTRIBUTOR_HSA-NEXT: store volatile i32 undef, i32 addrspace(1)* undef, align 4
48 ; ATTRIBUTOR_HSA-NEXT: ret void
50 %val = call i32 @llvm.amdgcn.workitem.id.y()
51 store volatile i32 %val, i32 addrspace(1)* undef
55 define void @use_workitem_id_z() #1 {
56 ; AKF_HSA-LABEL: define {{[^@]+}}@use_workitem_id_z
57 ; AKF_HSA-SAME: () #[[ATTR3:[0-9]+]] {
58 ; AKF_HSA-NEXT: [[VAL:%.*]] = call i32 @llvm.amdgcn.workitem.id.z()
59 ; AKF_HSA-NEXT: store volatile i32 [[VAL]], i32 addrspace(1)* undef, align 4
60 ; AKF_HSA-NEXT: ret void
62 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@use_workitem_id_z
63 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
64 ; ATTRIBUTOR_HSA-NEXT: store volatile i32 undef, i32 addrspace(1)* undef, align 4
65 ; ATTRIBUTOR_HSA-NEXT: ret void
67 %val = call i32 @llvm.amdgcn.workitem.id.z()
68 store volatile i32 %val, i32 addrspace(1)* undef
72 define void @use_workgroup_id_x() #1 {
73 ; AKF_HSA-LABEL: define {{[^@]+}}@use_workgroup_id_x
74 ; AKF_HSA-SAME: () #[[ATTR4:[0-9]+]] {
75 ; AKF_HSA-NEXT: [[VAL:%.*]] = call i32 @llvm.amdgcn.workgroup.id.x()
76 ; AKF_HSA-NEXT: store volatile i32 [[VAL]], i32 addrspace(1)* undef, align 4
77 ; AKF_HSA-NEXT: ret void
79 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@use_workgroup_id_x
80 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
81 ; ATTRIBUTOR_HSA-NEXT: store volatile i32 undef, i32 addrspace(1)* undef, align 4
82 ; ATTRIBUTOR_HSA-NEXT: ret void
84 %val = call i32 @llvm.amdgcn.workgroup.id.x()
85 store volatile i32 %val, i32 addrspace(1)* undef
89 define void @use_workgroup_id_y() #1 {
90 ; AKF_HSA-LABEL: define {{[^@]+}}@use_workgroup_id_y
91 ; AKF_HSA-SAME: () #[[ATTR5:[0-9]+]] {
92 ; AKF_HSA-NEXT: [[VAL:%.*]] = call i32 @llvm.amdgcn.workgroup.id.y()
93 ; AKF_HSA-NEXT: store volatile i32 [[VAL]], i32 addrspace(1)* undef, align 4
94 ; AKF_HSA-NEXT: ret void
96 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@use_workgroup_id_y
97 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
98 ; ATTRIBUTOR_HSA-NEXT: store volatile i32 undef, i32 addrspace(1)* undef, align 4
99 ; ATTRIBUTOR_HSA-NEXT: ret void
101 %val = call i32 @llvm.amdgcn.workgroup.id.y()
102 store volatile i32 %val, i32 addrspace(1)* undef
106 define void @use_workgroup_id_z() #1 {
107 ; AKF_HSA-LABEL: define {{[^@]+}}@use_workgroup_id_z
108 ; AKF_HSA-SAME: () #[[ATTR6:[0-9]+]] {
109 ; AKF_HSA-NEXT: [[VAL:%.*]] = call i32 @llvm.amdgcn.workgroup.id.z()
110 ; AKF_HSA-NEXT: store volatile i32 [[VAL]], i32 addrspace(1)* undef, align 4
111 ; AKF_HSA-NEXT: ret void
113 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@use_workgroup_id_z
114 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
115 ; ATTRIBUTOR_HSA-NEXT: store volatile i32 undef, i32 addrspace(1)* undef, align 4
116 ; ATTRIBUTOR_HSA-NEXT: ret void
118 %val = call i32 @llvm.amdgcn.workgroup.id.z()
119 store volatile i32 %val, i32 addrspace(1)* undef
123 define void @use_dispatch_ptr() #1 {
124 ; AKF_HSA-LABEL: define {{[^@]+}}@use_dispatch_ptr
125 ; AKF_HSA-SAME: () #[[ATTR7:[0-9]+]] {
126 ; AKF_HSA-NEXT: [[DISPATCH_PTR:%.*]] = call i8 addrspace(4)* @llvm.amdgcn.dispatch.ptr()
127 ; AKF_HSA-NEXT: store volatile i8 addrspace(4)* [[DISPATCH_PTR]], i8 addrspace(4)* addrspace(1)* undef, align 8
128 ; AKF_HSA-NEXT: ret void
130 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@use_dispatch_ptr
131 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
132 ; ATTRIBUTOR_HSA-NEXT: store volatile i8 addrspace(4)* undef, i8 addrspace(4)* addrspace(1)* undef, align 8
133 ; ATTRIBUTOR_HSA-NEXT: ret void
135 %dispatch.ptr = call i8 addrspace(4)* @llvm.amdgcn.dispatch.ptr()
136 store volatile i8 addrspace(4)* %dispatch.ptr, i8 addrspace(4)* addrspace(1)* undef
140 define void @use_queue_ptr() #1 {
141 ; AKF_HSA-LABEL: define {{[^@]+}}@use_queue_ptr
142 ; AKF_HSA-SAME: () #[[ATTR8:[0-9]+]] {
143 ; AKF_HSA-NEXT: [[QUEUE_PTR:%.*]] = call i8 addrspace(4)* @llvm.amdgcn.queue.ptr()
144 ; AKF_HSA-NEXT: store volatile i8 addrspace(4)* [[QUEUE_PTR]], i8 addrspace(4)* addrspace(1)* undef, align 8
145 ; AKF_HSA-NEXT: ret void
147 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@use_queue_ptr
148 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
149 ; ATTRIBUTOR_HSA-NEXT: store volatile i8 addrspace(4)* undef, i8 addrspace(4)* addrspace(1)* undef, align 8
150 ; ATTRIBUTOR_HSA-NEXT: ret void
152 %queue.ptr = call i8 addrspace(4)* @llvm.amdgcn.queue.ptr()
153 store volatile i8 addrspace(4)* %queue.ptr, i8 addrspace(4)* addrspace(1)* undef
157 define void @use_dispatch_id() #1 {
158 ; AKF_HSA-LABEL: define {{[^@]+}}@use_dispatch_id
159 ; AKF_HSA-SAME: () #[[ATTR9:[0-9]+]] {
160 ; AKF_HSA-NEXT: [[VAL:%.*]] = call i64 @llvm.amdgcn.dispatch.id()
161 ; AKF_HSA-NEXT: store volatile i64 [[VAL]], i64 addrspace(1)* undef, align 4
162 ; AKF_HSA-NEXT: ret void
164 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@use_dispatch_id
165 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
166 ; ATTRIBUTOR_HSA-NEXT: store volatile i64 undef, i64 addrspace(1)* undef, align 4
167 ; ATTRIBUTOR_HSA-NEXT: ret void
169 %val = call i64 @llvm.amdgcn.dispatch.id()
170 store volatile i64 %val, i64 addrspace(1)* undef
174 define void @use_workgroup_id_y_workgroup_id_z() #1 {
175 ; AKF_HSA-LABEL: define {{[^@]+}}@use_workgroup_id_y_workgroup_id_z
176 ; AKF_HSA-SAME: () #[[ATTR10:[0-9]+]] {
177 ; AKF_HSA-NEXT: [[VAL0:%.*]] = call i32 @llvm.amdgcn.workgroup.id.y()
178 ; AKF_HSA-NEXT: [[VAL1:%.*]] = call i32 @llvm.amdgcn.workgroup.id.z()
179 ; AKF_HSA-NEXT: store volatile i32 [[VAL0]], i32 addrspace(1)* undef, align 4
180 ; AKF_HSA-NEXT: store volatile i32 [[VAL1]], i32 addrspace(1)* undef, align 4
181 ; AKF_HSA-NEXT: ret void
183 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@use_workgroup_id_y_workgroup_id_z
184 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
185 ; ATTRIBUTOR_HSA-NEXT: store volatile i32 undef, i32 addrspace(1)* undef, align 4
186 ; ATTRIBUTOR_HSA-NEXT: store volatile i32 undef, i32 addrspace(1)* undef, align 4
187 ; ATTRIBUTOR_HSA-NEXT: ret void
189 %val0 = call i32 @llvm.amdgcn.workgroup.id.y()
190 %val1 = call i32 @llvm.amdgcn.workgroup.id.z()
191 store volatile i32 %val0, i32 addrspace(1)* undef
192 store volatile i32 %val1, i32 addrspace(1)* undef
196 define void @func_indirect_use_workitem_id_x() #1 {
197 ; AKF_HSA-LABEL: define {{[^@]+}}@func_indirect_use_workitem_id_x
198 ; AKF_HSA-SAME: () #[[ATTR1]] {
199 ; AKF_HSA-NEXT: call void @use_workitem_id_x()
200 ; AKF_HSA-NEXT: ret void
202 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@func_indirect_use_workitem_id_x
203 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
204 ; ATTRIBUTOR_HSA-NEXT: call void @use_workitem_id_x() #[[ATTR10:[0-9]+]]
205 ; ATTRIBUTOR_HSA-NEXT: ret void
207 call void @use_workitem_id_x()
211 define void @kernel_indirect_use_workitem_id_x() #1 {
212 ; AKF_HSA-LABEL: define {{[^@]+}}@kernel_indirect_use_workitem_id_x
213 ; AKF_HSA-SAME: () #[[ATTR1]] {
214 ; AKF_HSA-NEXT: call void @use_workitem_id_x()
215 ; AKF_HSA-NEXT: ret void
217 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@kernel_indirect_use_workitem_id_x
218 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
219 ; ATTRIBUTOR_HSA-NEXT: call void @use_workitem_id_x() #[[ATTR10]]
220 ; ATTRIBUTOR_HSA-NEXT: ret void
222 call void @use_workitem_id_x()
226 define void @func_indirect_use_workitem_id_y() #1 {
227 ; AKF_HSA-LABEL: define {{[^@]+}}@func_indirect_use_workitem_id_y
228 ; AKF_HSA-SAME: () #[[ATTR2]] {
229 ; AKF_HSA-NEXT: call void @use_workitem_id_y()
230 ; AKF_HSA-NEXT: ret void
232 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@func_indirect_use_workitem_id_y
233 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
234 ; ATTRIBUTOR_HSA-NEXT: call void @use_workitem_id_y() #[[ATTR10]]
235 ; ATTRIBUTOR_HSA-NEXT: ret void
237 call void @use_workitem_id_y()
241 define void @func_indirect_use_workitem_id_z() #1 {
242 ; AKF_HSA-LABEL: define {{[^@]+}}@func_indirect_use_workitem_id_z
243 ; AKF_HSA-SAME: () #[[ATTR3]] {
244 ; AKF_HSA-NEXT: call void @use_workitem_id_z()
245 ; AKF_HSA-NEXT: ret void
247 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@func_indirect_use_workitem_id_z
248 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
249 ; ATTRIBUTOR_HSA-NEXT: call void @use_workitem_id_z() #[[ATTR10]]
250 ; ATTRIBUTOR_HSA-NEXT: ret void
252 call void @use_workitem_id_z()
256 define void @func_indirect_use_workgroup_id_x() #1 {
257 ; AKF_HSA-LABEL: define {{[^@]+}}@func_indirect_use_workgroup_id_x
258 ; AKF_HSA-SAME: () #[[ATTR4]] {
259 ; AKF_HSA-NEXT: call void @use_workgroup_id_x()
260 ; AKF_HSA-NEXT: ret void
262 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@func_indirect_use_workgroup_id_x
263 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
264 ; ATTRIBUTOR_HSA-NEXT: call void @use_workgroup_id_x() #[[ATTR10]]
265 ; ATTRIBUTOR_HSA-NEXT: ret void
267 call void @use_workgroup_id_x()
271 define void @kernel_indirect_use_workgroup_id_x() #1 {
272 ; AKF_HSA-LABEL: define {{[^@]+}}@kernel_indirect_use_workgroup_id_x
273 ; AKF_HSA-SAME: () #[[ATTR4]] {
274 ; AKF_HSA-NEXT: call void @use_workgroup_id_x()
275 ; AKF_HSA-NEXT: ret void
277 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@kernel_indirect_use_workgroup_id_x
278 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
279 ; ATTRIBUTOR_HSA-NEXT: call void @use_workgroup_id_x() #[[ATTR10]]
280 ; ATTRIBUTOR_HSA-NEXT: ret void
282 call void @use_workgroup_id_x()
286 define void @func_indirect_use_workgroup_id_y() #1 {
287 ; AKF_HSA-LABEL: define {{[^@]+}}@func_indirect_use_workgroup_id_y
288 ; AKF_HSA-SAME: () #[[ATTR5]] {
289 ; AKF_HSA-NEXT: call void @use_workgroup_id_y()
290 ; AKF_HSA-NEXT: ret void
292 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@func_indirect_use_workgroup_id_y
293 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
294 ; ATTRIBUTOR_HSA-NEXT: call void @use_workgroup_id_y() #[[ATTR10]]
295 ; ATTRIBUTOR_HSA-NEXT: ret void
297 call void @use_workgroup_id_y()
301 define void @func_indirect_use_workgroup_id_z() #1 {
302 ; AKF_HSA-LABEL: define {{[^@]+}}@func_indirect_use_workgroup_id_z
303 ; AKF_HSA-SAME: () #[[ATTR6]] {
304 ; AKF_HSA-NEXT: call void @use_workgroup_id_z()
305 ; AKF_HSA-NEXT: ret void
307 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@func_indirect_use_workgroup_id_z
308 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
309 ; ATTRIBUTOR_HSA-NEXT: call void @use_workgroup_id_z() #[[ATTR10]]
310 ; ATTRIBUTOR_HSA-NEXT: ret void
312 call void @use_workgroup_id_z()
316 define void @func_indirect_indirect_use_workgroup_id_y() #1 {
317 ; AKF_HSA-LABEL: define {{[^@]+}}@func_indirect_indirect_use_workgroup_id_y
318 ; AKF_HSA-SAME: () #[[ATTR5]] {
319 ; AKF_HSA-NEXT: call void @func_indirect_use_workgroup_id_y()
320 ; AKF_HSA-NEXT: ret void
322 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@func_indirect_indirect_use_workgroup_id_y
323 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
324 ; ATTRIBUTOR_HSA-NEXT: call void @func_indirect_use_workgroup_id_y() #[[ATTR10]]
325 ; ATTRIBUTOR_HSA-NEXT: ret void
327 call void @func_indirect_use_workgroup_id_y()
331 define void @indirect_x2_use_workgroup_id_y() #1 {
332 ; AKF_HSA-LABEL: define {{[^@]+}}@indirect_x2_use_workgroup_id_y
333 ; AKF_HSA-SAME: () #[[ATTR5]] {
334 ; AKF_HSA-NEXT: call void @func_indirect_indirect_use_workgroup_id_y()
335 ; AKF_HSA-NEXT: ret void
337 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@indirect_x2_use_workgroup_id_y
338 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
339 ; ATTRIBUTOR_HSA-NEXT: call void @func_indirect_indirect_use_workgroup_id_y() #[[ATTR10]]
340 ; ATTRIBUTOR_HSA-NEXT: ret void
342 call void @func_indirect_indirect_use_workgroup_id_y()
346 define void @func_indirect_use_dispatch_ptr() #1 {
347 ; AKF_HSA-LABEL: define {{[^@]+}}@func_indirect_use_dispatch_ptr
348 ; AKF_HSA-SAME: () #[[ATTR7]] {
349 ; AKF_HSA-NEXT: call void @use_dispatch_ptr()
350 ; AKF_HSA-NEXT: ret void
352 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@func_indirect_use_dispatch_ptr
353 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
354 ; ATTRIBUTOR_HSA-NEXT: call void @use_dispatch_ptr() #[[ATTR10]]
355 ; ATTRIBUTOR_HSA-NEXT: ret void
357 call void @use_dispatch_ptr()
361 define void @func_indirect_use_queue_ptr() #1 {
362 ; AKF_HSA-LABEL: define {{[^@]+}}@func_indirect_use_queue_ptr
363 ; AKF_HSA-SAME: () #[[ATTR8]] {
364 ; AKF_HSA-NEXT: call void @use_queue_ptr()
365 ; AKF_HSA-NEXT: ret void
367 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@func_indirect_use_queue_ptr
368 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
369 ; ATTRIBUTOR_HSA-NEXT: call void @use_queue_ptr() #[[ATTR10]]
370 ; ATTRIBUTOR_HSA-NEXT: ret void
372 call void @use_queue_ptr()
376 define void @func_indirect_use_dispatch_id() #1 {
377 ; AKF_HSA-LABEL: define {{[^@]+}}@func_indirect_use_dispatch_id
378 ; AKF_HSA-SAME: () #[[ATTR9]] {
379 ; AKF_HSA-NEXT: call void @use_dispatch_id()
380 ; AKF_HSA-NEXT: ret void
382 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@func_indirect_use_dispatch_id
383 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
384 ; ATTRIBUTOR_HSA-NEXT: call void @use_dispatch_id() #[[ATTR10]]
385 ; ATTRIBUTOR_HSA-NEXT: ret void
387 call void @use_dispatch_id()
391 define void @func_indirect_use_workgroup_id_y_workgroup_id_z() #1 {
392 ; AKF_HSA-LABEL: define {{[^@]+}}@func_indirect_use_workgroup_id_y_workgroup_id_z
393 ; AKF_HSA-SAME: () #[[ATTR11:[0-9]+]] {
394 ; AKF_HSA-NEXT: call void @func_indirect_use_workgroup_id_y_workgroup_id_z()
395 ; AKF_HSA-NEXT: ret void
397 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@func_indirect_use_workgroup_id_y_workgroup_id_z
398 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR2:[0-9]+]] {
399 ; ATTRIBUTOR_HSA-NEXT: unreachable
401 call void @func_indirect_use_workgroup_id_y_workgroup_id_z()
405 define void @recursive_use_workitem_id_y() #1 {
406 ; AKF_HSA-LABEL: define {{[^@]+}}@recursive_use_workitem_id_y
407 ; AKF_HSA-SAME: () #[[ATTR2]] {
408 ; AKF_HSA-NEXT: [[VAL:%.*]] = call i32 @llvm.amdgcn.workitem.id.y()
409 ; AKF_HSA-NEXT: store volatile i32 [[VAL]], i32 addrspace(1)* undef, align 4
410 ; AKF_HSA-NEXT: call void @recursive_use_workitem_id_y()
411 ; AKF_HSA-NEXT: ret void
413 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@recursive_use_workitem_id_y
414 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR3:[0-9]+]] {
415 ; ATTRIBUTOR_HSA-NEXT: store volatile i32 undef, i32 addrspace(1)* undef, align 4
416 ; ATTRIBUTOR_HSA-NEXT: call void @recursive_use_workitem_id_y() #[[ATTR11:[0-9]+]]
417 ; ATTRIBUTOR_HSA-NEXT: unreachable
419 %val = call i32 @llvm.amdgcn.workitem.id.y()
420 store volatile i32 %val, i32 addrspace(1)* undef
421 call void @recursive_use_workitem_id_y()
425 define void @call_recursive_use_workitem_id_y() #1 {
426 ; AKF_HSA-LABEL: define {{[^@]+}}@call_recursive_use_workitem_id_y
427 ; AKF_HSA-SAME: () #[[ATTR2]] {
428 ; AKF_HSA-NEXT: call void @recursive_use_workitem_id_y()
429 ; AKF_HSA-NEXT: ret void
431 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@call_recursive_use_workitem_id_y
432 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
433 ; ATTRIBUTOR_HSA-NEXT: call void @recursive_use_workitem_id_y() #[[ATTR11]]
434 ; ATTRIBUTOR_HSA-NEXT: unreachable
436 call void @recursive_use_workitem_id_y()
440 define void @use_group_to_flat_addrspacecast(i32 addrspace(3)* %ptr) #1 {
441 ; AKF_HSA-LABEL: define {{[^@]+}}@use_group_to_flat_addrspacecast
442 ; AKF_HSA-SAME: (i32 addrspace(3)* [[PTR:%.*]]) #[[ATTR8]] {
443 ; AKF_HSA-NEXT: [[STOF:%.*]] = addrspacecast i32 addrspace(3)* [[PTR]] to i32 addrspace(4)*
444 ; AKF_HSA-NEXT: store volatile i32 0, i32 addrspace(4)* [[STOF]], align 4
445 ; AKF_HSA-NEXT: ret void
447 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@use_group_to_flat_addrspacecast
448 ; ATTRIBUTOR_HSA-SAME: (i32 addrspace(3)* [[PTR:%.*]]) #[[ATTR4:[0-9]+]] {
449 ; ATTRIBUTOR_HSA-NEXT: [[STOF:%.*]] = addrspacecast i32 addrspace(3)* [[PTR]] to i32 addrspace(4)*
450 ; ATTRIBUTOR_HSA-NEXT: store volatile i32 0, i32 addrspace(4)* [[STOF]], align 4
451 ; ATTRIBUTOR_HSA-NEXT: ret void
453 %stof = addrspacecast i32 addrspace(3)* %ptr to i32 addrspace(4)*
454 store volatile i32 0, i32 addrspace(4)* %stof
459 define void @use_group_to_flat_addrspacecast_gfx9(i32 addrspace(3)* %ptr) #2 {
460 ; AKF_HSA-LABEL: define {{[^@]+}}@use_group_to_flat_addrspacecast_gfx9
461 ; AKF_HSA-SAME: (i32 addrspace(3)* [[PTR:%.*]]) #[[ATTR12:[0-9]+]] {
462 ; AKF_HSA-NEXT: [[STOF:%.*]] = addrspacecast i32 addrspace(3)* [[PTR]] to i32 addrspace(4)*
463 ; AKF_HSA-NEXT: store volatile i32 0, i32 addrspace(4)* [[STOF]], align 4
464 ; AKF_HSA-NEXT: ret void
466 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@use_group_to_flat_addrspacecast_gfx9
467 ; ATTRIBUTOR_HSA-SAME: (i32 addrspace(3)* [[PTR:%.*]]) #[[ATTR5:[0-9]+]] {
468 ; ATTRIBUTOR_HSA-NEXT: [[STOF:%.*]] = addrspacecast i32 addrspace(3)* [[PTR]] to i32 addrspace(4)*
469 ; ATTRIBUTOR_HSA-NEXT: store volatile i32 0, i32 addrspace(4)* [[STOF]], align 4
470 ; ATTRIBUTOR_HSA-NEXT: ret void
472 %stof = addrspacecast i32 addrspace(3)* %ptr to i32 addrspace(4)*
473 store volatile i32 0, i32 addrspace(4)* %stof
477 define void @use_group_to_flat_addrspacecast_queue_ptr_gfx9(i32 addrspace(3)* %ptr) #2 {
478 ; AKF_HSA-LABEL: define {{[^@]+}}@use_group_to_flat_addrspacecast_queue_ptr_gfx9
479 ; AKF_HSA-SAME: (i32 addrspace(3)* [[PTR:%.*]]) #[[ATTR13:[0-9]+]] {
480 ; AKF_HSA-NEXT: [[STOF:%.*]] = addrspacecast i32 addrspace(3)* [[PTR]] to i32 addrspace(4)*
481 ; AKF_HSA-NEXT: store volatile i32 0, i32 addrspace(4)* [[STOF]], align 4
482 ; AKF_HSA-NEXT: call void @func_indirect_use_queue_ptr()
483 ; AKF_HSA-NEXT: ret void
485 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@use_group_to_flat_addrspacecast_queue_ptr_gfx9
486 ; ATTRIBUTOR_HSA-SAME: (i32 addrspace(3)* [[PTR:%.*]]) #[[ATTR5]] {
487 ; ATTRIBUTOR_HSA-NEXT: [[STOF:%.*]] = addrspacecast i32 addrspace(3)* [[PTR]] to i32 addrspace(4)*
488 ; ATTRIBUTOR_HSA-NEXT: store volatile i32 0, i32 addrspace(4)* [[STOF]], align 4
489 ; ATTRIBUTOR_HSA-NEXT: call void @func_indirect_use_queue_ptr() #[[ATTR10]]
490 ; ATTRIBUTOR_HSA-NEXT: ret void
492 %stof = addrspacecast i32 addrspace(3)* %ptr to i32 addrspace(4)*
493 store volatile i32 0, i32 addrspace(4)* %stof
494 call void @func_indirect_use_queue_ptr()
498 define void @indirect_use_group_to_flat_addrspacecast() #1 {
499 ; AKF_HSA-LABEL: define {{[^@]+}}@indirect_use_group_to_flat_addrspacecast
500 ; AKF_HSA-SAME: () #[[ATTR8]] {
501 ; AKF_HSA-NEXT: call void @use_group_to_flat_addrspacecast(i32 addrspace(3)* null)
502 ; AKF_HSA-NEXT: ret void
504 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@indirect_use_group_to_flat_addrspacecast
505 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR4]] {
506 ; ATTRIBUTOR_HSA-NEXT: call void @use_group_to_flat_addrspacecast(i32 addrspace(3)* null) #[[ATTR10]]
507 ; ATTRIBUTOR_HSA-NEXT: ret void
509 call void @use_group_to_flat_addrspacecast(i32 addrspace(3)* null)
513 define void @indirect_use_group_to_flat_addrspacecast_gfx9() #1 {
514 ; AKF_HSA-LABEL: define {{[^@]+}}@indirect_use_group_to_flat_addrspacecast_gfx9
515 ; AKF_HSA-SAME: () #[[ATTR11]] {
516 ; AKF_HSA-NEXT: call void @use_group_to_flat_addrspacecast_gfx9(i32 addrspace(3)* null)
517 ; AKF_HSA-NEXT: ret void
519 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@indirect_use_group_to_flat_addrspacecast_gfx9
520 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
521 ; ATTRIBUTOR_HSA-NEXT: call void @use_group_to_flat_addrspacecast_gfx9(i32 addrspace(3)* null) #[[ATTR10]]
522 ; ATTRIBUTOR_HSA-NEXT: ret void
524 call void @use_group_to_flat_addrspacecast_gfx9(i32 addrspace(3)* null)
528 define void @indirect_use_group_to_flat_addrspacecast_queue_ptr_gfx9() #1 {
529 ; AKF_HSA-LABEL: define {{[^@]+}}@indirect_use_group_to_flat_addrspacecast_queue_ptr_gfx9
530 ; AKF_HSA-SAME: () #[[ATTR8]] {
531 ; AKF_HSA-NEXT: call void @use_group_to_flat_addrspacecast_queue_ptr_gfx9(i32 addrspace(3)* null)
532 ; AKF_HSA-NEXT: ret void
534 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@indirect_use_group_to_flat_addrspacecast_queue_ptr_gfx9
535 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
536 ; ATTRIBUTOR_HSA-NEXT: call void @use_group_to_flat_addrspacecast_queue_ptr_gfx9(i32 addrspace(3)* null) #[[ATTR10]]
537 ; ATTRIBUTOR_HSA-NEXT: ret void
539 call void @use_group_to_flat_addrspacecast_queue_ptr_gfx9(i32 addrspace(3)* null)
543 define void @use_kernarg_segment_ptr() #1 {
544 ; AKF_HSA-LABEL: define {{[^@]+}}@use_kernarg_segment_ptr
545 ; AKF_HSA-SAME: () #[[ATTR14:[0-9]+]] {
546 ; AKF_HSA-NEXT: [[KERNARG_SEGMENT_PTR:%.*]] = call i8 addrspace(4)* @llvm.amdgcn.kernarg.segment.ptr()
547 ; AKF_HSA-NEXT: store volatile i8 addrspace(4)* [[KERNARG_SEGMENT_PTR]], i8 addrspace(4)* addrspace(1)* undef, align 8
548 ; AKF_HSA-NEXT: ret void
550 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@use_kernarg_segment_ptr
551 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
552 ; ATTRIBUTOR_HSA-NEXT: store volatile i8 addrspace(4)* undef, i8 addrspace(4)* addrspace(1)* undef, align 8
553 ; ATTRIBUTOR_HSA-NEXT: ret void
555 %kernarg.segment.ptr = call i8 addrspace(4)* @llvm.amdgcn.kernarg.segment.ptr()
556 store volatile i8 addrspace(4)* %kernarg.segment.ptr, i8 addrspace(4)* addrspace(1)* undef
559 define void @func_indirect_use_kernarg_segment_ptr() #1 {
560 ; AKF_HSA-LABEL: define {{[^@]+}}@func_indirect_use_kernarg_segment_ptr
561 ; AKF_HSA-SAME: () #[[ATTR11]] {
562 ; AKF_HSA-NEXT: call void @use_kernarg_segment_ptr()
563 ; AKF_HSA-NEXT: ret void
565 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@func_indirect_use_kernarg_segment_ptr
566 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
567 ; ATTRIBUTOR_HSA-NEXT: call void @use_kernarg_segment_ptr() #[[ATTR10]]
568 ; ATTRIBUTOR_HSA-NEXT: ret void
570 call void @use_kernarg_segment_ptr()
574 define amdgpu_kernel void @kern_use_implicitarg_ptr() #1 {
575 ; AKF_HSA-LABEL: define {{[^@]+}}@kern_use_implicitarg_ptr
576 ; AKF_HSA-SAME: () #[[ATTR15:[0-9]+]] {
577 ; AKF_HSA-NEXT: [[IMPLICITARG_PTR:%.*]] = call i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr()
578 ; AKF_HSA-NEXT: store volatile i8 addrspace(4)* [[IMPLICITARG_PTR]], i8 addrspace(4)* addrspace(1)* undef, align 8
579 ; AKF_HSA-NEXT: ret void
581 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@kern_use_implicitarg_ptr
582 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
583 ; ATTRIBUTOR_HSA-NEXT: store volatile i8 addrspace(4)* undef, i8 addrspace(4)* addrspace(1)* undef, align 8
584 ; ATTRIBUTOR_HSA-NEXT: ret void
586 %implicitarg.ptr = call i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr()
587 store volatile i8 addrspace(4)* %implicitarg.ptr, i8 addrspace(4)* addrspace(1)* undef
591 define void @use_implicitarg_ptr() #1 {
592 ; AKF_HSA-LABEL: define {{[^@]+}}@use_implicitarg_ptr
593 ; AKF_HSA-SAME: () #[[ATTR16:[0-9]+]] {
594 ; AKF_HSA-NEXT: [[IMPLICITARG_PTR:%.*]] = call i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr()
595 ; AKF_HSA-NEXT: store volatile i8 addrspace(4)* [[IMPLICITARG_PTR]], i8 addrspace(4)* addrspace(1)* undef, align 8
596 ; AKF_HSA-NEXT: ret void
598 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@use_implicitarg_ptr
599 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
600 ; ATTRIBUTOR_HSA-NEXT: store volatile i8 addrspace(4)* undef, i8 addrspace(4)* addrspace(1)* undef, align 8
601 ; ATTRIBUTOR_HSA-NEXT: ret void
603 %implicitarg.ptr = call i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr()
604 store volatile i8 addrspace(4)* %implicitarg.ptr, i8 addrspace(4)* addrspace(1)* undef
608 define void @func_indirect_use_implicitarg_ptr() #1 {
609 ; AKF_HSA-LABEL: define {{[^@]+}}@func_indirect_use_implicitarg_ptr
610 ; AKF_HSA-SAME: () #[[ATTR16]] {
611 ; AKF_HSA-NEXT: call void @use_implicitarg_ptr()
612 ; AKF_HSA-NEXT: ret void
614 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@func_indirect_use_implicitarg_ptr
615 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR1]] {
616 ; ATTRIBUTOR_HSA-NEXT: call void @use_implicitarg_ptr() #[[ATTR10]]
617 ; ATTRIBUTOR_HSA-NEXT: ret void
619 call void @use_implicitarg_ptr()
623 declare void @external.func() #3
625 ; This function gets deleted.
626 define internal void @defined.func() #3 {
627 ; AKF_HSA-LABEL: define {{[^@]+}}@defined.func
628 ; AKF_HSA-SAME: () #[[ATTR17:[0-9]+]] {
629 ; AKF_HSA-NEXT: ret void
634 define void @func_call_external() #3 {
635 ; AKF_HSA-LABEL: define {{[^@]+}}@func_call_external
636 ; AKF_HSA-SAME: () #[[ATTR17]] {
637 ; AKF_HSA-NEXT: call void @external.func()
638 ; AKF_HSA-NEXT: ret void
640 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@func_call_external
641 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR6:[0-9]+]] {
642 ; ATTRIBUTOR_HSA-NEXT: call void @external.func() #[[ATTR10]]
643 ; ATTRIBUTOR_HSA-NEXT: ret void
645 call void @external.func()
649 define void @func_call_defined() #3 {
650 ; AKF_HSA-LABEL: define {{[^@]+}}@func_call_defined
651 ; AKF_HSA-SAME: () #[[ATTR17]] {
652 ; AKF_HSA-NEXT: call void @defined.func()
653 ; AKF_HSA-NEXT: ret void
655 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@func_call_defined
656 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR7:[0-9]+]] {
657 ; ATTRIBUTOR_HSA-NEXT: ret void
659 call void @defined.func()
662 define void @func_call_asm() #3 {
663 ; AKF_HSA-LABEL: define {{[^@]+}}@func_call_asm
664 ; AKF_HSA-SAME: () #[[ATTR18:[0-9]+]] {
665 ; AKF_HSA-NEXT: call void asm sideeffect "", ""() #[[ATTR18]]
666 ; AKF_HSA-NEXT: ret void
668 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@func_call_asm
669 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR7]] {
670 ; ATTRIBUTOR_HSA-NEXT: call void asm sideeffect "", ""() #[[ATTR10]]
671 ; ATTRIBUTOR_HSA-NEXT: ret void
673 call void asm sideeffect "", ""() #3
677 define amdgpu_kernel void @kern_call_external() #3 {
678 ; AKF_HSA-LABEL: define {{[^@]+}}@kern_call_external
679 ; AKF_HSA-SAME: () #[[ATTR19:[0-9]+]] {
680 ; AKF_HSA-NEXT: call void @external.func()
681 ; AKF_HSA-NEXT: ret void
683 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@kern_call_external
684 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR8:[0-9]+]] {
685 ; ATTRIBUTOR_HSA-NEXT: call void @external.func() #[[ATTR10]]
686 ; ATTRIBUTOR_HSA-NEXT: ret void
688 call void @external.func()
692 define amdgpu_kernel void @func_kern_defined() #3 {
693 ; AKF_HSA-LABEL: define {{[^@]+}}@func_kern_defined
694 ; AKF_HSA-SAME: () #[[ATTR19]] {
695 ; AKF_HSA-NEXT: call void @defined.func()
696 ; AKF_HSA-NEXT: ret void
698 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@func_kern_defined
699 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR7]] {
700 ; ATTRIBUTOR_HSA-NEXT: ret void
702 call void @defined.func()
706 define i32 @use_dispatch_ptr_ret_type() #1 {
707 ; AKF_HSA-LABEL: define {{[^@]+}}@use_dispatch_ptr_ret_type
708 ; AKF_HSA-SAME: () #[[ATTR20:[0-9]+]] {
709 ; AKF_HSA-NEXT: [[DISPATCH_PTR:%.*]] = call i8 addrspace(4)* @llvm.amdgcn.dispatch.ptr()
710 ; AKF_HSA-NEXT: store volatile i8 addrspace(4)* [[DISPATCH_PTR]], i8 addrspace(4)* addrspace(1)* undef, align 8
711 ; AKF_HSA-NEXT: ret i32 0
713 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@use_dispatch_ptr_ret_type
714 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR9:[0-9]+]] {
715 ; ATTRIBUTOR_HSA-NEXT: store volatile i8 addrspace(4)* undef, i8 addrspace(4)* addrspace(1)* undef, align 8
716 ; ATTRIBUTOR_HSA-NEXT: ret i32 0
718 %dispatch.ptr = call i8 addrspace(4)* @llvm.amdgcn.dispatch.ptr()
719 store volatile i8 addrspace(4)* %dispatch.ptr, i8 addrspace(4)* addrspace(1)* undef
723 define float @func_indirect_use_dispatch_ptr_constexpr_cast_func() #1 {
724 ; AKF_HSA-LABEL: define {{[^@]+}}@func_indirect_use_dispatch_ptr_constexpr_cast_func
725 ; AKF_HSA-SAME: () #[[ATTR20]] {
726 ; AKF_HSA-NEXT: [[F:%.*]] = call float bitcast (i32 ()* @use_dispatch_ptr_ret_type to float ()*)()
727 ; AKF_HSA-NEXT: [[FADD:%.*]] = fadd float [[F]], 1.000000e+00
728 ; AKF_HSA-NEXT: ret float [[FADD]]
730 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@func_indirect_use_dispatch_ptr_constexpr_cast_func
731 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR9]] {
732 ; ATTRIBUTOR_HSA-NEXT: [[F:%.*]] = call float bitcast (i32 ()* @use_dispatch_ptr_ret_type to float ()*)()
733 ; ATTRIBUTOR_HSA-NEXT: [[FADD:%.*]] = fadd float [[F]], 1.000000e+00
734 ; ATTRIBUTOR_HSA-NEXT: ret float [[FADD]]
736 %f = call float bitcast (i32()* @use_dispatch_ptr_ret_type to float()*)()
737 %fadd = fadd float %f, 1.0
741 define float @func_indirect_call(float()* %fptr) #3 {
742 ; AKF_HSA-LABEL: define {{[^@]+}}@func_indirect_call
743 ; AKF_HSA-SAME: (float ()* [[FPTR:%.*]]) #[[ATTR21:[0-9]+]] {
744 ; AKF_HSA-NEXT: [[F:%.*]] = call float [[FPTR]]()
745 ; AKF_HSA-NEXT: [[FADD:%.*]] = fadd float [[F]], 1.000000e+00
746 ; AKF_HSA-NEXT: ret float [[FADD]]
748 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@func_indirect_call
749 ; ATTRIBUTOR_HSA-SAME: (float ()* [[FPTR:%.*]]) #[[ATTR6]] {
750 ; ATTRIBUTOR_HSA-NEXT: [[F:%.*]] = call float [[FPTR]]()
751 ; ATTRIBUTOR_HSA-NEXT: [[FADD:%.*]] = fadd float [[F]], 1.000000e+00
752 ; ATTRIBUTOR_HSA-NEXT: ret float [[FADD]]
754 %f = call float %fptr()
755 %fadd = fadd float %f, 1.0
759 declare float @extern() #3
760 define float @func_extern_call() #3 {
761 ; AKF_HSA-LABEL: define {{[^@]+}}@func_extern_call
762 ; AKF_HSA-SAME: () #[[ATTR17]] {
763 ; AKF_HSA-NEXT: [[F:%.*]] = call float @extern()
764 ; AKF_HSA-NEXT: [[FADD:%.*]] = fadd float [[F]], 1.000000e+00
765 ; AKF_HSA-NEXT: ret float [[FADD]]
767 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@func_extern_call
768 ; ATTRIBUTOR_HSA-SAME: () #[[ATTR6]] {
769 ; ATTRIBUTOR_HSA-NEXT: [[F:%.*]] = call float @extern() #[[ATTR10]]
770 ; ATTRIBUTOR_HSA-NEXT: [[FADD:%.*]] = fadd float [[F]], 1.000000e+00
771 ; ATTRIBUTOR_HSA-NEXT: ret float [[FADD]]
773 %f = call float @extern()
774 %fadd = fadd float %f, 1.0
778 define float @func_null_call(float()* %fptr) #3 {
779 ; AKF_HSA-LABEL: define {{[^@]+}}@func_null_call
780 ; AKF_HSA-SAME: (float ()* [[FPTR:%.*]]) #[[ATTR21]] {
781 ; AKF_HSA-NEXT: [[F:%.*]] = call float null()
782 ; AKF_HSA-NEXT: [[FADD:%.*]] = fadd float [[F]], 1.000000e+00
783 ; AKF_HSA-NEXT: ret float [[FADD]]
785 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@func_null_call
786 ; ATTRIBUTOR_HSA-SAME: (float ()* [[FPTR:%.*]]) #[[ATTR6]] {
787 ; ATTRIBUTOR_HSA-NEXT: [[F:%.*]] = call float null()
788 ; ATTRIBUTOR_HSA-NEXT: [[FADD:%.*]] = fadd float [[F]], 1.000000e+00
789 ; ATTRIBUTOR_HSA-NEXT: ret float [[FADD]]
791 %f = call float null()
792 %fadd = fadd float %f, 1.0
796 declare float @llvm.amdgcn.rcp.f32(float) #0
798 ; Calls some other recognized intrinsic
799 define float @func_other_intrinsic_call(float %arg) #3 {
800 ; AKF_HSA-LABEL: define {{[^@]+}}@func_other_intrinsic_call
801 ; AKF_HSA-SAME: (float [[ARG:%.*]]) #[[ATTR18]] {
802 ; AKF_HSA-NEXT: [[F:%.*]] = call float @llvm.amdgcn.rcp.f32(float [[ARG]])
803 ; AKF_HSA-NEXT: [[FADD:%.*]] = fadd float [[F]], 1.000000e+00
804 ; AKF_HSA-NEXT: ret float [[FADD]]
806 ; ATTRIBUTOR_HSA-LABEL: define {{[^@]+}}@func_other_intrinsic_call
807 ; ATTRIBUTOR_HSA-SAME: (float [[ARG:%.*]]) #[[ATTR7]] {
808 ; ATTRIBUTOR_HSA-NEXT: [[F:%.*]] = call float @llvm.amdgcn.rcp.f32(float [[ARG]])
809 ; ATTRIBUTOR_HSA-NEXT: [[FADD:%.*]] = fadd float [[F]], 1.000000e+00
810 ; ATTRIBUTOR_HSA-NEXT: ret float [[FADD]]
812 %f = call float @llvm.amdgcn.rcp.f32(float %arg)
813 %fadd = fadd float %f, 1.0
817 attributes #0 = { nounwind readnone speculatable }
818 attributes #1 = { nounwind "target-cpu"="fiji" }
819 attributes #2 = { nounwind "target-cpu"="gfx900" }
820 attributes #3 = { nounwind }
823 ; AKF_HSA: attributes #[[ATTR0:[0-9]+]] = { nounwind readnone speculatable willreturn }
824 ; AKF_HSA: attributes #[[ATTR1]] = { nounwind "amdgpu-work-item-id-x" "target-cpu"="fiji" "uniform-work-group-size"="false" }
825 ; AKF_HSA: attributes #[[ATTR2]] = { nounwind "amdgpu-work-item-id-y" "target-cpu"="fiji" "uniform-work-group-size"="false" }
826 ; AKF_HSA: attributes #[[ATTR3]] = { nounwind "amdgpu-work-item-id-z" "target-cpu"="fiji" "uniform-work-group-size"="false" }
827 ; AKF_HSA: attributes #[[ATTR4]] = { nounwind "amdgpu-work-group-id-x" "target-cpu"="fiji" "uniform-work-group-size"="false" }
828 ; AKF_HSA: attributes #[[ATTR5]] = { nounwind "amdgpu-work-group-id-y" "target-cpu"="fiji" "uniform-work-group-size"="false" }
829 ; AKF_HSA: attributes #[[ATTR6]] = { nounwind "amdgpu-work-group-id-z" "target-cpu"="fiji" "uniform-work-group-size"="false" }
830 ; AKF_HSA: attributes #[[ATTR7]] = { nounwind "amdgpu-dispatch-ptr" "target-cpu"="fiji" "uniform-work-group-size"="false" }
831 ; AKF_HSA: attributes #[[ATTR8]] = { nounwind "amdgpu-queue-ptr" "target-cpu"="fiji" "uniform-work-group-size"="false" }
832 ; AKF_HSA: attributes #[[ATTR9]] = { nounwind "amdgpu-dispatch-id" "target-cpu"="fiji" "uniform-work-group-size"="false" }
833 ; AKF_HSA: attributes #[[ATTR10]] = { nounwind "amdgpu-work-group-id-y" "amdgpu-work-group-id-z" "target-cpu"="fiji" }
834 ; AKF_HSA: attributes #[[ATTR11]] = { nounwind "target-cpu"="fiji" "uniform-work-group-size"="false" }
835 ; AKF_HSA: attributes #[[ATTR12]] = { nounwind "target-cpu"="gfx900" "uniform-work-group-size"="false" }
836 ; AKF_HSA: attributes #[[ATTR13]] = { nounwind "amdgpu-queue-ptr" "target-cpu"="gfx900" "uniform-work-group-size"="false" }
837 ; AKF_HSA: attributes #[[ATTR14]] = { nounwind "amdgpu-kernarg-segment-ptr" "target-cpu"="fiji" "uniform-work-group-size"="false" }
838 ; AKF_HSA: attributes #[[ATTR15]] = { nounwind "amdgpu-implicitarg-ptr" "target-cpu"="fiji" }
839 ; AKF_HSA: attributes #[[ATTR16]] = { nounwind "amdgpu-implicitarg-ptr" "target-cpu"="fiji" "uniform-work-group-size"="false" }
840 ; AKF_HSA: attributes #[[ATTR17]] = { nounwind "uniform-work-group-size"="false" }
841 ; AKF_HSA: attributes #[[ATTR18]] = { nounwind }
842 ; AKF_HSA: attributes #[[ATTR19]] = { nounwind "amdgpu-calls" "uniform-work-group-size"="false" }
843 ; AKF_HSA: attributes #[[ATTR20]] = { nounwind "amdgpu-dispatch-id" "amdgpu-dispatch-ptr" "amdgpu-implicitarg-ptr" "amdgpu-queue-ptr" "amdgpu-work-group-id-x" "amdgpu-work-group-id-y" "amdgpu-work-group-id-z" "amdgpu-work-item-id-x" "amdgpu-work-item-id-y" "amdgpu-work-item-id-z" "target-cpu"="fiji" }
844 ; AKF_HSA: attributes #[[ATTR21]] = { nounwind "amdgpu-dispatch-id" "amdgpu-dispatch-ptr" "amdgpu-implicitarg-ptr" "amdgpu-queue-ptr" "amdgpu-work-group-id-x" "amdgpu-work-group-id-y" "amdgpu-work-group-id-z" "amdgpu-work-item-id-x" "amdgpu-work-item-id-y" "amdgpu-work-item-id-z" }
846 ; ATTRIBUTOR_HSA: attributes #[[ATTR0:[0-9]+]] = { nounwind readnone speculatable willreturn }
847 ; ATTRIBUTOR_HSA: attributes #[[ATTR1]] = { nounwind "target-cpu"="fiji" "uniform-work-group-size"="false" }
848 ; ATTRIBUTOR_HSA: attributes #[[ATTR2]] = { noreturn nounwind readnone "target-cpu"="fiji" "uniform-work-group-size"="false" }
849 ; ATTRIBUTOR_HSA: attributes #[[ATTR3]] = { noreturn nounwind "target-cpu"="fiji" "uniform-work-group-size"="false" }
850 ; ATTRIBUTOR_HSA: attributes #[[ATTR4]] = { nounwind "amdgpu-queue-ptr" "target-cpu"="fiji" "uniform-work-group-size"="false" }
851 ; ATTRIBUTOR_HSA: attributes #[[ATTR5]] = { nounwind "target-cpu"="gfx900" "uniform-work-group-size"="false" }
852 ; ATTRIBUTOR_HSA: attributes #[[ATTR6]] = { nounwind "amdgpu-dispatch-id" "amdgpu-dispatch-ptr" "amdgpu-implicitarg-ptr" "amdgpu-queue-ptr" "amdgpu-work-group-id-x" "amdgpu-work-group-id-y" "amdgpu-work-group-id-z" "amdgpu-work-item-id-x" "amdgpu-work-item-id-y" "amdgpu-work-item-id-z" "uniform-work-group-size"="false" }
853 ; ATTRIBUTOR_HSA: attributes #[[ATTR7]] = { nounwind "uniform-work-group-size"="false" }
854 ; ATTRIBUTOR_HSA: attributes #[[ATTR8]] = { nounwind "amdgpu-calls" "amdgpu-dispatch-id" "amdgpu-dispatch-ptr" "amdgpu-implicitarg-ptr" "amdgpu-queue-ptr" "amdgpu-work-group-id-x" "amdgpu-work-group-id-y" "amdgpu-work-group-id-z" "amdgpu-work-item-id-x" "amdgpu-work-item-id-y" "amdgpu-work-item-id-z" "uniform-work-group-size"="false" }
855 ; ATTRIBUTOR_HSA: attributes #[[ATTR9]] = { nounwind "amdgpu-dispatch-id" "amdgpu-dispatch-ptr" "amdgpu-implicitarg-ptr" "amdgpu-queue-ptr" "amdgpu-work-group-id-x" "amdgpu-work-group-id-y" "amdgpu-work-group-id-z" "amdgpu-work-item-id-x" "amdgpu-work-item-id-y" "amdgpu-work-item-id-z" "target-cpu"="fiji" "uniform-work-group-size"="false" }
856 ; ATTRIBUTOR_HSA: attributes #[[ATTR10]] = { nounwind }
857 ; ATTRIBUTOR_HSA: attributes #[[ATTR11]] = { noreturn nounwind }