Matt Arsenault | b62a4eb | 2017-08-01 19:54:18 +0000 | [diff] [blame^] | 1 | ; RUN: llc -march=amdgcn -mcpu=fiji -mattr=-flat-for-global -amdgpu-sroa=0 -amdgpu-function-calls -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GCN -check-prefix=VI %s |
| 2 | ; RUN: llc -march=amdgcn -mcpu=hawaii -amdgpu-function-calls -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 -amdgpu-function-calls -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GCN -check-prefix=GFX9 -check-prefix=VI %s |
| 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 |
| 12 | ; GCN-NOT: s32 |
| 13 | ; GCN: s_swappc_b64 |
| 14 | ; GCN-NOT: s32 |
| 15 | ; GCN: s_setpc_b64 |
| 16 | define void @test_func_call_external_void_func_i32_imm() #0 { |
| 17 | call void @external_void_func_i32(i32 42) |
| 18 | ret void |
| 19 | } |
| 20 | |
| 21 | ; GCN-LABEL: {{^}}test_func_call_external_void_func_i32_imm_stack_use: |
| 22 | ; GCN: s_waitcnt |
| 23 | ; GCN: s_mov_b32 s5, s32 |
| 24 | ; GCN: s_add_u32 s32, s32, 0x1100{{$}} |
| 25 | ; GCN: buffer_store_dword v{{[0-9]+}}, off, s[0:3], s5 offset |
| 26 | ; GCN: s_swappc_b64 |
| 27 | ; GCN: s_sub_u32 s32, s32, 0x1100{{$}} |
| 28 | ; GCN: s_setpc_b64 |
| 29 | define void @test_func_call_external_void_func_i32_imm_stack_use() #0 { |
| 30 | %alloca = alloca [16 x i32], align 4 |
| 31 | %gep0 = getelementptr inbounds [16 x i32], [16 x i32]* %alloca, i32 0, i32 0 |
| 32 | %gep15 = getelementptr inbounds [16 x i32], [16 x i32]* %alloca, i32 0, i32 16 |
| 33 | store volatile i32 0, i32* %gep0 |
| 34 | store volatile i32 0, i32* %gep15 |
| 35 | call void @external_void_func_i32(i32 42) |
| 36 | ret void |
| 37 | } |
| 38 | |
| 39 | attributes #0 = { nounwind } |
| 40 | attributes #1 = { nounwind readnone } |
| 41 | attributes #2 = { nounwind noinline } |