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=arm64-linux-gnu -o - %s | FileCheck %s
4 ; RUN: llc -mtriple=aarch64-linux-android -o - %s | FileCheck %s --check-prefix=CHECK-RESERVE --check-prefix=CHECK-RESERVE-X18
5 ; RUN: llc -mtriple=aarch64-fuchsia -o - %s | FileCheck %s --check-prefix=CHECK-RESERVE --check-prefix=CHECK-RESERVE-X18
6 ; RUN: llc -mtriple=aarch64-windows -o - %s | FileCheck %s --check-prefix=CHECK-RESERVE --check-prefix=CHECK-RESERVE-X18
8 ; Test reserve-x# options individually.
9 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x1 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X1
10 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x2 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X2
11 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x3 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X3
12 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x4 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X4
13 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x5 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X5
14 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x6 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X6
15 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x7 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X7
16 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x9 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X9
17 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x10 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X10
18 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x11 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X11
19 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x12 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X12
20 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x13 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X13
21 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x14 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X14
22 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x15 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X15
23 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x20 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X20
24 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x21 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X21
25 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x22 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X22
26 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x23 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X23
27 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x24 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X24
28 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x25 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X25
29 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x26 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X26
30 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x27 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X27
31 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+reserve-x28 -o - %s | FileCheck %s --check-prefixes=CHECK-RESERVE,CHECK-RESERVE-X28
33 ; Test multiple of reserve-x# options together.
34 ; RUN: llc -mtriple=arm64-linux-gnu \
35 ; RUN: -mattr=+reserve-x1 \
36 ; RUN: -mattr=+reserve-x2 \
37 ; RUN: -mattr=+reserve-x18 \
38 ; RUN: -o - %s | FileCheck %s \
39 ; RUN: --check-prefix=CHECK-RESERVE \
40 ; RUN: --check-prefix=CHECK-RESERVE-X1 \
41 ; RUN: --check-prefix=CHECK-RESERVE-X2 \
42 ; RUN: --check-prefix=CHECK-RESERVE-X18
44 ; Test all reserve-x# options together.
45 ; RUN: llc -mtriple=arm64-linux-gnu \
46 ; RUN: -mattr=+reserve-x1 \
47 ; RUN: -mattr=+reserve-x2 \
48 ; RUN: -mattr=+reserve-x3 \
49 ; RUN: -mattr=+reserve-x4 \
50 ; RUN: -mattr=+reserve-x5 \
51 ; RUN: -mattr=+reserve-x6 \
52 ; RUN: -mattr=+reserve-x7 \
53 ; RUN: -mattr=+reserve-x9 \
54 ; RUN: -mattr=+reserve-x10 \
55 ; RUN: -mattr=+reserve-x11 \
56 ; RUN: -mattr=+reserve-x12 \
57 ; RUN: -mattr=+reserve-x13 \
58 ; RUN: -mattr=+reserve-x14 \
59 ; RUN: -mattr=+reserve-x15 \
60 ; RUN: -mattr=+reserve-x18 \
61 ; RUN: -mattr=+reserve-x20 \
62 ; RUN: -mattr=+reserve-x21 \
63 ; RUN: -mattr=+reserve-x22 \
64 ; RUN: -mattr=+reserve-x23 \
65 ; RUN: -mattr=+reserve-x24 \
66 ; RUN: -mattr=+reserve-x25 \
67 ; RUN: -mattr=+reserve-x26 \
68 ; RUN: -mattr=+reserve-x27 \
69 ; RUN: -mattr=+reserve-x28 \
70 ; RUN: -o - %s | FileCheck %s \
71 ; RUN: --check-prefix=CHECK-RESERVE \
72 ; RUN: --check-prefix=CHECK-RESERVE-X1 \
73 ; RUN: --check-prefix=CHECK-RESERVE-X2 \
74 ; RUN: --check-prefix=CHECK-RESERVE-X3 \
75 ; RUN: --check-prefix=CHECK-RESERVE-X4 \
76 ; RUN: --check-prefix=CHECK-RESERVE-X5 \
77 ; RUN: --check-prefix=CHECK-RESERVE-X6 \
78 ; RUN: --check-prefix=CHECK-RESERVE-X7 \
79 ; RUN: --check-prefix=CHECK-RESERVE-X9 \
80 ; RUN: --check-prefix=CHECK-RESERVE-X10 \
81 ; RUN: --check-prefix=CHECK-RESERVE-X11 \
82 ; RUN: --check-prefix=CHECK-RESERVE-X12 \
83 ; RUN: --check-prefix=CHECK-RESERVE-X13 \
84 ; RUN: --check-prefix=CHECK-RESERVE-X14 \
85 ; RUN: --check-prefix=CHECK-RESERVE-X15 \
86 ; RUN: --check-prefix=CHECK-RESERVE-X18 \
87 ; RUN: --check-prefix=CHECK-RESERVE-X20 \
88 ; RUN: --check-prefix=CHECK-RESERVE-X21 \
89 ; RUN: --check-prefix=CHECK-RESERVE-X22 \
90 ; RUN: --check-prefix=CHECK-RESERVE-X23 \
91 ; RUN: --check-prefix=CHECK-RESERVE-X24 \
92 ; RUN: --check-prefix=CHECK-RESERVE-X25 \
93 ; RUN: --check-prefix=CHECK-RESERVE-X26 \
94 ; RUN: --check-prefix=CHECK-RESERVE-X27 \
95 ; RUN: --check-prefix=CHECK-RESERVE-X28
97 ; x18 is reserved as a platform register on Darwin but not on other
98 ; systems. Create loads of register pressure and make sure this is respected.
100 ; Also, fp must always refer to a valid frame record, even if it's not the one
101 ; of the current function, so it shouldn't be used either.
103 @var = global [30 x i64] zeroinitializer
105 define void @keep_live() {
106 %val = load volatile [30 x i64], [30 x i64]* @var
107 store volatile [30 x i64] %val, [30 x i64]* @var
112 ; CHECK-RESERVE-NOT: ldr fp
113 ; CHECK-RESERVE-X1-NOT: ldr x1,
114 ; CHECK-RESERVE-X2-NOT: ldr x2,
115 ; CHECK-RESERVE-X3-NOT: ldr x3,
116 ; CHECK-RESERVE-X4-NOT: ldr x4,
117 ; CHECK-RESERVE-X5-NOT: ldr x5,
118 ; CHECK-RESERVE-X6-NOT: ldr x6,
119 ; CHECK-RESERVE-X7-NOT: ldr x7,
120 ; CHECK-RESERVE-X9-NOT: ldr x9,
121 ; CHECK-RESERVE-X10-NOT: ldr x10,
122 ; CHECK-RESERVE-X11-NOT: ldr x11,
123 ; CHECK-RESERVE-X12-NOT: ldr x12,
124 ; CHECK-RESERVE-X13-NOT: ldr x13,
125 ; CHECK-RESERVE-X14-NOT: ldr x14,
126 ; CHECK-RESERVE-X15-NOT: ldr x15,
127 ; CHECK-RESERVE-X18-NOT: ldr x18
128 ; CHECK-RESERVE-X20-NOT: ldr x20
129 ; CHECK-RESERVE-X21-NOT: ldr x21
130 ; CHECK-RESERVE-X22-NOT: ldr x22
131 ; CHECK-RESERVE-X23-NOT: ldr x23
132 ; CHECK-RESERVE-X24-NOT: ldr x24
133 ; CHECK-RESERVE-X25-NOT: ldr x25
134 ; CHECK-RESERVE-X26-NOT: ldr x26
135 ; CHECK-RESERVE-X27-NOT: ldr x27
136 ; CHECK-RESERVE-X28-NOT: ldr x28
137 ; CHECK-RESERVE: Spill
138 ; CHECK-RESERVE-NOT: ldr fp
139 ; CHECK-RESERVE-X1-NOT: ldr x1,
140 ; CHECK-RESERVE-X2-NOT: ldr x2,
141 ; CHECK-RESERVE-X3-NOT: ldr x3,
142 ; CHECK-RESERVE-X4-NOT: ldr x4,
143 ; CHECK-RESERVE-X5-NOT: ldr x5,
144 ; CHECK-RESERVE-X6-NOT: ldr x6,
145 ; CHECK-RESERVE-X7-NOT: ldr x7,
146 ; CHECK-RESERVE-X9-NOT: ldr x9,
147 ; CHECK-RESERVE-X10-NOT: ldr x10,
148 ; CHECK-RESERVE-X11-NOT: ldr x11,
149 ; CHECK-RESERVE-X12-NOT: ldr x12,
150 ; CHECK-RESERVE-X13-NOT: ldr x13,
151 ; CHECK-RESERVE-X14-NOT: ldr x14,
152 ; CHECK-RESERVE-X15-NOT: ldr x15,
153 ; CHECK-RESERVE-X18-NOT: ldr x18
154 ; CHECK-RESERVE-X20-NOT: ldr x20
155 ; CHECK-RESERVE-X21-NOT: ldr x21
156 ; CHECK-RESERVE-X22-NOT: ldr x22
157 ; CHECK-RESERVE-X23-NOT: ldr x23
158 ; CHECK-RESERVE-X24-NOT: ldr x24
159 ; CHECK-RESERVE-X25-NOT: ldr x25
160 ; CHECK-RESERVE-X26-NOT: ldr x26
161 ; CHECK-RESERVE-X27-NOT: ldr x27
162 ; CHECK-RESERVE-X28-NOT: ldr x28