[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / Driver / riscv-fixed-x-register.c
blob5759cd5ccf707c7939192308242af2cb2cba598e
1 // RUN: %clang --target=riscv32 -ffixed-x1 -### %s 2> %t
2 // RUN: FileCheck --check-prefix=CHECK-FIXED-X1 < %t %s
3 // RUN: %clang --target=riscv64 -ffixed-x1 -### %s 2> %t
4 // RUN: FileCheck --check-prefix=CHECK-FIXED-X1 < %t %s
5 // CHECK-FIXED-X1: "-target-feature" "+reserve-x1"
7 // RUN: %clang --target=riscv32 -ffixed-x2 -### %s 2> %t
8 // RUN: FileCheck --check-prefix=CHECK-FIXED-X2 < %t %s
9 // RUN: %clang --target=riscv64 -ffixed-x2 -### %s 2> %t
10 // RUN: FileCheck --check-prefix=CHECK-FIXED-X2 < %t %s
11 // CHECK-FIXED-X2: "-target-feature" "+reserve-x2"
13 // RUN: %clang --target=riscv32 -ffixed-x3 -### %s 2> %t
14 // RUN: FileCheck --check-prefix=CHECK-FIXED-X3 < %t %s
15 // RUN: %clang --target=riscv64 -ffixed-x3 -### %s 2> %t
16 // RUN: FileCheck --check-prefix=CHECK-FIXED-X3 < %t %s
17 // CHECK-FIXED-X3: "-target-feature" "+reserve-x3"
19 // RUN: %clang --target=riscv32 -ffixed-x4 -### %s 2> %t
20 // RUN: FileCheck --check-prefix=CHECK-FIXED-X4 < %t %s
21 // RUN: %clang --target=riscv64 -ffixed-x4 -### %s 2> %t
22 // RUN: FileCheck --check-prefix=CHECK-FIXED-X4 < %t %s
23 // CHECK-FIXED-X4: "-target-feature" "+reserve-x4"
25 // RUN: %clang --target=riscv32 -ffixed-x5 -### %s 2> %t
26 // RUN: FileCheck --check-prefix=CHECK-FIXED-X5 < %t %s
27 // RUN: %clang --target=riscv64 -ffixed-x5 -### %s 2> %t
28 // RUN: FileCheck --check-prefix=CHECK-FIXED-X5 < %t %s
29 // CHECK-FIXED-X5: "-target-feature" "+reserve-x5"
31 // RUN: %clang --target=riscv32 -ffixed-x6 -### %s 2> %t
32 // RUN: FileCheck --check-prefix=CHECK-FIXED-X6 < %t %s
33 // RUN: %clang --target=riscv64 -ffixed-x6 -### %s 2> %t
34 // RUN: FileCheck --check-prefix=CHECK-FIXED-X6 < %t %s
35 // CHECK-FIXED-X6: "-target-feature" "+reserve-x6"
37 // RUN: %clang --target=riscv32 -ffixed-x7 -### %s 2> %t
38 // RUN: FileCheck --check-prefix=CHECK-FIXED-X7 < %t %s
39 // RUN: %clang --target=riscv64 -ffixed-x7 -### %s 2> %t
40 // RUN: FileCheck --check-prefix=CHECK-FIXED-X7 < %t %s
41 // CHECK-FIXED-X7: "-target-feature" "+reserve-x7"
43 // RUN: %clang --target=riscv32 -ffixed-x8 -### %s 2> %t
44 // RUN: FileCheck --check-prefix=CHECK-FIXED-X8 < %t %s
45 // RUN: %clang --target=riscv64 -ffixed-x8 -### %s 2> %t
46 // RUN: FileCheck --check-prefix=CHECK-FIXED-X8 < %t %s
47 // CHECK-FIXED-X8: "-target-feature" "+reserve-x8"
49 // RUN: %clang --target=riscv32 -ffixed-x9 -### %s 2> %t
50 // RUN: FileCheck --check-prefix=CHECK-FIXED-X9 < %t %s
51 // RUN: %clang --target=riscv64 -ffixed-x9 -### %s 2> %t
52 // RUN: FileCheck --check-prefix=CHECK-FIXED-X9 < %t %s
53 // CHECK-FIXED-X9: "-target-feature" "+reserve-x9"
55 // RUN: %clang --target=riscv32 -ffixed-x10 -### %s 2> %t
56 // RUN: FileCheck --check-prefix=CHECK-FIXED-X10 < %t %s
57 // RUN: %clang --target=riscv64 -ffixed-x10 -### %s 2> %t
58 // RUN: FileCheck --check-prefix=CHECK-FIXED-X10 < %t %s
59 // CHECK-FIXED-X10: "-target-feature" "+reserve-x10"
61 // RUN: %clang --target=riscv32 -ffixed-x11 -### %s 2> %t
62 // RUN: FileCheck --check-prefix=CHECK-FIXED-X11 < %t %s
63 // RUN: %clang --target=riscv64 -ffixed-x11 -### %s 2> %t
64 // RUN: FileCheck --check-prefix=CHECK-FIXED-X11 < %t %s
65 // CHECK-FIXED-X11: "-target-feature" "+reserve-x11"
67 // RUN: %clang --target=riscv32 -ffixed-x12 -### %s 2> %t
68 // RUN: FileCheck --check-prefix=CHECK-FIXED-X12 < %t %s
69 // RUN: %clang --target=riscv64 -ffixed-x12 -### %s 2> %t
70 // RUN: FileCheck --check-prefix=CHECK-FIXED-X12 < %t %s
71 // CHECK-FIXED-X12: "-target-feature" "+reserve-x12"
73 // RUN: %clang --target=riscv32 -ffixed-x13 -### %s 2> %t
74 // RUN: FileCheck --check-prefix=CHECK-FIXED-X13 < %t %s
75 // RUN: %clang --target=riscv64 -ffixed-x13 -### %s 2> %t
76 // RUN: FileCheck --check-prefix=CHECK-FIXED-X13 < %t %s
77 // CHECK-FIXED-X13: "-target-feature" "+reserve-x13"
79 // RUN: %clang --target=riscv32 -ffixed-x14 -### %s 2> %t
80 // RUN: FileCheck --check-prefix=CHECK-FIXED-X14 < %t %s
81 // RUN: %clang --target=riscv64 -ffixed-x14 -### %s 2> %t
82 // RUN: FileCheck --check-prefix=CHECK-FIXED-X14 < %t %s
83 // CHECK-FIXED-X14: "-target-feature" "+reserve-x14"
85 // RUN: %clang --target=riscv32 -ffixed-x15 -### %s 2> %t
86 // RUN: FileCheck --check-prefix=CHECK-FIXED-X15 < %t %s
87 // RUN: %clang --target=riscv64 -ffixed-x15 -### %s 2> %t
88 // RUN: FileCheck --check-prefix=CHECK-FIXED-X15 < %t %s
89 // CHECK-FIXED-X15: "-target-feature" "+reserve-x15"
91 // RUN: %clang --target=riscv32 -ffixed-x16 -### %s 2> %t
92 // RUN: FileCheck --check-prefix=CHECK-FIXED-X16 < %t %s
93 // RUN: %clang --target=riscv64 -ffixed-x16 -### %s 2> %t
94 // RUN: FileCheck --check-prefix=CHECK-FIXED-X16 < %t %s
95 // CHECK-FIXED-X16: "-target-feature" "+reserve-x16"
97 // RUN: %clang --target=riscv32 -ffixed-x17 -### %s 2> %t
98 // RUN: FileCheck --check-prefix=CHECK-FIXED-X17 < %t %s
99 // RUN: %clang --target=riscv64 -ffixed-x17 -### %s 2> %t
100 // RUN: FileCheck --check-prefix=CHECK-FIXED-X17 < %t %s
101 // CHECK-FIXED-X17: "-target-feature" "+reserve-x17"
103 // RUN: %clang --target=riscv32 -ffixed-x18 -### %s 2> %t
104 // RUN: FileCheck --check-prefix=CHECK-FIXED-X18 < %t %s
105 // RUN: %clang --target=riscv64 -ffixed-x18 -### %s 2> %t
106 // RUN: FileCheck --check-prefix=CHECK-FIXED-X18 < %t %s
107 // CHECK-FIXED-X18: "-target-feature" "+reserve-x18"
109 // RUN: %clang --target=riscv32 -ffixed-x19 -### %s 2> %t
110 // RUN: FileCheck --check-prefix=CHECK-FIXED-X19 < %t %s
111 // RUN: %clang --target=riscv64 -ffixed-x19 -### %s 2> %t
112 // RUN: FileCheck --check-prefix=CHECK-FIXED-X19 < %t %s
113 // CHECK-FIXED-X19: "-target-feature" "+reserve-x19"
115 // RUN: %clang --target=riscv32 -ffixed-x20 -### %s 2> %t
116 // RUN: FileCheck --check-prefix=CHECK-FIXED-X20 < %t %s
117 // RUN: %clang --target=riscv64 -ffixed-x20 -### %s 2> %t
118 // RUN: FileCheck --check-prefix=CHECK-FIXED-X20 < %t %s
119 // CHECK-FIXED-X20: "-target-feature" "+reserve-x20"
121 // RUN: %clang --target=riscv32 -ffixed-x21 -### %s 2> %t
122 // RUN: FileCheck --check-prefix=CHECK-FIXED-X21 < %t %s
123 // RUN: %clang --target=riscv64 -ffixed-x21 -### %s 2> %t
124 // RUN: FileCheck --check-prefix=CHECK-FIXED-X21 < %t %s
125 // CHECK-FIXED-X21: "-target-feature" "+reserve-x21"
127 // RUN: %clang --target=riscv32 -ffixed-x22 -### %s 2> %t
128 // RUN: FileCheck --check-prefix=CHECK-FIXED-X22 < %t %s
129 // RUN: %clang --target=riscv64 -ffixed-x22 -### %s 2> %t
130 // RUN: FileCheck --check-prefix=CHECK-FIXED-X22 < %t %s
131 // CHECK-FIXED-X22: "-target-feature" "+reserve-x22"
133 // RUN: %clang --target=riscv32 -ffixed-x23 -### %s 2> %t
134 // RUN: FileCheck --check-prefix=CHECK-FIXED-X23 < %t %s
135 // RUN: %clang --target=riscv64 -ffixed-x23 -### %s 2> %t
136 // RUN: FileCheck --check-prefix=CHECK-FIXED-X23 < %t %s
137 // CHECK-FIXED-X23: "-target-feature" "+reserve-x23"
139 // RUN: %clang --target=riscv32 -ffixed-x24 -### %s 2> %t
140 // RUN: FileCheck --check-prefix=CHECK-FIXED-X24 < %t %s
141 // RUN: %clang --target=riscv64 -ffixed-x24 -### %s 2> %t
142 // RUN: FileCheck --check-prefix=CHECK-FIXED-X24 < %t %s
143 // CHECK-FIXED-X24: "-target-feature" "+reserve-x24"
145 // RUN: %clang --target=riscv32 -ffixed-x25 -### %s 2> %t
146 // RUN: FileCheck --check-prefix=CHECK-FIXED-X25 < %t %s
147 // RUN: %clang --target=riscv64 -ffixed-x25 -### %s 2> %t
148 // RUN: FileCheck --check-prefix=CHECK-FIXED-X25 < %t %s
149 // CHECK-FIXED-X25: "-target-feature" "+reserve-x25"
151 // RUN: %clang --target=riscv32 -ffixed-x26 -### %s 2> %t
152 // RUN: FileCheck --check-prefix=CHECK-FIXED-X26 < %t %s
153 // RUN: %clang --target=riscv64 -ffixed-x26 -### %s 2> %t
154 // RUN: FileCheck --check-prefix=CHECK-FIXED-X26 < %t %s
155 // CHECK-FIXED-X26: "-target-feature" "+reserve-x26"
157 // RUN: %clang --target=riscv32 -ffixed-x27 -### %s 2> %t
158 // RUN: FileCheck --check-prefix=CHECK-FIXED-X27 < %t %s
159 // RUN: %clang --target=riscv64 -ffixed-x27 -### %s 2> %t
160 // RUN: FileCheck --check-prefix=CHECK-FIXED-X27 < %t %s
161 // CHECK-FIXED-X27: "-target-feature" "+reserve-x27"
163 // RUN: %clang --target=riscv32 -ffixed-x28 -### %s 2> %t
164 // RUN: FileCheck --check-prefix=CHECK-FIXED-X28 < %t %s
165 // RUN: %clang --target=riscv64 -ffixed-x28 -### %s 2> %t
166 // RUN: FileCheck --check-prefix=CHECK-FIXED-X28 < %t %s
167 // CHECK-FIXED-X28: "-target-feature" "+reserve-x28"
169 // RUN: %clang --target=riscv32 -ffixed-x29 -### %s 2> %t
170 // RUN: FileCheck --check-prefix=CHECK-FIXED-X29 < %t %s
171 // RUN: %clang --target=riscv64 -ffixed-x29 -### %s 2> %t
172 // RUN: FileCheck --check-prefix=CHECK-FIXED-X29 < %t %s
173 // CHECK-FIXED-X29: "-target-feature" "+reserve-x29"
175 // RUN: %clang --target=riscv32 -ffixed-x30 -### %s 2> %t
176 // RUN: FileCheck --check-prefix=CHECK-FIXED-X30 < %t %s
177 // RUN: %clang --target=riscv64 -ffixed-x30 -### %s 2> %t
178 // RUN: FileCheck --check-prefix=CHECK-FIXED-X30 < %t %s
179 // CHECK-FIXED-X30: "-target-feature" "+reserve-x30"
181 // RUN: %clang --target=riscv32 -ffixed-x31 -### %s 2> %t
182 // RUN: FileCheck --check-prefix=CHECK-FIXED-X31 < %t %s
183 // RUN: %clang --target=riscv64 -ffixed-x31 -### %s 2> %t
184 // RUN: FileCheck --check-prefix=CHECK-FIXED-X31 < %t %s
185 // CHECK-FIXED-X31: "-target-feature" "+reserve-x31"
187 // Test multiple of reserve-x# options together.
188 // RUN: %clang --target=riscv32 \
189 // RUN: -ffixed-x1 \
190 // RUN: -ffixed-x2 \
191 // RUN: -ffixed-x18 \
192 // RUN: -### %s 2> %t
193 // RUN: FileCheck \
194 // RUN: --check-prefix=CHECK-FIXED-X1 \
195 // RUN: --check-prefix=CHECK-FIXED-X2 \
196 // RUN: --check-prefix=CHECK-FIXED-X18 \
197 // RUN: < %t %s
198 // RUN: %clang --target=riscv64 \
199 // RUN: -ffixed-x1 \
200 // RUN: -ffixed-x2 \
201 // RUN: -ffixed-x18 \
202 // RUN: -### %s 2> %t
203 // RUN: FileCheck \
204 // RUN: --check-prefix=CHECK-FIXED-X1 \
205 // RUN: --check-prefix=CHECK-FIXED-X2 \
206 // RUN: --check-prefix=CHECK-FIXED-X18 \
207 // RUN: < %t %s
209 // Test all reserve-x# options together.
210 // RUN: %clang --target=riscv32 \
211 // RUN: -ffixed-x1 \
212 // RUN: -ffixed-x2 \
213 // RUN: -ffixed-x3 \
214 // RUN: -ffixed-x4 \
215 // RUN: -ffixed-x5 \
216 // RUN: -ffixed-x6 \
217 // RUN: -ffixed-x7 \
218 // RUN: -ffixed-x8 \
219 // RUN: -ffixed-x9 \
220 // RUN: -ffixed-x10 \
221 // RUN: -ffixed-x11 \
222 // RUN: -ffixed-x12 \
223 // RUN: -ffixed-x13 \
224 // RUN: -ffixed-x14 \
225 // RUN: -ffixed-x15 \
226 // RUN: -ffixed-x16 \
227 // RUN: -ffixed-x17 \
228 // RUN: -ffixed-x18 \
229 // RUN: -ffixed-x19 \
230 // RUN: -ffixed-x20 \
231 // RUN: -ffixed-x21 \
232 // RUN: -ffixed-x22 \
233 // RUN: -ffixed-x23 \
234 // RUN: -ffixed-x24 \
235 // RUN: -ffixed-x25 \
236 // RUN: -ffixed-x26 \
237 // RUN: -ffixed-x27 \
238 // RUN: -ffixed-x28 \
239 // RUN: -ffixed-x29 \
240 // RUN: -ffixed-x30 \
241 // RUN: -ffixed-x31 \
242 // RUN: -### %s 2> %t
243 // RUN: FileCheck \
244 // RUN: --check-prefix=CHECK-FIXED-X1 \
245 // RUN: --check-prefix=CHECK-FIXED-X2 \
246 // RUN: --check-prefix=CHECK-FIXED-X3 \
247 // RUN: --check-prefix=CHECK-FIXED-X4 \
248 // RUN: --check-prefix=CHECK-FIXED-X5 \
249 // RUN: --check-prefix=CHECK-FIXED-X6 \
250 // RUN: --check-prefix=CHECK-FIXED-X7 \
251 // RUN: --check-prefix=CHECK-FIXED-X8 \
252 // RUN: --check-prefix=CHECK-FIXED-X9 \
253 // RUN: --check-prefix=CHECK-FIXED-X10 \
254 // RUN: --check-prefix=CHECK-FIXED-X11 \
255 // RUN: --check-prefix=CHECK-FIXED-X12 \
256 // RUN: --check-prefix=CHECK-FIXED-X13 \
257 // RUN: --check-prefix=CHECK-FIXED-X14 \
258 // RUN: --check-prefix=CHECK-FIXED-X15 \
259 // RUN: --check-prefix=CHECK-FIXED-X16 \
260 // RUN: --check-prefix=CHECK-FIXED-X17 \
261 // RUN: --check-prefix=CHECK-FIXED-X18 \
262 // RUN: --check-prefix=CHECK-FIXED-X19 \
263 // RUN: --check-prefix=CHECK-FIXED-X20 \
264 // RUN: --check-prefix=CHECK-FIXED-X21 \
265 // RUN: --check-prefix=CHECK-FIXED-X22 \
266 // RUN: --check-prefix=CHECK-FIXED-X23 \
267 // RUN: --check-prefix=CHECK-FIXED-X24 \
268 // RUN: --check-prefix=CHECK-FIXED-X25 \
269 // RUN: --check-prefix=CHECK-FIXED-X26 \
270 // RUN: --check-prefix=CHECK-FIXED-X27 \
271 // RUN: --check-prefix=CHECK-FIXED-X28 \
272 // RUN: --check-prefix=CHECK-FIXED-X29 \
273 // RUN: --check-prefix=CHECK-FIXED-X30 \
274 // RUN: --check-prefix=CHECK-FIXED-X31 \
275 // RUN: < %t %s
276 // RUN: %clang --target=riscv64 \
277 // RUN: -ffixed-x1 \
278 // RUN: -ffixed-x2 \
279 // RUN: -ffixed-x3 \
280 // RUN: -ffixed-x4 \
281 // RUN: -ffixed-x5 \
282 // RUN: -ffixed-x6 \
283 // RUN: -ffixed-x7 \
284 // RUN: -ffixed-x8 \
285 // RUN: -ffixed-x9 \
286 // RUN: -ffixed-x10 \
287 // RUN: -ffixed-x11 \
288 // RUN: -ffixed-x12 \
289 // RUN: -ffixed-x13 \
290 // RUN: -ffixed-x14 \
291 // RUN: -ffixed-x15 \
292 // RUN: -ffixed-x16 \
293 // RUN: -ffixed-x17 \
294 // RUN: -ffixed-x18 \
295 // RUN: -ffixed-x19 \
296 // RUN: -ffixed-x20 \
297 // RUN: -ffixed-x21 \
298 // RUN: -ffixed-x22 \
299 // RUN: -ffixed-x23 \
300 // RUN: -ffixed-x24 \
301 // RUN: -ffixed-x25 \
302 // RUN: -ffixed-x26 \
303 // RUN: -ffixed-x27 \
304 // RUN: -ffixed-x28 \
305 // RUN: -ffixed-x29 \
306 // RUN: -ffixed-x30 \
307 // RUN: -ffixed-x31 \
308 // RUN: -### %s 2> %t
309 // RUN: FileCheck \
310 // RUN: --check-prefix=CHECK-FIXED-X1 \
311 // RUN: --check-prefix=CHECK-FIXED-X2 \
312 // RUN: --check-prefix=CHECK-FIXED-X3 \
313 // RUN: --check-prefix=CHECK-FIXED-X4 \
314 // RUN: --check-prefix=CHECK-FIXED-X5 \
315 // RUN: --check-prefix=CHECK-FIXED-X6 \
316 // RUN: --check-prefix=CHECK-FIXED-X7 \
317 // RUN: --check-prefix=CHECK-FIXED-X8 \
318 // RUN: --check-prefix=CHECK-FIXED-X9 \
319 // RUN: --check-prefix=CHECK-FIXED-X10 \
320 // RUN: --check-prefix=CHECK-FIXED-X11 \
321 // RUN: --check-prefix=CHECK-FIXED-X12 \
322 // RUN: --check-prefix=CHECK-FIXED-X13 \
323 // RUN: --check-prefix=CHECK-FIXED-X14 \
324 // RUN: --check-prefix=CHECK-FIXED-X15 \
325 // RUN: --check-prefix=CHECK-FIXED-X16 \
326 // RUN: --check-prefix=CHECK-FIXED-X17 \
327 // RUN: --check-prefix=CHECK-FIXED-X18 \
328 // RUN: --check-prefix=CHECK-FIXED-X19 \
329 // RUN: --check-prefix=CHECK-FIXED-X20 \
330 // RUN: --check-prefix=CHECK-FIXED-X21 \
331 // RUN: --check-prefix=CHECK-FIXED-X22 \
332 // RUN: --check-prefix=CHECK-FIXED-X23 \
333 // RUN: --check-prefix=CHECK-FIXED-X24 \
334 // RUN: --check-prefix=CHECK-FIXED-X25 \
335 // RUN: --check-prefix=CHECK-FIXED-X26 \
336 // RUN: --check-prefix=CHECK-FIXED-X27 \
337 // RUN: --check-prefix=CHECK-FIXED-X28 \
338 // RUN: --check-prefix=CHECK-FIXED-X29 \
339 // RUN: --check-prefix=CHECK-FIXED-X30 \
340 // RUN: --check-prefix=CHECK-FIXED-X31 \
341 // RUN: < %t %s