Add AArch64 as an experimental target.
[oota-llvm.git] / test / CodeGen / AArch64 / local_vars.ll
1 ; RUN: llc -verify-machineinstrs < %s -march=aarch64 -O0 | FileCheck %s
2 ; RUN: llc -verify-machineinstrs < %s -march=aarch64 -O0 -disable-fp-elim | FileCheck -check-prefix CHECK-WITHFP %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: 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-WITHFP: trivial_fp_func:
28
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
44 define void @stack_local() {
45   %local_var = alloca i64
46 ; CHECK: stack_local:
47 ; 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 }