1 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=kaveri --amdhsa-code-object-version=2 -enable-ipra=0 -verify-machineinstrs < %s | FileCheck -allow-deprecated-dag-overlap -enable-var-scope -check-prefixes=GCN,CIVI %s
2 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=2 -enable-ipra=0 -verify-machineinstrs < %s | FileCheck -allow-deprecated-dag-overlap -enable-var-scope -check-prefixes=GCN,GFX9 %s
4 ; GCN-LABEL: {{^}}use_dispatch_ptr:
5 ; GCN: s_load_dword s{{[0-9]+}}, s[4:5]
6 define hidden void @use_dispatch_ptr() #1 {
7 %dispatch_ptr = call noalias i8 addrspace(4)* @llvm.amdgcn.dispatch.ptr() #0
8 %header_ptr = bitcast i8 addrspace(4)* %dispatch_ptr to i32 addrspace(4)*
9 %value = load volatile i32, i32 addrspace(4)* %header_ptr
13 ; GCN-LABEL: {{^}}kern_indirect_use_dispatch_ptr:
14 ; GCN: enable_sgpr_dispatch_ptr = 1
18 define amdgpu_kernel void @kern_indirect_use_dispatch_ptr(i32) #1 {
19 call void @use_dispatch_ptr()
23 ; GCN-LABEL: {{^}}use_queue_ptr:
24 ; GCN: s_load_dword s{{[0-9]+}}, s[4:5]
25 define hidden void @use_queue_ptr() #1 {
26 %queue_ptr = call noalias i8 addrspace(4)* @llvm.amdgcn.queue.ptr() #0
27 %header_ptr = bitcast i8 addrspace(4)* %queue_ptr to i32 addrspace(4)*
28 %value = load volatile i32, i32 addrspace(4)* %header_ptr
32 ; GCN-LABEL: {{^}}kern_indirect_use_queue_ptr:
33 ; GCN: enable_sgpr_queue_ptr = 1
37 define amdgpu_kernel void @kern_indirect_use_queue_ptr(i32) #1 {
38 call void @use_queue_ptr()
42 ; GCN-LABEL: {{^}}use_queue_ptr_addrspacecast:
43 ; CIVI: s_load_dword [[APERTURE_LOAD:s[0-9]+]], s[4:5], 0x10
44 ; GFX9: s_getreg_b32 [[APERTURE_LOAD:s[0-9]+]]
45 ; CIVI: v_mov_b32_e32 v[[LO:[0-9]+]], 16
46 ; GCN-DAG: v_mov_b32_e32 v[[HI:[0-9]+]], [[APERTURE_LOAD]]
47 ; GFX9: {{flat|global}}_store_dword v{{\[[0-9]+}}:[[HI]]{{\]}}
48 ; CIVI: {{flat|global}}_store_dword v{{\[}}[[LO]]:[[HI]]{{\]}}
49 define hidden void @use_queue_ptr_addrspacecast() #1 {
50 %asc = addrspacecast i32 addrspace(3)* inttoptr (i32 16 to i32 addrspace(3)*) to i32*
51 store volatile i32 0, i32* %asc
55 ; GCN-LABEL: {{^}}kern_indirect_use_queue_ptr_addrspacecast:
56 ; CIVI: enable_sgpr_queue_ptr = 1
60 define amdgpu_kernel void @kern_indirect_use_queue_ptr_addrspacecast(i32) #1 {
61 call void @use_queue_ptr_addrspacecast()
65 ; Not really supported in callable functions.
66 ; GCN-LABEL: {{^}}use_kernarg_segment_ptr:
67 ; GCN: s_mov_b64 [[PTR:s\[[0-9]+:[0-9]+\]]], 0{{$}}
68 ; GCN: s_load_dword s{{[0-9]+}}, [[PTR]], 0x0{{$}}
69 define hidden void @use_kernarg_segment_ptr() #1 {
70 %kernarg_segment_ptr = call noalias i8 addrspace(4)* @llvm.amdgcn.kernarg.segment.ptr() #0
71 %header_ptr = bitcast i8 addrspace(4)* %kernarg_segment_ptr to i32 addrspace(4)*
72 %value = load volatile i32, i32 addrspace(4)* %header_ptr
76 ; GCN-LABEL: {{^}}kern_indirect_use_kernarg_segment_ptr:
77 ; GCN: enable_sgpr_kernarg_segment_ptr = 1
78 define amdgpu_kernel void @kern_indirect_use_kernarg_segment_ptr(i32) #1 {
79 call void @use_kernarg_segment_ptr()
83 ; GCN-LABEL: {{^}}use_dispatch_id:
85 define hidden void @use_dispatch_id() #1 {
86 %id = call i64 @llvm.amdgcn.dispatch.id()
87 call void asm sideeffect "; use $0", "s"(i64 %id)
91 ; No kernarg segment so that there is a mov to check. With kernarg
92 ; pointer enabled, it happens to end up in the right place anyway.
94 ; GCN-LABEL: {{^}}kern_indirect_use_dispatch_id:
95 ; GCN: enable_sgpr_dispatch_id = 1
99 define amdgpu_kernel void @kern_indirect_use_dispatch_id() #1 {
100 call void @use_dispatch_id()
104 ; GCN-LABEL: {{^}}use_workgroup_id_x:
107 define hidden void @use_workgroup_id_x() #1 {
108 %val = call i32 @llvm.amdgcn.workgroup.id.x()
109 call void asm sideeffect "; use $0", "s"(i32 %val)
113 ; GCN-LABEL: {{^}}use_stack_workgroup_id_x:
116 ; GCN: buffer_store_dword v0, off, s[0:3], s32{{$}}
119 define hidden void @use_stack_workgroup_id_x() #1 {
120 %alloca = alloca i32, addrspace(5)
121 store volatile i32 0, i32 addrspace(5)* %alloca
122 %val = call i32 @llvm.amdgcn.workgroup.id.x()
123 call void asm sideeffect "; use $0", "s"(i32 %val)
127 ; GCN-LABEL: {{^}}use_workgroup_id_y:
130 define hidden void @use_workgroup_id_y() #1 {
131 %val = call i32 @llvm.amdgcn.workgroup.id.y()
132 call void asm sideeffect "; use $0", "s"(i32 %val)
136 ; GCN-LABEL: {{^}}use_workgroup_id_z:
139 define hidden void @use_workgroup_id_z() #1 {
140 %val = call i32 @llvm.amdgcn.workgroup.id.z()
141 call void asm sideeffect "; use $0", "s"(i32 %val)
145 ; GCN-LABEL: {{^}}use_workgroup_id_xy:
148 define hidden void @use_workgroup_id_xy() #1 {
149 %val0 = call i32 @llvm.amdgcn.workgroup.id.x()
150 %val1 = call i32 @llvm.amdgcn.workgroup.id.y()
151 call void asm sideeffect "; use $0", "s"(i32 %val0)
152 call void asm sideeffect "; use $0", "s"(i32 %val1)
156 ; GCN-LABEL: {{^}}use_workgroup_id_xyz:
160 define hidden void @use_workgroup_id_xyz() #1 {
161 %val0 = call i32 @llvm.amdgcn.workgroup.id.x()
162 %val1 = call i32 @llvm.amdgcn.workgroup.id.y()
163 %val2 = call i32 @llvm.amdgcn.workgroup.id.z()
164 call void asm sideeffect "; use $0", "s"(i32 %val0)
165 call void asm sideeffect "; use $0", "s"(i32 %val1)
166 call void asm sideeffect "; use $0", "s"(i32 %val2)
170 ; GCN-LABEL: {{^}}use_workgroup_id_xz:
173 define hidden void @use_workgroup_id_xz() #1 {
174 %val0 = call i32 @llvm.amdgcn.workgroup.id.x()
175 %val1 = call i32 @llvm.amdgcn.workgroup.id.z()
176 call void asm sideeffect "; use $0", "s"(i32 %val0)
177 call void asm sideeffect "; use $0", "s"(i32 %val1)
181 ; GCN-LABEL: {{^}}use_workgroup_id_yz:
184 define hidden void @use_workgroup_id_yz() #1 {
185 %val0 = call i32 @llvm.amdgcn.workgroup.id.y()
186 %val1 = call i32 @llvm.amdgcn.workgroup.id.z()
187 call void asm sideeffect "; use $0", "s"(i32 %val0)
188 call void asm sideeffect "; use $0", "s"(i32 %val1)
192 ; GCN-LABEL: {{^}}kern_indirect_use_workgroup_id_x:
193 ; GCN: enable_sgpr_workgroup_id_x = 1
194 ; GCN: enable_sgpr_workgroup_id_y = 0
195 ; GCN: enable_sgpr_workgroup_id_z = 0
198 ; GCN: s_mov_b32 s4, s6
199 ; GCN-NEXT: s_getpc_b64 s[6:7]
200 ; GCN-NEXT: s_add_u32 s6, s6, use_workgroup_id_x@rel32@lo+4
201 ; GCN-NEXT: s_addc_u32 s7, s7, use_workgroup_id_x@rel32@hi+12
202 ; GCN: s_mov_b32 s32, 0
205 define amdgpu_kernel void @kern_indirect_use_workgroup_id_x() #1 {
206 call void @use_workgroup_id_x()
210 ; GCN-LABEL: {{^}}kern_indirect_use_workgroup_id_y:
211 ; GCN: enable_sgpr_workgroup_id_x = 1
212 ; GCN: enable_sgpr_workgroup_id_y = 1
213 ; GCN: enable_sgpr_workgroup_id_z = 0
215 ; GCN: s_mov_b32 s4, s7
216 ; GCN: s_mov_b32 s32, 0
218 define amdgpu_kernel void @kern_indirect_use_workgroup_id_y() #1 {
219 call void @use_workgroup_id_y()
223 ; GCN-LABEL: {{^}}kern_indirect_use_workgroup_id_z:
224 ; GCN: enable_sgpr_workgroup_id_x = 1
225 ; GCN: enable_sgpr_workgroup_id_y = 0
226 ; GCN: enable_sgpr_workgroup_id_z = 1
228 ; GCN: s_mov_b32 s4, s7
230 ; GCN: s_mov_b32 s32, 0
232 define amdgpu_kernel void @kern_indirect_use_workgroup_id_z() #1 {
233 call void @use_workgroup_id_z()
237 ; GCN-LABEL: {{^}}kern_indirect_use_workgroup_id_xy:
238 ; GCN: enable_sgpr_workgroup_id_x = 1
239 ; GCN: enable_sgpr_workgroup_id_y = 1
240 ; GCN: enable_sgpr_workgroup_id_z = 0
242 ; GCN: s_mov_b32 s5, s7
243 ; GCN: s_mov_b32 s4, s6
245 ; GCN: s_mov_b32 s32, 0
247 define amdgpu_kernel void @kern_indirect_use_workgroup_id_xy() #1 {
248 call void @use_workgroup_id_xy()
252 ; GCN-LABEL: {{^}}kern_indirect_use_workgroup_id_xyz:
253 ; GCN: enable_sgpr_workgroup_id_x = 1
254 ; GCN: enable_sgpr_workgroup_id_y = 1
255 ; GCN: enable_sgpr_workgroup_id_z = 1
257 ; GCN: s_mov_b32 s4, s6
258 ; GCN: s_mov_b32 s5, s7
259 ; GCN: s_mov_b32 s6, s8
261 ; GCN: s_mov_b32 s32, 0
263 define amdgpu_kernel void @kern_indirect_use_workgroup_id_xyz() #1 {
264 call void @use_workgroup_id_xyz()
268 ; GCN-LABEL: {{^}}kern_indirect_use_workgroup_id_xz:
269 ; GCN: enable_sgpr_workgroup_id_x = 1
270 ; GCN: enable_sgpr_workgroup_id_y = 0
271 ; GCN: enable_sgpr_workgroup_id_z = 1
273 ; GCN: s_mov_b32 s5, s7
274 ; GCN: s_mov_b32 s4, s6
276 ; GCN: s_mov_b32 s32, 0
278 define amdgpu_kernel void @kern_indirect_use_workgroup_id_xz() #1 {
279 call void @use_workgroup_id_xz()
283 ; GCN-LABEL: {{^}}kern_indirect_use_workgroup_id_yz:
284 ; GCN: enable_sgpr_workgroup_id_x = 1
285 ; GCN: enable_sgpr_workgroup_id_y = 1
286 ; GCN: enable_sgpr_workgroup_id_z = 1
288 ; GCN: s_mov_b32 s4, s7
289 ; GCN: s_mov_b32 s5, s8
291 ; GCN: s_mov_b32 s32, 0
293 define amdgpu_kernel void @kern_indirect_use_workgroup_id_yz() #1 {
294 call void @use_workgroup_id_yz()
298 ; Argument is in right place already
299 ; GCN-LABEL: {{^}}func_indirect_use_workgroup_id_x:
301 ; GCN: v_readlane_b32 s4, v40, 0
302 define hidden void @func_indirect_use_workgroup_id_x() #1 {
303 call void @use_workgroup_id_x()
307 ; GCN-LABEL: {{^}}func_indirect_use_workgroup_id_y:
309 ; GCN: v_readlane_b32 s4, v40, 0
310 define hidden void @func_indirect_use_workgroup_id_y() #1 {
311 call void @use_workgroup_id_y()
315 ; GCN-LABEL: {{^}}func_indirect_use_workgroup_id_z:
317 ; GCN: v_readlane_b32 s4, v40, 0
318 define hidden void @func_indirect_use_workgroup_id_z() #1 {
319 call void @use_workgroup_id_z()
323 ; GCN-LABEL: {{^}}other_arg_use_workgroup_id_x:
324 ; GCN: {{flat|global}}_store_dword v{{\[[0-9]+:[0-9]+\]}}, v0
326 define hidden void @other_arg_use_workgroup_id_x(i32 %arg0) #1 {
327 %val = call i32 @llvm.amdgcn.workgroup.id.x()
328 store volatile i32 %arg0, i32 addrspace(1)* undef
329 call void asm sideeffect "; use $0", "s"(i32 %val)
333 ; GCN-LABEL: {{^}}other_arg_use_workgroup_id_y:
334 ; GCN: {{flat|global}}_store_dword v{{\[[0-9]+:[0-9]+\]}}, v0
336 define hidden void @other_arg_use_workgroup_id_y(i32 %arg0) #1 {
337 %val = call i32 @llvm.amdgcn.workgroup.id.y()
338 store volatile i32 %arg0, i32 addrspace(1)* undef
339 call void asm sideeffect "; use $0", "s"(i32 %val)
343 ; GCN-LABEL: {{^}}other_arg_use_workgroup_id_z:
344 ; GCN: {{flat|global}}_store_dword v{{\[[0-9]+:[0-9]+\]}}, v0
346 define hidden void @other_arg_use_workgroup_id_z(i32 %arg0) #1 {
347 %val = call i32 @llvm.amdgcn.workgroup.id.z()
348 store volatile i32 %arg0, i32 addrspace(1)* undef
349 call void asm sideeffect "; use $0", "s"(i32 %val)
353 ; GCN-LABEL: {{^}}kern_indirect_other_arg_use_workgroup_id_x:
354 ; GCN: enable_sgpr_workgroup_id_x = 1
355 ; GCN: enable_sgpr_workgroup_id_y = 0
356 ; GCN: enable_sgpr_workgroup_id_z = 0
358 ; GCN-DAG: v_mov_b32_e32 v0, 0x22b
359 ; GCN-DAG: s_mov_b32 s4, s6
361 ; GCN-DAG: s_mov_b32 s32, 0
364 define amdgpu_kernel void @kern_indirect_other_arg_use_workgroup_id_x() #1 {
365 call void @other_arg_use_workgroup_id_x(i32 555)
369 ; GCN-LABEL: {{^}}kern_indirect_other_arg_use_workgroup_id_y:
370 ; GCN: enable_sgpr_workgroup_id_x = 1
371 ; GCN: enable_sgpr_workgroup_id_y = 1
372 ; GCN: enable_sgpr_workgroup_id_z = 0
374 ; GCN-DAG: v_mov_b32_e32 v0, 0x22b
375 ; GCN-DAG: s_mov_b32 s4, s7
377 ; GCN-DAG: s_mov_b32 s32, 0
379 define amdgpu_kernel void @kern_indirect_other_arg_use_workgroup_id_y() #1 {
380 call void @other_arg_use_workgroup_id_y(i32 555)
384 ; GCN-LABEL: {{^}}kern_indirect_other_arg_use_workgroup_id_z:
385 ; GCN: enable_sgpr_workgroup_id_x = 1
386 ; GCN: enable_sgpr_workgroup_id_y = 0
387 ; GCN: enable_sgpr_workgroup_id_z = 1
389 ; GCN-DAG: v_mov_b32_e32 v0, 0x22b
391 ; GCN: s_mov_b32 s32, 0
393 define amdgpu_kernel void @kern_indirect_other_arg_use_workgroup_id_z() #1 {
394 call void @other_arg_use_workgroup_id_z(i32 555)
398 ; GCN-LABEL: {{^}}use_every_sgpr_input:
399 ; GCN: buffer_store_dword v{{[0-9]+}}, off, s[0:3], s32{{$}}
400 ; GCN: s_load_dword s{{[0-9]+}}, s[4:5]
401 ; GCN: s_load_dword s{{[0-9]+}}, s[6:7]
402 ; GCN: s_load_dword s{{[0-9]+}}, s[8:9]
404 ; GCN: ; use s[10:11]
408 define hidden void @use_every_sgpr_input() #1 {
409 %alloca = alloca i32, align 4, addrspace(5)
410 store volatile i32 0, i32 addrspace(5)* %alloca
412 %dispatch_ptr = call noalias i8 addrspace(4)* @llvm.amdgcn.dispatch.ptr() #0
413 %dispatch_ptr.bc = bitcast i8 addrspace(4)* %dispatch_ptr to i32 addrspace(4)*
414 %val0 = load volatile i32, i32 addrspace(4)* %dispatch_ptr.bc
416 %queue_ptr = call noalias i8 addrspace(4)* @llvm.amdgcn.queue.ptr() #0
417 %queue_ptr.bc = bitcast i8 addrspace(4)* %queue_ptr to i32 addrspace(4)*
418 %val1 = load volatile i32, i32 addrspace(4)* %queue_ptr.bc
420 %implicitarg.ptr = call noalias i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr() #0
421 %implicitarg.ptr.bc = bitcast i8 addrspace(4)* %implicitarg.ptr to i32 addrspace(4)*
422 %val2 = load volatile i32, i32 addrspace(4)* %implicitarg.ptr.bc
424 %val3 = call i64 @llvm.amdgcn.dispatch.id()
425 call void asm sideeffect "; use $0", "s"(i64 %val3)
427 %val4 = call i32 @llvm.amdgcn.workgroup.id.x()
428 call void asm sideeffect "; use $0", "s"(i32 %val4)
430 %val5 = call i32 @llvm.amdgcn.workgroup.id.y()
431 call void asm sideeffect "; use $0", "s"(i32 %val5)
433 %val6 = call i32 @llvm.amdgcn.workgroup.id.z()
434 call void asm sideeffect "; use $0", "s"(i32 %val6)
439 ; GCN-LABEL: {{^}}kern_indirect_use_every_sgpr_input:
440 ; GCN: enable_sgpr_workgroup_id_x = 1
441 ; GCN: enable_sgpr_workgroup_id_y = 1
442 ; GCN: enable_sgpr_workgroup_id_z = 1
443 ; GCN: enable_sgpr_workgroup_info = 0
445 ; GCN: enable_sgpr_private_segment_buffer = 1
446 ; GCN: enable_sgpr_dispatch_ptr = 1
447 ; GCN: enable_sgpr_queue_ptr = 1
448 ; GCN: enable_sgpr_kernarg_segment_ptr = 1
449 ; GCN: enable_sgpr_dispatch_id = 1
450 ; GCN: enable_sgpr_flat_scratch_init = 1
452 ; GCN: s_mov_b32 s12, s14
453 ; GCN: s_mov_b32 s13, s15
454 ; GCN: s_mov_b32 s14, s16
455 ; GCN: s_mov_b32 s32, 0
457 define amdgpu_kernel void @kern_indirect_use_every_sgpr_input() #1 {
458 call void @use_every_sgpr_input()
462 ; GCN-LABEL: {{^}}func_indirect_use_every_sgpr_input:
475 ; GCN: s_or_saveexec_b64 s[16:17], -1
476 define hidden void @func_indirect_use_every_sgpr_input() #1 {
477 call void @use_every_sgpr_input()
481 ; GCN-LABEL: {{^}}func_use_every_sgpr_input_call_use_workgroup_id_xyz:
482 ; GCN: s_mov_b32 s4, s12
483 ; GCN: s_mov_b32 s5, s13
484 ; GCN: s_mov_b32 s6, s14
485 ; GCN: ; use s[10:11]
491 define hidden void @func_use_every_sgpr_input_call_use_workgroup_id_xyz() #1 {
492 %alloca = alloca i32, align 4, addrspace(5)
493 store volatile i32 0, i32 addrspace(5)* %alloca
495 %dispatch_ptr = call noalias i8 addrspace(4)* @llvm.amdgcn.dispatch.ptr() #0
496 %dispatch_ptr.bc = bitcast i8 addrspace(4)* %dispatch_ptr to i32 addrspace(4)*
497 %val0 = load volatile i32, i32 addrspace(4)* %dispatch_ptr.bc
499 %queue_ptr = call noalias i8 addrspace(4)* @llvm.amdgcn.queue.ptr() #0
500 %queue_ptr.bc = bitcast i8 addrspace(4)* %queue_ptr to i32 addrspace(4)*
501 %val1 = load volatile i32, i32 addrspace(4)* %queue_ptr.bc
503 %implicitarg.ptr = call noalias i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr() #0
504 %implicitarg.ptr.bc = bitcast i8 addrspace(4)* %implicitarg.ptr to i32 addrspace(4)*
505 %val2 = load volatile i32, i32 addrspace(4)* %implicitarg.ptr.bc
507 %val3 = call i64 @llvm.amdgcn.dispatch.id()
508 call void asm sideeffect "; use $0", "s"(i64 %val3)
510 %val4 = call i32 @llvm.amdgcn.workgroup.id.x()
511 call void asm sideeffect "; use $0", "s"(i32 %val4)
513 %val5 = call i32 @llvm.amdgcn.workgroup.id.y()
514 call void asm sideeffect "; use $0", "s"(i32 %val5)
516 %val6 = call i32 @llvm.amdgcn.workgroup.id.z()
517 call void asm sideeffect "; use $0", "s"(i32 %val6)
519 call void @use_workgroup_id_xyz()
523 ; GCN-LABEL: {{^}}func_use_every_sgpr_input_call_use_workgroup_id_xyz_spill:
524 ; GCN-DAG: s_mov_b32 s33, s32
525 ; GCN-DAG: s_addk_i32 s32, 0x400
526 ; GCN-DAG: s_mov_b64 s{{\[}}[[LO_X:[0-9]+]]{{\:}}[[HI_X:[0-9]+]]{{\]}}, s[4:5]
527 ; GCN-DAG: s_mov_b64 s{{\[}}[[LO_Y:[0-9]+]]{{\:}}[[HI_Y:[0-9]+]]{{\]}}, s[6:7]
530 ; GCN: s_mov_b32 s4, s12
531 ; GCN: s_mov_b32 s5, s13
532 ; GCN: s_mov_b32 s6, s14
534 ; GCN: s_mov_b64 s{{\[}}[[LO_Z:[0-9]+]]{{\:}}[[HI_Z:[0-9]+]]{{\]}}, s[8:9]
536 ; GCN-DAG: s_mov_b32 [[SAVE_X:s[0-57-9][0-9]*]], s12
537 ; GCN-DAG: s_mov_b32 [[SAVE_Y:s[0-57-9][0-9]*]], s13
538 ; GCN-DAG: s_mov_b32 [[SAVE_Z:s[0-68-9][0-9]*]], s14
544 ; GCN-DAG: buffer_store_dword v{{[0-9]+}}, off, s[0:3], s33{{$}}
545 ; GCN-DAG: s_load_dword s{{[0-9]+}}, s{{\[}}[[LO_X]]:[[HI_X]]{{\]}}, 0x0
546 ; GCN-DAG: s_load_dword s{{[0-9]+}}, s{{\[}}[[LO_Y]]:[[HI_Y]]{{\]}}, 0x0
547 ; GCN-DAG: s_load_dword s{{[0-9]+}}, s{{\[}}[[LO_Z]]:[[HI_Z]]{{\]}}, 0x0
549 ; GCN: ; use [[SAVE_X]]
550 ; GCN: ; use [[SAVE_Y]]
551 ; GCN: ; use [[SAVE_Z]]
552 define hidden void @func_use_every_sgpr_input_call_use_workgroup_id_xyz_spill() #1 {
553 %alloca = alloca i32, align 4, addrspace(5)
554 call void @use_workgroup_id_xyz()
556 store volatile i32 0, i32 addrspace(5)* %alloca
558 %dispatch_ptr = call noalias i8 addrspace(4)* @llvm.amdgcn.dispatch.ptr() #0
559 %dispatch_ptr.bc = bitcast i8 addrspace(4)* %dispatch_ptr to i32 addrspace(4)*
560 %val0 = load volatile i32, i32 addrspace(4)* %dispatch_ptr.bc
562 %queue_ptr = call noalias i8 addrspace(4)* @llvm.amdgcn.queue.ptr() #0
563 %queue_ptr.bc = bitcast i8 addrspace(4)* %queue_ptr to i32 addrspace(4)*
564 %val1 = load volatile i32, i32 addrspace(4)* %queue_ptr.bc
566 %implicitarg.ptr = call noalias i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr() #0
567 %implicitarg.ptr.bc = bitcast i8 addrspace(4)* %implicitarg.ptr to i32 addrspace(4)*
568 %val2 = load volatile i32, i32 addrspace(4)* %implicitarg.ptr.bc
570 %val3 = call i64 @llvm.amdgcn.dispatch.id()
571 call void asm sideeffect "; use $0", "s"(i64 %val3)
573 %val4 = call i32 @llvm.amdgcn.workgroup.id.x()
574 call void asm sideeffect "; use $0", "s"(i32 %val4)
576 %val5 = call i32 @llvm.amdgcn.workgroup.id.y()
577 call void asm sideeffect "; use $0", "s"(i32 %val5)
579 %val6 = call i32 @llvm.amdgcn.workgroup.id.z()
580 call void asm sideeffect "; use $0", "s"(i32 %val6)
585 declare i32 @llvm.amdgcn.workgroup.id.x() #0
586 declare i32 @llvm.amdgcn.workgroup.id.y() #0
587 declare i32 @llvm.amdgcn.workgroup.id.z() #0
588 declare noalias i8 addrspace(4)* @llvm.amdgcn.queue.ptr() #0
589 declare noalias i8 addrspace(4)* @llvm.amdgcn.kernarg.segment.ptr() #0
590 declare noalias i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr() #0
591 declare i64 @llvm.amdgcn.dispatch.id() #0
592 declare noalias i8 addrspace(4)* @llvm.amdgcn.dispatch.ptr() #0
594 attributes #0 = { nounwind readnone speculatable }
595 attributes #1 = { nounwind noinline }