1 ; RUN: llc -march=amdgcn -mcpu=fiji -mattr=-flat-for-global -amdgpu-sroa=0 -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GCN -check-prefix=VI %s
2 ; RUN: llc -march=amdgcn -mcpu=hawaii -amdgpu-sroa=0 -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GCN -check-prefix=CI %s
3 ; RUN: llc -march=amdgcn -mcpu=gfx900 -mattr=-flat-for-global -amdgpu-sroa=0 -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GCN -check-prefix=GFX9 -check-prefix=VI %s
5 ; Test calls when called by other callable functions rather than
8 declare void @external_void_func_i32(i32) #0
10 ; GCN-LABEL: {{^}}test_func_call_external_void_func_i32_imm:
13 ; Spill CSR VGPR used for SGPR spilling
14 ; GCN: s_or_saveexec_b64 [[COPY_EXEC0:s\[[0-9]+:[0-9]+\]]], -1{{$}}
15 ; GCN-NEXT: buffer_store_dword v32, off, s[0:3], s32 ; 4-byte Folded Spill
16 ; GCN-NEXT: s_mov_b64 exec, [[COPY_EXEC0]]
17 ; GCN-DAG: v_writelane_b32 v32, s34, 2
18 ; GCN-DAG: s_mov_b32 s34, s32
19 ; GCN-DAG: s_add_u32 s32, s32, 0x400
20 ; GCN-DAG: v_writelane_b32 v32, s30, 0
21 ; GCN-DAG: v_writelane_b32 v32, s31, 1
25 ; GCN: v_readlane_b32 s4, v32, 0
26 ; GCN: v_readlane_b32 s5, v32, 1
28 ; GCN-NEXT: s_sub_u32 s32, s32, 0x400
29 ; GCN-NEXT: v_readlane_b32 s34, v32, 2
30 ; GCN: s_or_saveexec_b64 [[COPY_EXEC1:s\[[0-9]+:[0-9]+\]]], -1{{$}}
31 ; GCN-NEXT: buffer_load_dword v32, off, s[0:3], s32 ; 4-byte Folded Reload
32 ; GCN-NEXT: s_mov_b64 exec, [[COPY_EXEC1]]
33 ; GCN-NEXT: s_waitcnt vmcnt(0)
34 ; GCN-NEXT: s_setpc_b64 s[4:5]
35 define void @test_func_call_external_void_func_i32_imm() #0 {
36 call void @external_void_func_i32(i32 42)
40 ; GCN-LABEL: {{^}}test_func_call_external_void_func_i32_imm_stack_use:
42 ; GCN: s_mov_b32 s34, s32
43 ; GCN-DAG: s_add_u32 s32, s32, 0x1400{{$}}
44 ; GCN-DAG: buffer_store_dword v{{[0-9]+}}, off, s[0:3], s34 offset:
46 ; GCN: s_sub_u32 s32, s32, 0x1400{{$}}
48 define void @test_func_call_external_void_func_i32_imm_stack_use() #0 {
49 %alloca = alloca [16 x i32], align 4, addrspace(5)
50 %gep0 = getelementptr inbounds [16 x i32], [16 x i32] addrspace(5)* %alloca, i32 0, i32 0
51 %gep15 = getelementptr inbounds [16 x i32], [16 x i32] addrspace(5)* %alloca, i32 0, i32 16
52 store volatile i32 0, i32 addrspace(5)* %gep0
53 store volatile i32 0, i32 addrspace(5)* %gep15
54 call void @external_void_func_i32(i32 42)
58 attributes #0 = { nounwind }
59 attributes #1 = { nounwind readnone }
60 attributes #2 = { nounwind noinline }