1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs -amdgpu-spill-sgpr-to-vgpr=true < %s | FileCheck -check-prefix=SPILL-TO-VGPR %s
3 ; RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs -amdgpu-spill-sgpr-to-vgpr=false < %s | FileCheck -check-prefix=NO-SPILL-TO-VGPR %s
5 ; Check frame setup where SGPR spills to VGPRs are disabled or enabled.
7 declare hidden void @external_void_func_void() #0
9 define void @callee_with_stack_and_call() #0 {
10 ; SPILL-TO-VGPR-LABEL: callee_with_stack_and_call:
11 ; SPILL-TO-VGPR: ; %bb.0:
12 ; SPILL-TO-VGPR-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13 ; SPILL-TO-VGPR-NEXT: s_mov_b32 s4, s33
14 ; SPILL-TO-VGPR-NEXT: s_mov_b32 s33, s32
15 ; SPILL-TO-VGPR-NEXT: s_or_saveexec_b64 s[8:9], -1
16 ; SPILL-TO-VGPR-NEXT: buffer_store_dword v40, off, s[0:3], s33 offset:4 ; 4-byte Folded Spill
17 ; SPILL-TO-VGPR-NEXT: s_mov_b64 exec, s[8:9]
18 ; SPILL-TO-VGPR-NEXT: v_writelane_b32 v40, s4, 2
19 ; SPILL-TO-VGPR-NEXT: s_addk_i32 s32, 0x400
20 ; SPILL-TO-VGPR-NEXT: v_writelane_b32 v40, s30, 0
21 ; SPILL-TO-VGPR-NEXT: v_mov_b32_e32 v0, 0
22 ; SPILL-TO-VGPR-NEXT: v_writelane_b32 v40, s31, 1
23 ; SPILL-TO-VGPR-NEXT: buffer_store_dword v0, off, s[0:3], s33
24 ; SPILL-TO-VGPR-NEXT: s_waitcnt vmcnt(0)
25 ; SPILL-TO-VGPR-NEXT: s_getpc_b64 s[4:5]
26 ; SPILL-TO-VGPR-NEXT: s_add_u32 s4, s4, external_void_func_void@rel32@lo+4
27 ; SPILL-TO-VGPR-NEXT: s_addc_u32 s5, s5, external_void_func_void@rel32@hi+12
28 ; SPILL-TO-VGPR-NEXT: s_swappc_b64 s[30:31], s[4:5]
29 ; SPILL-TO-VGPR-NEXT: v_readlane_b32 s31, v40, 1
30 ; SPILL-TO-VGPR-NEXT: v_readlane_b32 s30, v40, 0
31 ; SPILL-TO-VGPR-NEXT: v_readlane_b32 s4, v40, 2
32 ; SPILL-TO-VGPR-NEXT: s_or_saveexec_b64 s[6:7], -1
33 ; SPILL-TO-VGPR-NEXT: buffer_load_dword v40, off, s[0:3], s33 offset:4 ; 4-byte Folded Reload
34 ; SPILL-TO-VGPR-NEXT: s_mov_b64 exec, s[6:7]
35 ; SPILL-TO-VGPR-NEXT: s_addk_i32 s32, 0xfc00
36 ; SPILL-TO-VGPR-NEXT: s_mov_b32 s33, s4
37 ; SPILL-TO-VGPR-NEXT: s_waitcnt vmcnt(0)
38 ; SPILL-TO-VGPR-NEXT: s_setpc_b64 s[30:31]
40 ; NO-SPILL-TO-VGPR-LABEL: callee_with_stack_and_call:
41 ; NO-SPILL-TO-VGPR: ; %bb.0:
42 ; NO-SPILL-TO-VGPR-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
43 ; NO-SPILL-TO-VGPR-NEXT: s_mov_b32 s4, s33
44 ; NO-SPILL-TO-VGPR-NEXT: s_mov_b32 s33, s32
45 ; NO-SPILL-TO-VGPR-NEXT: v_mov_b32_e32 v0, s4
46 ; NO-SPILL-TO-VGPR-NEXT: buffer_store_dword v0, off, s[0:3], s33 offset:12 ; 4-byte Folded Spill
47 ; NO-SPILL-TO-VGPR-NEXT: s_addk_i32 s32, 0x800
48 ; NO-SPILL-TO-VGPR-NEXT: s_mov_b64 s[4:5], exec
49 ; NO-SPILL-TO-VGPR-NEXT: s_mov_b64 exec, 1
50 ; NO-SPILL-TO-VGPR-NEXT: buffer_store_dword v0, off, s[0:3], s33 offset:16
51 ; NO-SPILL-TO-VGPR-NEXT: v_writelane_b32 v0, s30, 0
52 ; NO-SPILL-TO-VGPR-NEXT: buffer_store_dword v0, off, s[0:3], s33 offset:4 ; 4-byte Folded Spill
53 ; NO-SPILL-TO-VGPR-NEXT: buffer_load_dword v0, off, s[0:3], s33 offset:16
54 ; NO-SPILL-TO-VGPR-NEXT: s_waitcnt vmcnt(0)
55 ; NO-SPILL-TO-VGPR-NEXT: s_mov_b64 exec, s[4:5]
56 ; NO-SPILL-TO-VGPR-NEXT: s_mov_b64 s[4:5], exec
57 ; NO-SPILL-TO-VGPR-NEXT: s_mov_b64 exec, 1
58 ; NO-SPILL-TO-VGPR-NEXT: buffer_store_dword v0, off, s[0:3], s33 offset:16
59 ; NO-SPILL-TO-VGPR-NEXT: v_writelane_b32 v0, s31, 0
60 ; NO-SPILL-TO-VGPR-NEXT: buffer_store_dword v0, off, s[0:3], s33 offset:8 ; 4-byte Folded Spill
61 ; NO-SPILL-TO-VGPR-NEXT: buffer_load_dword v0, off, s[0:3], s33 offset:16
62 ; NO-SPILL-TO-VGPR-NEXT: s_waitcnt vmcnt(0)
63 ; NO-SPILL-TO-VGPR-NEXT: s_mov_b64 exec, s[4:5]
64 ; NO-SPILL-TO-VGPR-NEXT: v_mov_b32_e32 v0, 0
65 ; NO-SPILL-TO-VGPR-NEXT: buffer_store_dword v0, off, s[0:3], s33
66 ; NO-SPILL-TO-VGPR-NEXT: s_waitcnt vmcnt(0)
67 ; NO-SPILL-TO-VGPR-NEXT: s_getpc_b64 s[4:5]
68 ; NO-SPILL-TO-VGPR-NEXT: s_add_u32 s4, s4, external_void_func_void@rel32@lo+4
69 ; NO-SPILL-TO-VGPR-NEXT: s_addc_u32 s5, s5, external_void_func_void@rel32@hi+12
70 ; NO-SPILL-TO-VGPR-NEXT: s_swappc_b64 s[30:31], s[4:5]
71 ; NO-SPILL-TO-VGPR-NEXT: s_mov_b64 s[4:5], exec
72 ; NO-SPILL-TO-VGPR-NEXT: s_mov_b64 exec, 1
73 ; NO-SPILL-TO-VGPR-NEXT: buffer_store_dword v0, off, s[0:3], s33 offset:16
74 ; NO-SPILL-TO-VGPR-NEXT: buffer_load_dword v0, off, s[0:3], s33 offset:8 ; 4-byte Folded Reload
75 ; NO-SPILL-TO-VGPR-NEXT: s_waitcnt vmcnt(0)
76 ; NO-SPILL-TO-VGPR-NEXT: v_readlane_b32 s31, v0, 0
77 ; NO-SPILL-TO-VGPR-NEXT: buffer_load_dword v0, off, s[0:3], s33 offset:16
78 ; NO-SPILL-TO-VGPR-NEXT: s_waitcnt vmcnt(0)
79 ; NO-SPILL-TO-VGPR-NEXT: s_mov_b64 exec, s[4:5]
80 ; NO-SPILL-TO-VGPR-NEXT: s_mov_b64 s[4:5], exec
81 ; NO-SPILL-TO-VGPR-NEXT: s_mov_b64 exec, 1
82 ; NO-SPILL-TO-VGPR-NEXT: buffer_store_dword v0, off, s[0:3], s33 offset:16
83 ; NO-SPILL-TO-VGPR-NEXT: buffer_load_dword v0, off, s[0:3], s33 offset:4 ; 4-byte Folded Reload
84 ; NO-SPILL-TO-VGPR-NEXT: s_waitcnt vmcnt(0)
85 ; NO-SPILL-TO-VGPR-NEXT: v_readlane_b32 s30, v0, 0
86 ; NO-SPILL-TO-VGPR-NEXT: buffer_load_dword v0, off, s[0:3], s33 offset:16
87 ; NO-SPILL-TO-VGPR-NEXT: s_waitcnt vmcnt(0)
88 ; NO-SPILL-TO-VGPR-NEXT: s_mov_b64 exec, s[4:5]
89 ; NO-SPILL-TO-VGPR-NEXT: buffer_load_dword v0, off, s[0:3], s33 offset:12 ; 4-byte Folded Reload
90 ; NO-SPILL-TO-VGPR-NEXT: s_addk_i32 s32, 0xf800
91 ; NO-SPILL-TO-VGPR-NEXT: s_waitcnt vmcnt(0)
92 ; NO-SPILL-TO-VGPR-NEXT: v_readfirstlane_b32 s4, v0
93 ; NO-SPILL-TO-VGPR-NEXT: s_mov_b32 s33, s4
94 ; NO-SPILL-TO-VGPR-NEXT: s_setpc_b64 s[30:31]
95 %alloca = alloca i32, addrspace(5)
96 store volatile i32 0, ptr addrspace(5) %alloca
97 call void @external_void_func_void()
101 attributes #0 = { nounwind "amdgpu-no-dispatch-id" "amdgpu-no-dispatch-ptr" "amdgpu-no-implicitarg-ptr" "amdgpu-no-workgroup-id-x" "amdgpu-no-workgroup-id-y" "amdgpu-no-workgroup-id-z" "amdgpu-no-workitem-id-x" "amdgpu-no-workitem-id-y" "amdgpu-no-workitem-id-z" }