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