Matt Arsenault | a202538 | 2017-08-03 23:24:05 +0000 | [diff] [blame] | 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 |
Matt Arsenault | b62a4eb | 2017-08-01 19:54:18 +0000 | [diff] [blame] | 4 | |
| 5 | ; Test calls when called by other callable functions rather than |
| 6 | ; kernels. |
| 7 | |
| 8 | declare void @external_void_func_i32(i32) #0 |
| 9 | |
| 10 | ; GCN-LABEL: {{^}}test_func_call_external_void_func_i32_imm: |
| 11 | ; GCN: s_waitcnt |
Matt Arsenault | 8e8f8f4 | 2017-08-02 01:52:45 +0000 | [diff] [blame] | 12 | ; GCN: s_mov_b32 s5, s32 |
| 13 | ; Spill CSR VGPR used for SGPR spilling |
| 14 | ; GCN: buffer_store_dword v32, off, s[0:3], s5 offset:4 |
| 15 | ; GCN-DAG: s_add_u32 s32, s32, 0x200 |
| 16 | ; GCN-DAG: v_writelane_b32 v32, s33, 0 |
| 17 | ; GCN-DAG: v_writelane_b32 v32, s34, 1 |
| 18 | ; GCN-DAG: v_writelane_b32 v32, s35, 2 |
| 19 | |
Matt Arsenault | b62a4eb | 2017-08-01 19:54:18 +0000 | [diff] [blame] | 20 | ; GCN: s_swappc_b64 |
Matt Arsenault | 8e8f8f4 | 2017-08-02 01:52:45 +0000 | [diff] [blame] | 21 | |
| 22 | ; GCN: v_readlane_b32 s35, v32, 2 |
| 23 | ; GCN: v_readlane_b32 s34, v32, 1 |
| 24 | ; GCN: v_readlane_b32 s33, v32, 0 |
| 25 | ; GCN: buffer_load_dword v32, off, s[0:3], s5 offset:4 |
| 26 | ; GCN: s_sub_u32 s32, s32, 0x200 |
Matt Arsenault | b62a4eb | 2017-08-01 19:54:18 +0000 | [diff] [blame] | 27 | ; GCN: s_setpc_b64 |
| 28 | define void @test_func_call_external_void_func_i32_imm() #0 { |
| 29 | call void @external_void_func_i32(i32 42) |
| 30 | ret void |
| 31 | } |
| 32 | |
| 33 | ; GCN-LABEL: {{^}}test_func_call_external_void_func_i32_imm_stack_use: |
| 34 | ; GCN: s_waitcnt |
| 35 | ; GCN: s_mov_b32 s5, s32 |
Matt Arsenault | 8e8f8f4 | 2017-08-02 01:52:45 +0000 | [diff] [blame] | 36 | ; GCN: s_add_u32 s32, s32, 0x1200{{$}} |
Matt Arsenault | b62a4eb | 2017-08-01 19:54:18 +0000 | [diff] [blame] | 37 | ; GCN: buffer_store_dword v{{[0-9]+}}, off, s[0:3], s5 offset |
| 38 | ; GCN: s_swappc_b64 |
Matt Arsenault | 8e8f8f4 | 2017-08-02 01:52:45 +0000 | [diff] [blame] | 39 | ; GCN: s_sub_u32 s32, s32, 0x1200{{$}} |
Matt Arsenault | b62a4eb | 2017-08-01 19:54:18 +0000 | [diff] [blame] | 40 | ; GCN: s_setpc_b64 |
| 41 | define void @test_func_call_external_void_func_i32_imm_stack_use() #0 { |
| 42 | %alloca = alloca [16 x i32], align 4 |
| 43 | %gep0 = getelementptr inbounds [16 x i32], [16 x i32]* %alloca, i32 0, i32 0 |
| 44 | %gep15 = getelementptr inbounds [16 x i32], [16 x i32]* %alloca, i32 0, i32 16 |
| 45 | store volatile i32 0, i32* %gep0 |
| 46 | store volatile i32 0, i32* %gep15 |
| 47 | call void @external_void_func_i32(i32 42) |
| 48 | ret void |
| 49 | } |
| 50 | |
| 51 | attributes #0 = { nounwind } |
| 52 | attributes #1 = { nounwind readnone } |
| 53 | attributes #2 = { nounwind noinline } |