blob: b5cef859e35fcc7563f00919f7e8e50f344faeb8 [file] [log] [blame]
Tim Northovere3d42362013-02-01 11:40:47 +00001; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu -O0 | FileCheck %s
2; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu -O0 -disable-fp-elim | FileCheck -check-prefix CHECK-WITHFP %s
Tim Northovere0e3aef2013-01-31 12:12:40 +00003
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
16declare void @foo()
17
18define void @trivial_func() nounwind {
19; CHECK: trivial_func: // @trivial_func
20; CHECK-NEXT: // BB#0
21; CHECK-NEXT: ret
22
23 ret void
24}
25
26define void @trivial_fp_func() {
Stephen Lind24ab202013-07-14 06:24:09 +000027; CHECK-WITHFP-LABEL: trivial_fp_func:
Tim Northovere0e3aef2013-01-31 12:12:40 +000028
29; CHECK-WITHFP: sub sp, sp, #16
30; CHECK-WITHFP: stp x29, x30, [sp]
31; CHECK-WITHFP-NEXT: mov x29, sp
32
33; Dont't really care, but it would be a Bad Thing if this came after the epilogue.
34; CHECK: bl foo
35 call void @foo()
36 ret void
37
38; CHECK-WITHFP: ldp x29, x30, [sp]
39; CHECK-WITHFP: add sp, sp, #16
40
41; CHECK-WITHFP: ret
42}
43
44define void @stack_local() {
45 %local_var = alloca i64
Stephen Lind24ab202013-07-14 06:24:09 +000046; CHECK-LABEL: stack_local:
Tim Northovere0e3aef2013-01-31 12:12:40 +000047; CHECK: sub sp, sp, #16
48
49 %val = load i64* @var
50 store i64 %val, i64* %local_var
51; CHECK: str {{x[0-9]+}}, [sp, #{{[0-9]+}}]
52
53 store i64* %local_var, i64** @local_addr
54; CHECK: add {{x[0-9]+}}, sp, #{{[0-9]+}}
55
56 ret void
57}