1 ; RUN: llc -mtriple=amdgcn -mcpu=fiji -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GCN %s
2 ; RUN: llc -mtriple=amdgcn -mcpu=hawaii -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GCN %s
3 ; RUN: llc -mtriple=amdgcn -mcpu=gfx900 -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GCN %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_mov_b32 [[FP_SCRATCH_COPY:s[0-9]+]], s33
15 ; GCN-NEXT: s_mov_b32 s33, s32
16 ; GCN-NEXT: s_or_saveexec_b64 [[COPY_EXEC0:s\[[0-9]+:[0-9]+\]]], -1{{$}}
17 ; GCN-NEXT: buffer_store_dword v40, off, s[0:3], s33 ; 4-byte Folded Spill
18 ; GCN-NEXT: s_mov_b64 exec, [[COPY_EXEC0]]
19 ; GCN-DAG: v_writelane_b32 v40, [[FP_SCRATCH_COPY]], 2
20 ; GCN-DAG: v_writelane_b32 v40, s30, 0
21 ; GCN-DAG: v_writelane_b32 v40, s31, 1
25 ; GCN: v_readlane_b32 s31, v40, 1
26 ; GCN: v_readlane_b32 s30, v40, 0
28 ; GCN-NEXT: v_readlane_b32 [[FP_SCRATCH_COPY:s[0-9]+]], v40, 2
29 ; GCN: s_or_saveexec_b64 [[COPY_EXEC1:s\[[0-9]+:[0-9]+\]]], -1{{$}}
30 ; GCN-NEXT: buffer_load_dword v40, off, s[0:3], s33 ; 4-byte Folded Reload
31 ; GCN-NEXT: s_mov_b64 exec, [[COPY_EXEC1]]
32 ; GCN-NEXT: s_addk_i32 s32, 0xfc00
33 ; GCN-NEXT: s_mov_b32 s33, [[FP_SCRATCH_COPY]]
34 ; GCN-NEXT: s_waitcnt vmcnt(0)
35 ; GCN-NEXT: s_setpc_b64 s[30:31]
36 define void @test_func_call_external_void_func_i32_imm() #0 {
37 call void @external_void_func_i32(i32 42)
41 ; GCN-LABEL: {{^}}test_func_call_external_void_func_i32_imm_stack_use:
43 ; GCN: s_mov_b32 s33, s32
44 ; GCN-DAG: s_addk_i32 s32, 0x1400{{$}}
45 ; GCN-DAG: buffer_store_dword v{{[0-9]+}}, off, s[0:3], s33 offset:
47 ; GCN: s_addk_i32 s32, 0xec00{{$}}
49 define void @test_func_call_external_void_func_i32_imm_stack_use() #0 {
50 %alloca = alloca [16 x i32], align 4, addrspace(5)
51 %gep15 = getelementptr inbounds [16 x i32], ptr addrspace(5) %alloca, i32 0, i32 16
52 store volatile i32 0, ptr addrspace(5) %alloca
53 store volatile i32 0, ptr 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 }