Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/bitfield-bitint-abi-align8.c

raw
1 /* { dg-do compile { target bitint } } */
2 /* { dg-additional-options "-std=c23 -O2 -fno-stack-protector -save-temps -fno-schedule-insns -fno-schedule-insns2 -fno-late-combine-instructions" } */
3 /* { dg-final { check-function-bodies "**" "" "" } } */
4
5 #define ALIGN 8
6 #include "bitfield-bitint-abi.h"
7
8 // f1-f16 are all the same
9
10 /*
11 ** f1:
12 ** and x0, x1, 1
13 ** ret
14 */
15 /*
16 ** f8:
17 ** and x0, x1, 1
18 ** ret
19 */
20 /*
21 ** f16:
22 ** and x0, x2, 1
23 ** ret
24 */
25
26 /* fp seems to be unable to optimize away stack-usage, TODO: to fix. */
27
28 /*
29 ** fp:
30 **...
31 ** and x0, x1, 1
32 **...
33 ** ret
34 */
35
36 // all other f1p-f8p generate the same code, for f16p the value comes from x2
37 /*
38 ** f1p:
39 ** and x0, x1, 1
40 ** ret
41 */
42 /*
43 ** f8p:
44 ** and x0, x1, 1
45 ** ret
46 */
47 /*
48 ** f16p:
49 ** and x0, x2, 1
50 ** ret
51 */
52
53 // g1-g16 are all the same
54 /*
55 ** g1:
56 ** mov (w[0-9]+), w1
57 ** and x3, x0, 9223372036854775807
58 ** and x1, x0, 1
59 ** mov x2, 0
60 ** mov w0, \1
61 ** b f1
62 */
63
64 /*
65 ** g8:
66 ** mov (w[0-9]+), w1
67 ** and x3, x0, 9223372036854775807
68 ** and x1, x0, 1
69 ** mov x2, 0
70 ** mov w0, \1
71 ** b f8
72 */
73 /*
74 ** g16:
75 ** mov (x[0-9]+), x0
76 ** mov w0, w1
77 ** and x4, \1, 9223372036854775807
78 ** and x2, \1, 1
79 ** mov x3, 0
80 ** b f16
81 */
82
83 // again gp different from the rest
84
85 /*
86 ** gp:
87 ** sub sp, sp, #16
88 ** mov (x[0-9]+), x0
89 ** mov w0, w1
90 ** sbfx x([0-9]+), \1, 0, 63
91 ** mov (w[0-9]+), 0
92 ** bfi \3, w\2, 0, 1
93 ** and x3, x\2, 9223372036854775807
94 ** mov x2, 0
95 ** str xzr, \[sp\]
96 ** strb \3, \[sp\]
97 ** ldr x1, \[sp\]
98 ** add sp, sp, 16
99 ** b fp
100 */
101
102 // g1p-g8p are all the same, g16p uses x2 to pass parameter to f16p
103
104 /*
105 ** g1p:
106 ** mov (w[0-9]+), w1
107 ** and x3, x0, 9223372036854775807
108 ** and x1, x0, 1
109 ** mov x2, 0
110 ** mov w0, \1
111 ** b f1p
112 */
113 /*
114 ** g8p:
115 ** mov (w[0-9]+), w1
116 ** and x3, x0, 9223372036854775807
117 ** and x1, x0, 1
118 ** mov x2, 0
119 ** mov w0, \1
120 ** b f8p
121 */
122 /*
123 ** g16p:
124 ** mov (x[0-9]+), x0
125 ** mov w0, w1
126 ** and x4, \1, 9223372036854775807
127 ** and x2, \1, 1
128 ** mov x3, 0
129 ** b f16p
130 */
131
132 // f*_stack are all the same
133 /*
134 ** f1_stack:
135 ** ldr (x[0-9]+), \[sp, 8\]
136 ** and x0, \1, 1
137 ** ret
138 */
139 /*
140 ** f8_stack:
141 ** ldr (x[0-9]+), \[sp, 8\]
142 ** and x0, \1, 1
143 ** ret
144 */
145 /*
146 ** f16_stack:
147 ** ldr (x[0-9]+), \[sp, 16\]
148 ** and x0, \1, 1
149 ** ret
150 */
151
152 // fp{,1,8}_stack are all the same but fp16_stack loads from sp+16
153 /*
154 ** fp_stack:
155 ** ldr (x[0-9]+), \[sp, 8\]
156 ** and x0, \1, 1
157 ** ret
158 */
159 /*
160 ** f1p_stack:
161 ** ldr (x[0-9]+), \[sp, 8\]
162 ** and x0, \1, 1
163 ** ret
164 */
165 /*
166 ** f8p_stack:
167 ** ldr (x[0-9]+), \[sp, 8\]
168 ** and x0, \1, 1
169 ** ret
170 */
171
172 /*
173 ** f16p_stack:
174 ** ldr (x[0-9]+), \[sp, 16\]
175 ** and x0, \1, 1
176 ** ret
177 */
178
179 /*
180 ** gp_stack:
181 **...
182 ** mov x([0-9]+), x0
183 ** sxtw (x[0-9]+), w1
184 ** mov x0, \2
185 ** and x7, \2, 9223372036854775807
186 ** mov (w[0-9]+), 0
187 ** bfi \3, w\1, 0, 1
188 ** strb wzr, \[sp, 16\]
189 ** mov x6, x7
190 ** mov x5, x7
191 ** mov x4, x7
192 ** mov x3, x7
193 ** mov x2, x7
194 ** str xzr, \[sp, 48\]
195 ** strb \3, \[sp, 48\]
196 ** ldr (x[0-9]+), \[sp, 48\]
197 ** stp x7, \4, \[sp\]
198 ** mov x1, x7
199 ** bl fp_stack
200 ** sbfx x0, x0, 0, 63
201 **...
202 ** ret
203 */
204
205 /* g1 and g8 are the same. */
206
207 /*
208 ** g1_stack:
209 **...
210 ** mov (x[0-9]+), x0
211 ** sxtw (x[0-9]+), w1
212 ** mov x0, \2
213 ** and x7, \2, 9223372036854775807
214 ** mov (x[0-9]+), 0
215 ** sbfx (x[0-9]+), \1, 0, 63
216 ** bfi \3, \4, 0, 1
217 ** stp x7, x1, \[sp\]
218 ** mov x6, x7
219 ** mov x5, x7
220 ** mov x4, x7
221 ** mov x3, x7
222 ** mov x2, x7
223 ** mov x1, x7
224 ** str xzr, \[sp, 16\]
225 ** bl f1_stack
226 ** sbfx x0, x0, 0, 63
227 **...
228 ** ret
229 */
230
231 /*
232 ** g8_stack:
233 **...
234 ** mov (x[0-9]+), x0
235 ** sxtw (x[0-9]+), w1
236 ** mov x0, \2
237 ** and x7, \2, 9223372036854775807
238 ** mov (x[0-9]+), 0
239 ** sbfx (x[0-9]+), \1, 0, 63
240 ** bfi \3, \4, 0, 1
241 ** stp x7, x1, \[sp\]
242 ** mov x6, x7
243 ** mov x5, x7
244 ** mov x4, x7
245 ** mov x3, x7
246 ** mov x2, x7
247 ** mov x1, x7
248 ** str xzr, \[sp, 16\]
249 ** bl f8_stack
250 ** sbfx x0, x0, 0, 63
251 **...
252 ** ret
253 */
254
255 /*
256 ** g16_stack:
257 **...
258 ** mov (x[0-9]+), x0
259 ** sxtw (x[0-9]+), w1
260 ** mov x0, \2
261 ** and x7, \2, 9223372036854775807
262 ** mov (x[0-9]+), 0
263 ** sbfx (x[0-9]+), \1, 0, 63
264 ** bfi \3, \4, 0, 1
265 ** stp \3, xzr, \[sp, 16\]
266 ** mov x6, x7
267 ** mov x5, x7
268 ** mov x4, x7
269 ** mov x3, x7
270 ** mov x2, x7
271 ** mov x1, x7
272 ** str x7, \[sp\]
273 ** bl f16_stack
274 ** sbfx x0, x0, 0, 63
275 **...
276 ** ret
277 */
278
279 /*
280 ** f1_stdarg:
281 **...
282 ** and x0, x1, 1
283 **...
284 ** ret
285 */
286 /*
287 ** f16_stdarg:
288 **...
289 ** and x0, x2, 1
290 **...
291 ** ret
292 */
293
294 /*
295 ** fp_stdarg:
296 **...
297 ** and x0, x1, 1
298 **...
299 ** ret
300 */
301
302 /*
303 ** f1p_stdarg:
304 **...
305 ** and x0, x1, 1
306 **...
307 ** ret
308 */
309 /*
310 ** f8p_stdarg:
311 **...
312 ** and x0, x1, 1
313 **...
314 ** ret
315 */
316 /*
317 ** f16p_stdarg:
318 **...
319 ** and x0, x2, 1
320 **...
321 ** ret
322 */
323
324 /*
325 ** g1_stdarg:
326 ** mov (x[0-9]+), x0
327 ** mov w0, w1
328 ** and x1, \1, 1
329 ** mov x2, 0
330 ** b f1_stdarg
331 */
332
333 /*
334 ** g16_stdarg:
335 ** and x2, x0, 1
336 ** mov x3, 0
337 ** mov w0, w1
338 ** b f16_stdarg
339 */
340
341 /*
342 ** gp_stdarg:
343 **...
344 ** mov x([0-9]+), x0
345 ** mov w0, w1
346 ** mov (w[0-9]+), 0
347 ** bfi \2, w\1, 0, 1
348 ** mov x2, 0
349 ** str xzr, \[sp\]
350 ** strb \2, \[sp\]
351 ** ldr x1, \[sp\]
352 **...
353 ** b fp_stdarg
354 */
355
356 /*
357 ** g1p_stdarg:
358 ** mov (x[0-9]+), x0
359 ** mov w0, w1
360 ** and x1, \1, 1
361 ** mov x2, 0
362 ** b f1p_stdarg
363 */
364
365 /*
366 ** g8p_stdarg:
367 ** mov (x[0-9]+), x0
368 ** mov w0, w1
369 ** and x1, \1, 1
370 ** mov x2, 0
371 ** b f8p_stdarg
372 */
373
374 /*
375 ** g16p_stdarg:
376 ** and x2, x0, 1
377 ** mov x3, 0
378 ** mov w0, w1
379 ** b f16p_stdarg
380 */