1 ; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu | FileCheck %s 2 ; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu -disable-fp-elim | FileCheck -check-prefix CHECK-WITHFP-ARM64 %s 3 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 7 ; believe. 8 ; 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 11 ; implemented. 12 13 @var = global i64 0 14 @local_addr = global i64* null 15 16 declare void @foo() 17 18 define void @trivial_func() nounwind { 19 ; CHECK-LABEL: trivial_func: // @trivial_func 20 ; CHECK-NEXT: // BB#0 21 ; CHECK-NEXT: ret 22 23 ret void 24 } 25 26 define void @trivial_fp_func() { 27 ; CHECK-LABEL: trivial_fp_func: 28 ; CHECK: str x30, [sp, #-16]! 29 ; CHECK-NOT: mov x29, sp 30 31 ; CHECK-WITHFP-ARM64-LABEL: trivial_fp_func: 32 ; CHECK-WITHFP-ARM64: stp x29, x30, [sp, #-16]! 33 ; CHECK-WITHFP-ARM64-NEXT: mov x29, sp 34 35 ; Dont't really care, but it would be a Bad Thing if this came after the epilogue. 36 ; CHECK-WITHFP-ARM64: bl foo 37 ; CHECK: bl foo 38 call void @foo() 39 ret void 40 41 ; CHECK: ldr x30, [sp], #16 42 ; CHECK-NEXT: ret 43 44 ; CHECK-WITHFP-ARM64: ldp x29, x30, [sp], #16 45 ; CHECK-WITHFP-ARM64-NEXT: ret 46 } 47 48 define void @stack_local() { 49 %local_var = alloca i64 50 ; CHECK-LABEL: stack_local: 51 ; CHECK: sub sp, sp, #16 52 53 %val = load i64, i64* @var 54 store i64 %val, i64* %local_var 55 ; CHECK-DAG: str {{x[0-9]+}}, [sp, #{{[0-9]+}}] 56 57 store i64* %local_var, i64** @local_addr 58 ; CHECK-DAG: add {{x[0-9]+}}, sp, #{{[0-9]+}} 59 60 ret void 61 } 62