| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 |
| ; RUN: llc -mtriple=amdgcn -mcpu=fiji -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,FIJI %s |
| ; RUN: llc -mtriple=amdgcn -mcpu=hawaii -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,HAWAII %s |
| ; RUN: llc -mtriple=amdgcn -mcpu=gfx900 -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,GFX9 %s |
| |
| ; Test calls when called by other callable functions rather than |
| ; kernels. |
| |
| declare void @external_void_func_i32(i32) #0 |
| |
| ; Spill CSR VGPR used for SGPR spilling |
| define void @test_func_call_external_void_func_i32_imm() #0 { |
| ; GCN-LABEL: test_func_call_external_void_func_i32_imm: |
| ; GCN: ; %bb.0: |
| ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) |
| ; GCN-NEXT: s_mov_b32 s16, s33 |
| ; GCN-NEXT: s_mov_b32 s33, s32 |
| ; GCN-NEXT: s_or_saveexec_b64 s[18:19], -1 |
| ; GCN-NEXT: buffer_store_dword v40, off, s[0:3], s33 ; 4-byte Folded Spill |
| ; GCN-NEXT: s_mov_b64 exec, s[18:19] |
| ; GCN-NEXT: s_addk_i32 s32, 0x400 |
| ; GCN-NEXT: v_writelane_b32 v40, s16, 2 |
| ; GCN-NEXT: s_getpc_b64 s[16:17] |
| ; GCN-NEXT: s_add_u32 s16, s16, external_void_func_i32@gotpcrel32@lo+4 |
| ; GCN-NEXT: s_addc_u32 s17, s17, external_void_func_i32@gotpcrel32@hi+12 |
| ; GCN-NEXT: s_load_dwordx2 s[16:17], s[16:17], 0x0 |
| ; GCN-NEXT: v_writelane_b32 v40, s30, 0 |
| ; GCN-NEXT: v_mov_b32_e32 v0, 42 |
| ; GCN-NEXT: v_writelane_b32 v40, s31, 1 |
| ; GCN-NEXT: s_waitcnt lgkmcnt(0) |
| ; GCN-NEXT: s_swappc_b64 s[30:31], s[16:17] |
| ; GCN-NEXT: v_readlane_b32 s31, v40, 1 |
| ; GCN-NEXT: v_readlane_b32 s30, v40, 0 |
| ; GCN-NEXT: s_mov_b32 s32, s33 |
| ; GCN-NEXT: v_readlane_b32 s4, v40, 2 |
| ; GCN-NEXT: s_or_saveexec_b64 s[6:7], -1 |
| ; GCN-NEXT: buffer_load_dword v40, off, s[0:3], s33 ; 4-byte Folded Reload |
| ; GCN-NEXT: s_mov_b64 exec, s[6:7] |
| ; GCN-NEXT: s_mov_b32 s33, s4 |
| ; GCN-NEXT: s_waitcnt vmcnt(0) |
| ; GCN-NEXT: s_setpc_b64 s[30:31] |
| call void @external_void_func_i32(i32 42) |
| ret void |
| } |
| |
| define void @test_func_call_external_void_func_i32_imm_stack_use() #0 { |
| ; GCN-LABEL: test_func_call_external_void_func_i32_imm_stack_use: |
| ; GCN: ; %bb.0: |
| ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) |
| ; GCN-NEXT: s_mov_b32 s16, s33 |
| ; GCN-NEXT: s_mov_b32 s33, s32 |
| ; GCN-NEXT: s_or_saveexec_b64 s[18:19], -1 |
| ; GCN-NEXT: buffer_store_dword v40, off, s[0:3], s33 offset:64 ; 4-byte Folded Spill |
| ; GCN-NEXT: s_mov_b64 exec, s[18:19] |
| ; GCN-NEXT: s_addk_i32 s32, 0x1400 |
| ; GCN-NEXT: v_writelane_b32 v40, s16, 2 |
| ; GCN-NEXT: s_getpc_b64 s[16:17] |
| ; GCN-NEXT: s_add_u32 s16, s16, external_void_func_i32@gotpcrel32@lo+4 |
| ; GCN-NEXT: s_addc_u32 s17, s17, external_void_func_i32@gotpcrel32@hi+12 |
| ; GCN-NEXT: s_load_dwordx2 s[16:17], s[16:17], 0x0 |
| ; GCN-NEXT: v_mov_b32_e32 v0, 0 |
| ; GCN-NEXT: v_writelane_b32 v40, s30, 0 |
| ; GCN-NEXT: buffer_store_dword v0, off, s[0:3], s33 |
| ; GCN-NEXT: s_waitcnt vmcnt(0) |
| ; GCN-NEXT: buffer_store_dword v0, off, s[0:3], s33 offset:64 |
| ; GCN-NEXT: s_waitcnt vmcnt(0) |
| ; GCN-NEXT: v_mov_b32_e32 v0, 42 |
| ; GCN-NEXT: v_writelane_b32 v40, s31, 1 |
| ; GCN-NEXT: s_waitcnt lgkmcnt(0) |
| ; GCN-NEXT: s_swappc_b64 s[30:31], s[16:17] |
| ; GCN-NEXT: v_readlane_b32 s31, v40, 1 |
| ; GCN-NEXT: v_readlane_b32 s30, v40, 0 |
| ; GCN-NEXT: s_mov_b32 s32, s33 |
| ; GCN-NEXT: v_readlane_b32 s4, v40, 2 |
| ; GCN-NEXT: s_or_saveexec_b64 s[6:7], -1 |
| ; GCN-NEXT: buffer_load_dword v40, off, s[0:3], s33 offset:64 ; 4-byte Folded Reload |
| ; GCN-NEXT: s_mov_b64 exec, s[6:7] |
| ; GCN-NEXT: s_mov_b32 s33, s4 |
| ; GCN-NEXT: s_waitcnt vmcnt(0) |
| ; GCN-NEXT: s_setpc_b64 s[30:31] |
| %alloca = alloca [16 x i32], align 4, addrspace(5) |
| %gep15 = getelementptr inbounds [16 x i32], ptr addrspace(5) %alloca, i32 0, i32 16 |
| store volatile i32 0, ptr addrspace(5) %alloca |
| store volatile i32 0, ptr addrspace(5) %gep15 |
| call void @external_void_func_i32(i32 42) |
| ret void |
| } |
| |
| attributes #0 = { nounwind } |
| attributes #1 = { nounwind readnone } |
| attributes #2 = { nounwind noinline } |
| ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: |
| ; FIJI: {{.*}} |
| ; GFX9: {{.*}} |
| ; HAWAII: {{.*}} |