1 ; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu | FileCheck %s
2 ; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu -frame-pointer=all | FileCheck -check-prefix CHECK-WITHFP-ARM64 %s
4 ; Make sure a reasonably sane prologue and epilogue are
5 ; generated. This test is not robust in the face of an frame-handling
6 ; evolving, but still has value for unrelated changes, I
9 ; In particular, it will fail when ldp/stp are used for frame setup,
10 ; when FP-elim is implemented, and when addressing from FP is
14 @local_addr = global ptr null
18 define void @trivial_func() nounwind {
19 ; CHECK-LABEL: trivial_func: // @trivial_func
20 ; CHECK-NEXT: // %bb.0
26 define void @trivial_fp_func() uwtable {
27 ; CHECK-LABEL: trivial_fp_func:
28 ; CHECK: str x30, [sp, #-16]!
29 ; CHECK-NOT: mov x29, sp
31 ; CHECK-WITHFP-ARM64-LABEL: trivial_fp_func:
32 ; CHECK-WITHFP-ARM64: stp x29, x30, [sp, #-16]!
33 ; CHECK-WITHFP-ARM64-NEXT: .cfi_def_cfa_offset 16
34 ; CHECK-WITHFP-ARM64-NEXT: mov x29, sp
35 ; CHECK-WITHFP-ARM64-NEXT: .cfi_def_cfa w29, 16
36 ; CHECK-WITHFP-ARM64-NEXT: .cfi_offset w30, -8
37 ; CHECK-WITHFP-ARM64-NEXT: .cfi_offset w29, -16
39 ; Dont't really care, but it would be a Bad Thing if this came after the epilogue.
40 ; CHECK-WITHFP-ARM64: bl foo
45 ; CHECK: ldr x30, [sp], #16
46 ; CHECK-NEXT: .cfi_def_cfa_offset 0
47 ; CHECK-NEXT: .cfi_restore w30
50 ; CHECK-WITHFP-ARM64: .cfi_def_cfa wsp, 16
51 ; CHECK-WITHFP-ARM64-NEXT: ldp x29, x30, [sp], #16
52 ; CHECK-WITHFP-ARM64-NEXT: .cfi_def_cfa_offset 0
53 ; CHECK-WITHFP-ARM64-NEXT: .cfi_restore w30
54 ; CHECK-WITHFP-ARM64-NEXT: .cfi_restore w29
55 ; CHECK-WITHFP-ARM64-NEXT: ret
58 define void @stack_local() {
59 %local_var = alloca i64
60 ; CHECK-LABEL: stack_local:
61 ; CHECK: sub sp, sp, #16
63 %val = load i64, ptr @var
64 store i64 %val, ptr %local_var
65 ; CHECK-DAG: str {{x[0-9]+}}, [sp, #{{[0-9]+}}]
67 store ptr %local_var, ptr @local_addr
68 ; CHECK-DAG: add {{x[0-9]+}}, sp, #{{[0-9]+}}