blob: a07199c1a094019ccba506ecc89fbccaf34d4a2f [file] [log] [blame]
Matt Arsenaultb62a4eb2017-08-01 19:54:18 +00001; RUN: llc -amdgpu-function-calls -march=amdgcn -mcpu=hawaii -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GCN -check-prefix=CI %s
2; RUN: llc -amdgpu-function-calls -march=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GCN -check-prefix=GFX9 %s
Matt Arsenaultf28683c2017-06-26 17:53:59 +00003
4; GCN-LABEL: {{^}}callee_no_stack:
5; GCN: ; BB#0:
6; GCN-NEXT: s_waitcnt
7; GCN-NEXT: s_setpc_b64
8define void @callee_no_stack() #0 {
9 ret void
10}
11
Matt Arsenaultb62a4eb2017-08-01 19:54:18 +000012; GCN-LABEL: {{^}}callee_no_stack_no_fp_elim:
13; GCN: ; BB#0:
14; GCN-NEXT: s_waitcnt
15; GCN-NEXT: s_setpc_b64
16define void @callee_no_stack_no_fp_elim() #1 {
17 ret void
18}
19
Matt Arsenaultf28683c2017-06-26 17:53:59 +000020; Requires frame pointer for access to local regular object.
21
22; GCN-LABEL: {{^}}callee_with_stack:
23; GCN: ; BB#0:
24; GCN-NEXT: s_waitcnt
25; GCN-NEXT: s_mov_b32 s5, s32
26; GCN-NEXT: v_mov_b32_e32 v0, 0{{$}}
27; GCN-NEXT: buffer_store_dword v0, off, s[0:3], s5 offset:4{{$}}
28; GCN-NEXT: s_waitcnt
29; GCN-NEXT: s_setpc_b64
30define void @callee_with_stack() #0 {
31 %alloca = alloca i32
32 store volatile i32 0, i32* %alloca
33 ret void
34}
35
Matt Arsenaultb62a4eb2017-08-01 19:54:18 +000036; GCN-LABEL: {{^}}callee_with_stack_and_call:
37; GCN: ; BB#0:
38; GCN-NEXT: s_waitcnt
39
40; GCN-DAG: s_mov_b32 s5, s32
41; GCN-DAG: v_writelane_b32 v32, s33,
42; GCN-DAG: v_writelane_b32 v32, s34,
43; GCN-DAG: v_writelane_b32 v32, s35,
44; GCN-DAG: buffer_store_dword v0, off, s[0:3], s5 offset:4{{$}}
45; GCN-DAG: s_add_u32 s32, s32, 0x200{{$}}
46; GCN-DAG: v_mov_b32_e32 v0, 0{{$}}
47; GCN-DAG: s_mov_b32 s33, s5
48
49
50; GCN: s_swappc_b64
51; GCN: s_mov_b32 s5, s33
52; GCN-DAG: v_readlane_b32 s35,
53; GCN-DAG: v_readlane_b32 s34,
54; GCN-DAG: v_readlane_b32 s33,
55; GCN: s_waitcnt
56; GCN-NEXT: s_setpc_b64
57define void @callee_with_stack_and_call() #0 {
58 %alloca = alloca i32
59 store volatile i32 0, i32* %alloca
60 call void @external_void_func_void()
61 ret void
62}
63
64; Should be able to copy incoming stack pointer directly to inner
65; call's stack pointer argument.
66
67; GCN-LABEL: {{^}}callee_no_stack_with_call:
68; GCN: s_waitcnt
69; GCN-NOT: s32
70; GCN: s_mov_b32 s33, s5
71; GCN: s_swappc_b64
72; GCN: s_mov_b32 s5, s33
73; GCN-NOT: s32
74; GCN: s_setpc_b64
75define void @callee_no_stack_with_call() #0 {
76 call void @external_void_func_void()
77 ret void
78}
79
80declare void @external_void_func_void() #0
81
Matt Arsenaultf28683c2017-06-26 17:53:59 +000082attributes #0 = { nounwind }
Matt Arsenaultb62a4eb2017-08-01 19:54:18 +000083attributes #1 = { nounwind "no-frame-pointer-elim"="true" }