1; RUN: llc -mtriple=arm64-apple-ios -o - %s | FileCheck %s --check-prefix=CHECK-RESERVE-X18
2; RUN: llc -mtriple=arm64-freebsd-gnu -aarch64-reserve-x18 -o - %s | FileCheck %s --check-prefix=CHECK-RESERVE-X18
3; RUN: llc -mtriple=arm64-linux-gnu -o - %s | FileCheck %s
4
5; x18 is reserved as a platform register on Darwin but not on other
6; systems. Create loads of register pressure and make sure this is respected.
7
8; Also, fp must always refer to a valid frame record, even if it's not the one
9; of the current function, so it shouldn't be used either.
10
11@var = global [30 x i64] zeroinitializer
12
13define void @keep_live() {
14  %val = load volatile [30 x i64]* @var
15  store volatile [30 x i64] %val, [30 x i64]* @var
16
17; CHECK: ldr x18
18; CHECK: str x18
19
20; CHECK-RESERVE-X18-NOT: ldr fp
21; CHECK-RESERVE-X18-NOT: ldr x18
22; CHECK-RESERVE-X18: Spill
23; CHECK-RESERVE-X18-NOT: ldr fp
24; CHECK-RESERVE-X18-NOT: ldr x18
25; CHECK-RESERVE-X18: ret
26  ret void
27}
28