2014-05-24 20:50:23 +08:00
|
|
|
; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu | FileCheck %s
|
|
|
|
; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu -disable-fp-elim | FileCheck -check-prefix CHECK-WITHFP-ARM64 %s
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
; Make sure a reasonably sane prologue and epilogue are
|
|
|
|
; generated. This test is not robust in the face of an frame-handling
|
|
|
|
; evolving, but still has value for unrelated changes, I
|
|
|
|
; believe.
|
|
|
|
;
|
|
|
|
; In particular, it will fail when ldp/stp are used for frame setup,
|
|
|
|
; when FP-elim is implemented, and when addressing from FP is
|
|
|
|
; implemented.
|
|
|
|
|
|
|
|
@var = global i64 0
|
|
|
|
@local_addr = global i64* null
|
|
|
|
|
|
|
|
declare void @foo()
|
|
|
|
|
|
|
|
define void @trivial_func() nounwind {
|
2014-04-22 20:45:47 +08:00
|
|
|
; CHECK-LABEL: trivial_func: // @trivial_func
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK-NEXT: // %bb.0
|
2013-01-31 20:12:40 +08:00
|
|
|
; CHECK-NEXT: ret
|
|
|
|
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @trivial_fp_func() {
|
2016-03-03 01:58:31 +08:00
|
|
|
; CHECK-LABEL: trivial_fp_func:
|
|
|
|
; CHECK: str x30, [sp, #-16]!
|
|
|
|
; CHECK-NOT: mov x29, sp
|
2013-01-31 20:12:40 +08:00
|
|
|
|
2014-04-22 20:45:47 +08:00
|
|
|
; CHECK-WITHFP-ARM64-LABEL: trivial_fp_func:
|
|
|
|
; CHECK-WITHFP-ARM64: stp x29, x30, [sp, #-16]!
|
|
|
|
; CHECK-WITHFP-ARM64-NEXT: mov x29, sp
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
; Dont't really care, but it would be a Bad Thing if this came after the epilogue.
|
2016-03-03 01:58:31 +08:00
|
|
|
; CHECK-WITHFP-ARM64: bl foo
|
2013-01-31 20:12:40 +08:00
|
|
|
; CHECK: bl foo
|
|
|
|
call void @foo()
|
|
|
|
ret void
|
|
|
|
|
2016-03-03 01:58:31 +08:00
|
|
|
; CHECK: ldr x30, [sp], #16
|
|
|
|
; CHECK-NEXT: ret
|
2013-01-31 20:12:40 +08:00
|
|
|
|
2016-03-03 01:58:31 +08:00
|
|
|
; CHECK-WITHFP-ARM64: ldp x29, x30, [sp], #16
|
|
|
|
; CHECK-WITHFP-ARM64-NEXT: ret
|
2013-01-31 20:12:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
define void @stack_local() {
|
|
|
|
%local_var = alloca i64
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: stack_local:
|
2013-01-31 20:12:40 +08:00
|
|
|
; CHECK: sub sp, sp, #16
|
|
|
|
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i64, i64* @var
|
2013-01-31 20:12:40 +08:00
|
|
|
store i64 %val, i64* %local_var
|
2014-04-22 20:45:47 +08:00
|
|
|
; CHECK-DAG: str {{x[0-9]+}}, [sp, #{{[0-9]+}}]
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
store i64* %local_var, i64** @local_addr
|
2014-04-22 20:45:47 +08:00
|
|
|
; CHECK-DAG: add {{x[0-9]+}}, sp, #{{[0-9]+}}
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
ret void
|
|
|
|
}
|