1 ; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu -tailcallopt | FileCheck %s
2 ; RUN: llc -verify-machineinstrs < %s -mtriple=arm64-none-linux-gnu -tailcallopt | FileCheck %s --check-prefix=CHECK-ARM64
4 ; This test is designed to be run in the situation where the
5 ; call-frame is not reserved (hence disable-fp-elim), but where
6 ; callee-pop can occur (hence tailcallopt).
8 declare fastcc void @will_pop([8 x i32], i32 %val)
10 define fastcc void @foo(i32 %in) {
13 %addr = alloca i8, i32 %in
15 ; Normal frame setup stuff:
18 ; CHECK-ARM64: stp x29, x30, [sp, #-16]!
19 ; CHECK-ARM64: mov x29, sp
21 ; Reserve space for call-frame:
22 ; CHECK: sub sp, sp, #16
23 ; CHECK-ARM64: sub sp, sp, #16
25 call fastcc void @will_pop([8 x i32] undef, i32 42)
27 ; CHECK-ARM64: bl will_pop
29 ; Since @will_pop is fastcc with tailcallopt, it will put the stack
30 ; back where it needs to be, we shouldn't duplicate that
31 ; CHECK-NOT: sub sp, sp, #16
32 ; CHECK-NOT: add sp, sp,
33 ; CHECK-ARM64-NOT: sub sp, sp, #16
34 ; CHECK-ARM64-NOT: add sp, sp,
38 ; CHECK-ARM64: mov sp, x29
39 ; CHECK-ARM64: ldp x29, x30, [sp], #16
43 declare void @wont_pop([8 x i32], i32 %val)
45 define void @foo1(i32 %in) {
48 %addr = alloca i8, i32 %in
49 ; Normal frame setup again
52 ; CHECK-ARM64: stp x29, x30, [sp, #-16]!
53 ; CHECK-ARM64: mov x29, sp
55 ; Reserve space for call-frame
56 ; CHECK: sub sp, sp, #16
57 ; CHECK-ARM64: sub sp, sp, #16
59 call void @wont_pop([8 x i32] undef, i32 42)
61 ; CHECK-ARM64: bl wont_pop
63 ; This time we *do* need to unreserve the call-frame
64 ; CHECK: add sp, sp, #16
65 ; CHECK-ARM64: add sp, sp, #16
67 ; Check for epilogue (primarily to make sure sp spotted above wasn't
71 ; CHECK-ARM64: mov sp, x29
72 ; CHECK-ARM64: ldp x29, x30, [sp], #16