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