1 ; RUN: llc -verify-machineinstrs < %s -mtriple=arm64-none-linux-gnu -tailcallopt | FileCheck %s --check-prefix=CHECK-ARM64
3 ; This test is designed to be run in the situation where the
4 ; call-frame is not reserved (hence disable-fp-elim), but where
5 ; callee-pop can occur (hence tailcallopt).
7 declare fastcc void @will_pop([8 x i32], i32 %val)
9 define fastcc void @foo(i32 %in) {
12 %addr = alloca i8, i32 %in
14 ; Normal frame setup stuff:
17 ; CHECK-ARM64: stp x29, x30, [sp, #-16]!
18 ; CHECK-ARM64: mov x29, sp
20 ; Reserve space for call-frame:
21 ; CHECK: sub sp, sp, #16
22 ; CHECK-ARM64: sub sp, sp, #16
24 call fastcc void @will_pop([8 x i32] undef, i32 42)
26 ; CHECK-ARM64: bl will_pop
28 ; Since @will_pop is fastcc with tailcallopt, it will put the stack
29 ; back where it needs to be, we shouldn't duplicate that
30 ; CHECK-NOT: sub sp, sp, #16
31 ; CHECK-NOT: add sp, sp,
32 ; CHECK-ARM64-NOT: sub sp, sp, #16
33 ; CHECK-ARM64-NOT: add sp, sp,
37 ; CHECK-ARM64: mov sp, x29
38 ; CHECK-ARM64: ldp x29, x30, [sp], #16
42 declare void @wont_pop([8 x i32], i32 %val)
44 define void @foo1(i32 %in) {
47 %addr = alloca i8, i32 %in
48 ; Normal frame setup again
51 ; CHECK-ARM64: stp x29, x30, [sp, #-16]!
52 ; CHECK-ARM64: mov x29, sp
54 ; Reserve space for call-frame
55 ; CHECK: sub sp, sp, #16
56 ; CHECK-ARM64: sub sp, sp, #16
58 call void @wont_pop([8 x i32] undef, i32 42)
60 ; CHECK-ARM64: bl wont_pop
62 ; This time we *do* need to unreserve the call-frame
63 ; CHECK: add sp, sp, #16
64 ; CHECK-ARM64: add sp, sp, #16
66 ; Check for epilogue (primarily to make sure sp spotted above wasn't
70 ; CHECK-ARM64: mov sp, x29
71 ; CHECK-ARM64: ldp x29, x30, [sp], #16