1*9880d681SAndroid Build Coastguard Worker; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu -disable-fp-elim | FileCheck -check-prefix CHECK-WITHFP-ARM64 %s 3*9880d681SAndroid Build Coastguard Worker 4*9880d681SAndroid Build Coastguard Worker; Make sure a reasonably sane prologue and epilogue are 5*9880d681SAndroid Build Coastguard Worker; generated. This test is not robust in the face of an frame-handling 6*9880d681SAndroid Build Coastguard Worker; evolving, but still has value for unrelated changes, I 7*9880d681SAndroid Build Coastguard Worker; believe. 8*9880d681SAndroid Build Coastguard Worker; 9*9880d681SAndroid Build Coastguard Worker; In particular, it will fail when ldp/stp are used for frame setup, 10*9880d681SAndroid Build Coastguard Worker; when FP-elim is implemented, and when addressing from FP is 11*9880d681SAndroid Build Coastguard Worker; implemented. 12*9880d681SAndroid Build Coastguard Worker 13*9880d681SAndroid Build Coastguard Worker@var = global i64 0 14*9880d681SAndroid Build Coastguard Worker@local_addr = global i64* null 15*9880d681SAndroid Build Coastguard Worker 16*9880d681SAndroid Build Coastguard Workerdeclare void @foo() 17*9880d681SAndroid Build Coastguard Worker 18*9880d681SAndroid Build Coastguard Workerdefine void @trivial_func() nounwind { 19*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: trivial_func: // @trivial_func 20*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: // BB#0 21*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret 22*9880d681SAndroid Build Coastguard Worker 23*9880d681SAndroid Build Coastguard Worker ret void 24*9880d681SAndroid Build Coastguard Worker} 25*9880d681SAndroid Build Coastguard Worker 26*9880d681SAndroid Build Coastguard Workerdefine void @trivial_fp_func() { 27*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: trivial_fp_func: 28*9880d681SAndroid Build Coastguard Worker; CHECK: str x30, [sp, #-16]! 29*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: mov x29, sp 30*9880d681SAndroid Build Coastguard Worker 31*9880d681SAndroid Build Coastguard Worker; CHECK-WITHFP-ARM64-LABEL: trivial_fp_func: 32*9880d681SAndroid Build Coastguard Worker; CHECK-WITHFP-ARM64: stp x29, x30, [sp, #-16]! 33*9880d681SAndroid Build Coastguard Worker; CHECK-WITHFP-ARM64-NEXT: mov x29, sp 34*9880d681SAndroid Build Coastguard Worker 35*9880d681SAndroid Build Coastguard Worker; Dont't really care, but it would be a Bad Thing if this came after the epilogue. 36*9880d681SAndroid Build Coastguard Worker; CHECK-WITHFP-ARM64: bl foo 37*9880d681SAndroid Build Coastguard Worker; CHECK: bl foo 38*9880d681SAndroid Build Coastguard Worker call void @foo() 39*9880d681SAndroid Build Coastguard Worker ret void 40*9880d681SAndroid Build Coastguard Worker 41*9880d681SAndroid Build Coastguard Worker; CHECK: ldr x30, [sp], #16 42*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret 43*9880d681SAndroid Build Coastguard Worker 44*9880d681SAndroid Build Coastguard Worker; CHECK-WITHFP-ARM64: ldp x29, x30, [sp], #16 45*9880d681SAndroid Build Coastguard Worker; CHECK-WITHFP-ARM64-NEXT: ret 46*9880d681SAndroid Build Coastguard Worker} 47*9880d681SAndroid Build Coastguard Worker 48*9880d681SAndroid Build Coastguard Workerdefine void @stack_local() { 49*9880d681SAndroid Build Coastguard Worker %local_var = alloca i64 50*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: stack_local: 51*9880d681SAndroid Build Coastguard Worker; CHECK: sub sp, sp, #16 52*9880d681SAndroid Build Coastguard Worker 53*9880d681SAndroid Build Coastguard Worker %val = load i64, i64* @var 54*9880d681SAndroid Build Coastguard Worker store i64 %val, i64* %local_var 55*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: str {{x[0-9]+}}, [sp, #{{[0-9]+}}] 56*9880d681SAndroid Build Coastguard Worker 57*9880d681SAndroid Build Coastguard Worker store i64* %local_var, i64** @local_addr 58*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: add {{x[0-9]+}}, sp, #{{[0-9]+}} 59*9880d681SAndroid Build Coastguard Worker 60*9880d681SAndroid Build Coastguard Worker ret void 61*9880d681SAndroid Build Coastguard Worker} 62