Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/sve/pcs/struct_3_128.c

raw
1 /* { dg-options "-O -msve-vector-bits=128" } */
2 /* { dg-require-effective-target aarch64_little_endian }
3 /* { dg-final { check-function-bodies "**" "" } } */
4
5 #include "struct.h"
6
7 #define CONSUME(VAR) \
8 { \
9 register void *ptr_ asm ("x7") = &(VAR); \
10 asm volatile ("" :: "r" (ptr_) : "memory"); \
11 }
12
13 #define SEL2(TAG, TYPE) \
14 TAG TYPE \
15 sel2_##TYPE (TAG TYPE x, TAG TYPE y) \
16 { \
17 return y; \
18 }
19
20 #define WRAP(TYPE) \
21 struct wrap_##TYPE \
22 { \
23 TYPE data; \
24 }; \
25 SEL2 (struct, wrap_##TYPE)
26
27 /*
28 ** sel2_wrap_fixed_int8_t:
29 ** mov z0\.d, z1\.d
30 ** ret
31 */
32 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_wrap_fixed_int8_t\n} } } */
33 WRAP (fixed_int8_t);
34
35 /*
36 ** sel2_wrap_fixed_int16_t:
37 ** mov z0\.d, z1\.d
38 ** ret
39 */
40 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_wrap_fixed_int16_t\n} } } */
41 WRAP (fixed_int16_t);
42
43 /*
44 ** sel2_wrap_fixed_int32_t:
45 ** mov z0\.d, z1\.d
46 ** ret
47 */
48 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_wrap_fixed_int32_t\n} } } */
49 WRAP (fixed_int32_t);
50
51 /*
52 ** sel2_wrap_fixed_int64_t:
53 ** mov z0\.d, z1\.d
54 ** ret
55 */
56 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_wrap_fixed_int64_t\n} } } */
57 WRAP (fixed_int64_t);
58
59 /*
60 ** sel2_wrap_fixed_uint8_t:
61 ** mov z0\.d, z1\.d
62 ** ret
63 */
64 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_wrap_fixed_uint8_t\n} } } */
65 WRAP (fixed_uint8_t);
66
67 /*
68 ** sel2_wrap_fixed_uint16_t:
69 ** mov z0\.d, z1\.d
70 ** ret
71 */
72 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_wrap_fixed_uint16_t\n} } } */
73 WRAP (fixed_uint16_t);
74
75 /*
76 ** sel2_wrap_fixed_uint32_t:
77 ** mov z0\.d, z1\.d
78 ** ret
79 */
80 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_wrap_fixed_uint32_t\n} } } */
81 WRAP (fixed_uint32_t);
82
83 /*
84 ** sel2_wrap_fixed_uint64_t:
85 ** mov z0\.d, z1\.d
86 ** ret
87 */
88 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_wrap_fixed_uint64_t\n} } } */
89 WRAP (fixed_uint64_t);
90
91 /*
92 ** sel2_wrap_fixed_bfloat16_t:
93 ** mov z0\.d, z1\.d
94 ** ret
95 */
96 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_wrap_fixed_bfloat16_t\n} } } */
97 WRAP (fixed_bfloat16_t);
98
99 /*
100 ** sel2_wrap_fixed_float16_t:
101 ** mov z0\.d, z1\.d
102 ** ret
103 */
104 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_wrap_fixed_float16_t\n} } } */
105 WRAP (fixed_float16_t);
106
107 /*
108 ** sel2_wrap_fixed_float32_t:
109 ** mov z0\.d, z1\.d
110 ** ret
111 */
112 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_wrap_fixed_float32_t\n} } } */
113 WRAP (fixed_float32_t);
114
115 /*
116 ** sel2_wrap_fixed_float64_t:
117 ** mov z0\.d, z1\.d
118 ** ret
119 */
120 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_wrap_fixed_float64_t\n} } } */
121 WRAP (fixed_float64_t);
122
123 /*
124 ** sel2_wrap_fixed_bool_t:
125 ** mov p0\.b, p1\.b
126 ** ret
127 */
128 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_wrap_fixed_bool_t\n} } } */
129 WRAP (fixed_bool_t);
130
131 struct pst_arr1
132 {
133 fixed_uint8_t u8[1];
134 };
135
136 /*
137 ** sel2_pst_arr1:
138 ** mov z0\.d, z1\.d
139 ** ret
140 */
141 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_pst_arr1\n} } } */
142 SEL2 (struct, pst_arr1)
143
144 /*
145 ** test_pst_arr1:
146 ** eor z0\.b, z0\.b, #(?:0x)?1
147 ** ret
148 */
149 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_arr1\n} } } */
150 svuint8_t
151 test_pst_arr1 (struct pst_arr1 x)
152 {
153 return sveor_x (svptrue_b8 (), x.u8[0], 1);
154 }
155
156 struct pst_arr2
157 {
158 fixed_uint8_t u8[2];
159 };
160 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_pst_arr2\n} } } */
161 SEL2 (struct, pst_arr2)
162
163 /*
164 ** test_pst_arr2:
165 ** sub z0\.b, z0\.b, z1\.b
166 ** ret
167 */
168 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_arr2\n} } } */
169 svuint8_t
170 test_pst_arr2 (struct pst_arr2 x)
171 {
172 return svsub_x (svptrue_b8 (), x.u8[0], x.u8[1]);
173 }
174
175 struct pst_arr3
176 {
177 fixed_uint16_t u16[3];
178 };
179 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_pst_arr3\n} } } */
180 SEL2 (struct, pst_arr3)
181
182 /*
183 ** test_pst_arr3:
184 ** sub z0\.h, z0\.h, z2\.h
185 ** ret
186 */
187 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_arr3\n} } } */
188 svuint16_t
189 test_pst_arr3 (struct pst_arr3 x)
190 {
191 return svsub_x (svptrue_b8 (), x.u16[0], x.u16[2]);
192 }
193
194 struct pst_arr4
195 {
196 fixed_uint32_t u32[4];
197 };
198 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_pst_arr4\n} } } */
199 SEL2 (struct, pst_arr4)
200
201 /*
202 ** test_pst_arr4:
203 ** sub z0\.s, z0\.s, z3\.s
204 ** ret
205 */
206 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_arr4\n} } } */
207 svuint32_t
208 test_pst_arr4 (struct pst_arr4 x)
209 {
210 return svsub_x (svptrue_b8 (), x.u32[0], x.u32[3]);
211 }
212
213 struct pst_arr5
214 {
215 fixed_uint64_t u64[2][2][2];
216 };
217 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_pst_arr5\n} } } */
218 SEL2 (struct, pst_arr5)
219
220 /*
221 ** test_pst_arr5:
222 ** sub sp, sp, #128
223 ** (
224 ** str z0, \[sp\]
225 ** str z1, \[sp, #1, mul vl\]
226 ** str z2, \[sp, #2, mul vl\]
227 ** str z3, \[sp, #3, mul vl\]
228 ** str z4, \[sp, #4, mul vl\]
229 ** str z5, \[sp, #5, mul vl\]
230 ** str z6, \[sp, #6, mul vl\]
231 ** str z7, \[sp, #7, mul vl\]
232 ** |
233 ** stp q0, q1, \[sp\]
234 ** stp q2, q3, \[sp, 32\]
235 ** stp q4, q5, \[sp, 64\]
236 ** stp q6, q7, \[sp, 96\]
237 ** )
238 ** mov (x7, sp|w7, wsp)
239 ** add sp, sp, #?128
240 ** ret
241 */
242 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_arr5\n} } } */
243 void
244 test_pst_arr5 (struct pst_arr5 x)
245 {
246 CONSUME (x);
247 }
248
249 /*
250 ** test_pst_arr5_x0:
251 ** (
252 ** mov z0\.d, z7\.d
253 ** mov (x7, x0|w7, w0)
254 ** |
255 ** mov (x7, x0|w7, w0)
256 ** mov z0\.d, z7\.d
257 ** )
258 ** ret
259 */
260 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_arr5_x0\n} } } */
261 svint32_t
262 test_pst_arr5_x0 (svint32_t z0, struct pst_arr5 x,
263 svint32_t z1, svint32_t z2, svint32_t z3, svint32_t z4,
264 svint32_t z5, svint32_t z6, svint32_t z7)
265 {
266 CONSUME (x);
267 return z7;
268 }
269
270 /*
271 ** test_pst_arr5_x7:
272 ** ret
273 */
274 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_arr5_x7\n} } } */
275 svint32_t
276 test_pst_arr5_x7 (svint32_t z0, int x0, int x1, int x2, int x3, int x4,
277 int x5, int x6, struct pst_arr5 x)
278 {
279 CONSUME (x);
280 return z0;
281 }
282
283 /*
284 ** test_pst_arr5_sp: { target lp64 }
285 ** ldr x7, \[sp\]
286 ** ret
287 */
288 /*
289 ** test_pst_arr5_sp: { target ilp32 }
290 ** ldr w7, \[sp\]
291 ** ret
292 */
293 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_arr5_sp\n} } } */
294 svint32_t
295 test_pst_arr5_sp (svint32_t z0, int x0, int x1, int x2, int x3, int x4,
296 int x5, int x6, int x7, struct pst_arr5 x)
297 {
298 CONSUME (x);
299 return z0;
300 }
301
302 struct pst_arr6
303 {
304 fixed_bool_t b[2][2];
305 };
306 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_pst_arr6\n} } } */
307 SEL2 (struct, pst_arr6)
308
309 /*
310 ** test_pst_arr6:
311 ** ...
312 ** brkpa p0\.b, p0/z, p2\.b, p3\.b
313 ** ...
314 */
315 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_arr6\n} } } */
316 fixed_bool_t
317 test_pst_arr6 (struct pst_arr6 x)
318 {
319 return svbrkpa_z (x.b[0][0], x.b[1][0], x.b[1][1]);
320 }
321
322 /*
323 ** test_pst_arr6_x0:
324 ** (
325 ** mov p0\.b, p3\.b
326 ** mov (x7, x0|w7, w0)
327 ** |
328 ** mov (x7, x0|w7, w0)
329 ** mov p0\.b, p3\.b
330 ** )
331 ** ret
332 */
333 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_arr6_x0\n} } } */
334 fixed_bool_t
335 test_pst_arr6_x0 (svbool_t p0, struct pst_arr6 x, svbool_t p1, svbool_t p2,
336 svbool_t p3)
337 {
338 CONSUME (x);
339 return p3;
340 }
341
342 /*
343 ** test_pst_arr6_x7:
344 ** ret
345 */
346 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_arr6_x7\n} } } */
347 fixed_bool_t
348 test_pst_arr6_x7 (svbool_t p0, int x0, int x1, int x2, int x3, int x4,
349 int x5, int x6, struct pst_arr6 x)
350 {
351 CONSUME (x);
352 return p0;
353 }
354
355 /*
356 ** test_pst_arr6_sp: { target lp64 }
357 ** ldr x7, \[sp\]
358 ** ret
359 */
360 /*
361 ** test_pst_arr6_sp: { target ilp32 }
362 ** ldr w7, \[sp\]
363 ** ret
364 */
365 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_arr6_sp\n} } } */
366 fixed_bool_t
367 test_pst_arr6_sp (svbool_t p0, int x0, int x1, int x2, int x3, int x4,
368 int x5, int x6, int x7, struct pst_arr6 x)
369 {
370 CONSUME (x);
371 return p0;
372 }
373
374 struct pst_uniform1
375 {
376 fixed_int8_t a, b;
377 };
378 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_pst_uniform1\n} } } */
379 SEL2 (struct, pst_uniform1)
380
381 /*
382 ** test_pst_uniform1:
383 ** sub sp, sp, #32
384 ** (
385 ** str z0, \[sp\]
386 ** str z1, \[sp, #1, mul vl\]
387 ** |
388 ** stp q0, q1, \[sp\]
389 ** )
390 ** mov (x7, sp|w7, wsp)
391 ** add sp, sp, #?32
392 ** ret
393 */
394 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_uniform1\n} } } */
395 void
396 test_pst_uniform1 (struct pst_uniform1 x)
397 {
398 CONSUME (x);
399 }
400
401 struct pst_uniform2
402 {
403 fixed_int16_t a;
404 fixed_int16_t b[2];
405 };
406 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_pst_uniform2\n} } } */
407 SEL2 (struct, pst_uniform2)
408
409 /*
410 ** test_pst_uniform2:
411 ** sub sp, sp, #48
412 ** (
413 ** str z0, \[sp\]
414 ** str z1, \[sp, #1, mul vl\]
415 ** |
416 ** stp q0, q1, \[sp\]
417 ** )
418 ** str z2, \[sp, #2, mul vl\]
419 ** mov (x7, sp|w7, wsp)
420 ** add sp, sp, #?48
421 ** ret
422 */
423 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_uniform2\n} } } */
424 void
425 test_pst_uniform2 (struct pst_uniform2 x)
426 {
427 CONSUME (x);
428 }
429
430 struct pst_uniform3
431 {
432 fixed_int32_t a;
433 fixed_int32_t b[2];
434 fixed_int32_t c;
435 };
436 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_pst_uniform3\n} } } */
437 SEL2 (struct, pst_uniform3)
438
439 /*
440 ** test_pst_uniform3:
441 ** sub sp, sp, #64
442 ** (
443 ** str z0, \[sp\]
444 ** str z1, \[sp, #1, mul vl\]
445 ** str z2, \[sp, #2, mul vl\]
446 ** str z3, \[sp, #3, mul vl\]
447 ** |
448 ** stp q0, q1, \[sp\]
449 ** stp q2, q3, \[sp, 32\]
450 ** )
451 ** mov (x7, sp|w7, wsp)
452 ** add sp, sp, #?64
453 ** ret
454 */
455 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_uniform3\n} } } */
456 void
457 test_pst_uniform3 (struct pst_uniform3 x)
458 {
459 CONSUME (x);
460 }
461
462 struct pst_uniform4
463 {
464 fixed_int32_t a __attribute__((aligned(SVE_BYTES * 2)));
465 fixed_int32_t b[3] __attribute__((aligned(SVE_BYTES * 2)));
466 fixed_int32_t c __attribute__((aligned(SVE_BYTES * 2)));
467 };
468 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_pst_uniform4\n} } } */
469 SEL2 (struct, pst_uniform4)
470
471 /*
472 ** test_pst_uniform4:
473 ** sub sp, sp, #144
474 ** add (x[0-9]+), sp, #?31
475 ** and x7, \1, #?(?:-32|4294967264)
476 ** ptrue (p[0-7])\.b, vl16
477 ** st1w z0\.s, \2, \[x7\]
478 ** add (x[0-9]+), x7, #?32
479 ** (
480 ** str z1, \[\3\]
481 ** str z2, \[\3, #1, mul vl\]
482 ** |
483 ** stp q1, q2, \[\3\]
484 ** )
485 ** str z3, \[\3, #2, mul vl\]
486 ** st1w z4\.s, \2, \[x7, #6, mul vl\]
487 ** add sp, sp, #?144
488 ** ret
489 */
490 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_uniform4\n} } } */
491 void
492 test_pst_uniform4 (struct pst_uniform4 x)
493 {
494 CONSUME (x);
495 }
496
497 struct pst_mixed1
498 {
499 fixed_bool_t p0;
500 fixed_bfloat16_t z0;
501 fixed_float16_t z1;
502 fixed_float32_t z2;
503 fixed_float64_t z3;
504 fixed_bool_t p1;
505 fixed_bool_t p2;
506 fixed_int8_t z4;
507 fixed_int16_t z5;
508 fixed_int32_t z6;
509 fixed_int64_t z7;
510 fixed_bool_t p3;
511 };
512 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_pst_mixed1\n} } } */
513 SEL2 (struct, pst_mixed1)
514
515 /*
516 ** test_pst_mixed1:
517 ** sub sp, sp, #176
518 ** str p0, \[sp\]
519 ** ptrue p0\.b, vl16
520 ** st1h z0\.h, p0, \[sp, #1, mul vl\]
521 ** st1h z1\.h, p0, \[sp, #2, mul vl\]
522 ** st1w z2\.s, p0, \[sp, #3, mul vl\]
523 ** st1d z3\.d, p0, \[sp, #4, mul vl\]
524 ** str p1, \[sp, #40, mul vl\]
525 ** str p2, \[sp, #41, mul vl\]
526 ** st1b z4\.b, p0, \[sp, #6, mul vl\]
527 ** st1h z5\.h, p0, \[sp, #7, mul vl\]
528 ** ...
529 ** st1w z6\.s, p0, [^\n]*
530 ** ...
531 ** st1d z7\.d, p0, [^\n]*
532 ** ...
533 ** str p3, \[sp, #80, mul vl\]
534 ** mov (x7, sp|w7, wsp)
535 ** add sp, sp, #?176
536 ** ret
537 */
538 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_mixed1\n} } } */
539 void
540 test_pst_mixed1 (struct pst_mixed1 x)
541 {
542 CONSUME (x);
543 }
544
545 struct pst_mixed2
546 {
547 struct __attribute__ ((packed)) {
548 fixed_bool_t p;
549 fixed_int8_t z;
550 } a[3];
551 fixed_int16_t b[1][1][1][4];
552 };
553 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_pst_mixed2\n} } } */
554 SEL2 (struct, pst_mixed2)
555
556 /*
557 ** test_pst_mixed2:
558 ** sub sp, sp, #128
559 ** str p0, \[sp\]
560 ** ptrue (p[03])\.b, vl16
561 ** add (x[0-9]+), sp, #?2
562 ** st1b z0\.b, \1, \[\2\]
563 ** str p1, \[sp, #9, mul vl\]
564 ** add (x[0-9]+), sp, #?20
565 ** st1b z1\.b, \1, \[\3\]
566 ** str p2, \[sp, #18, mul vl\]
567 ** add (x[0-9]+), sp, #?38
568 ** st1b z2\.b, \1, \[\4\]
569 ** (
570 ** str z3, \[sp, #4, mul vl\]
571 ** str z4, \[sp, #5, mul vl\]
572 ** str z5, \[sp, #6, mul vl\]
573 ** str z6, \[sp, #7, mul vl\]
574 ** |
575 ** stp q3, q4, \[sp, 64\]
576 ** stp q5, q6, \[sp, 96\]
577 ** )
578 ** mov (x7, sp|w7, wsp)
579 ** add sp, sp, #?128
580 ** ret
581 */
582 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_mixed2\n} } } */
583 void
584 test_pst_mixed2 (struct pst_mixed2 x)
585 {
586 CONSUME (x);
587 }
588
589 struct pst_big1
590 {
591 fixed_int8_t a[9];
592 };
593 /* { dg-final { scan-assembler-not {\t\.variant_pcs\tsel2_pst_big1\n} } } */
594 SEL2 (struct, pst_big1)
595
596 /*
597 ** test_pst_big1_a: { target lp64 }
598 ** ptrue (p[0-7])\.b, vl16
599 ** ld1b z0\.b, \1/z, \[x0\]
600 ** ret
601 */
602 /*
603 ** test_pst_big1_a: { target ilp32 }
604 ** uxtw x0, w0
605 ** ptrue (p[0-7])\.b, vl16
606 ** ld1b z0\.b, \1/z, \[x0\]
607 ** ret
608 */
609 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_big1_a\n} } } */
610 svint8_t
611 test_pst_big1_a (struct pst_big1 x)
612 {
613 return x.a[0];
614 }
615
616 /*
617 ** test_pst_big1_b: { target lp64 }
618 ** add x7, x0, #?128
619 ** ret
620 */
621 /*
622 ** test_pst_big1_b: { target ilp32 }
623 ** add w7, w0, #?128
624 ** ret
625 */
626 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_big1_b\n} } } */
627 svint8_t
628 test_pst_big1_b (struct pst_big1 x)
629 {
630 CONSUME (x.a[8]);
631 }
632
633 struct pst_big2
634 {
635 fixed_bool_t a[5];
636 };
637 /* { dg-final { scan-assembler-not {\t\.variant_pcs\tsel2_pst_big2\n} } } */
638 SEL2 (struct, pst_big2)
639
640 /*
641 ** test_pst_big2_a: { target lp64 }
642 ** ldr p0, \[x0\]
643 ** ret
644 */
645 /*
646 ** test_pst_big2_a: { target ilp32 }
647 ** uxtw x0, w0
648 ** ldr p0, \[x0\]
649 ** ret
650 */
651 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_big2_a\n} } } */
652 svbool_t
653 test_pst_big2_a (struct pst_big2 x)
654 {
655 return x.a[0];
656 }
657
658 /*
659 ** test_pst_big2_b: { target lp64 }
660 ** ldr p0, \[x0, #4, mul vl\]
661 ** ret
662 */
663 /*
664 ** test_pst_big2_b: { target ilp32 }
665 ** uxtw x0, w0
666 ** ldr p0, \[x0, #4, mul vl\]
667 ** ret
668 */
669 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_big2_b\n} } } */
670 svbool_t
671 test_pst_big2_b (struct pst_big2 x)
672 {
673 return x.a[4];
674 }
675
676 struct pst_big3
677 {
678 fixed_bool_t p0;
679 fixed_int8_t a[2];
680 fixed_bool_t p1;
681 fixed_bool_t p2;
682 fixed_bool_t p3;
683 fixed_int8_t b[6];
684 fixed_bool_t p4;
685 };
686 /* { dg-final { scan-assembler-not {\t\.variant_pcs\tsel2_pst_big3\n} } } */
687 SEL2 (struct, pst_big3)
688
689 /*
690 ** test_pst_big3_a: { target lp64 }
691 ** ldr p0, \[x0\]
692 ** ret
693 */
694 /*
695 ** test_pst_big3_a: { target ilp32 }
696 ** uxtw x0, w0
697 ** ldr p0, \[x0\]
698 ** ret
699 */
700 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_big3_a\n} } } */
701 svbool_t
702 test_pst_big3_a (struct pst_big3 x)
703 {
704 return x.p0;
705 }
706
707 /*
708 ** test_pst_big3_b: { target lp64 }
709 ** ldr p0, \[x0, #24, mul vl\]
710 ** ret
711 */
712 /*
713 ** test_pst_big3_b: { target ilp32 }
714 ** uxtw x0, w0
715 ** ldr p0, \[x0, #24, mul vl\]
716 ** ret
717 */
718 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_big3_b\n} } } */
719 svbool_t
720 test_pst_big3_b (struct pst_big3 x)
721 {
722 return x.p1;
723 }
724
725 /*
726 ** test_pst_big3_c: { target lp64 }
727 ** ldr p0, \[x0, #25, mul vl\]
728 ** ret
729 */
730 /*
731 ** test_pst_big3_c: { target ilp32 }
732 ** uxtw x0, w0
733 ** ldr p0, \[x0, #25, mul vl\]
734 ** ret
735 */
736 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_big3_c\n} } } */
737 svbool_t
738 test_pst_big3_c (struct pst_big3 x)
739 {
740 return x.p2;
741 }
742
743 /*
744 ** test_pst_big3_d: { target lp64 }
745 ** ldr p0, \[x0, #80, mul vl\]
746 ** ret
747 */
748 /*
749 ** test_pst_big3_d: { target ilp32 }
750 ** uxtw x0, w0
751 ** ldr p0, \[x0, #80, mul vl\]
752 ** ret
753 */
754 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_big3_d\n} } } */
755 svbool_t
756 test_pst_big3_d (struct pst_big3 x)
757 {
758 return x.p4;
759 }
760
761 /*
762 ** test_pst_big3_e: { target lp64 }
763 ** ptrue (p[0-7])\.b, vl16
764 ** ld1b z0\.b, \1/z, \[x0, #1, mul vl\]
765 ** ret
766 */
767 /*
768 ** test_pst_big3_e: { target ilp32 }
769 ** uxtw x0, w0
770 ** ptrue (p[0-7])\.b, vl16
771 ** ld1b z0\.b, \1/z, \[x0, #1, mul vl\]
772 ** ret
773 */
774 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_big3_e\n} } } */
775 svint8_t
776 test_pst_big3_e (struct pst_big3 x)
777 {
778 return x.a[0];
779 }
780
781 /*
782 ** test_pst_big3_f: { target lp64 }
783 ** ptrue (p[0-7])\.b, vl16
784 ** ld1b z0\.b, \1/z, \[x0, #5, mul vl\]
785 ** ret
786 */
787 /*
788 ** test_pst_big3_f: { target ilp32 }
789 ** uxtw x0, w0
790 ** ptrue (p[0-7])\.b, vl16
791 ** ld1b z0\.b, \1/z, \[x0, #5, mul vl\]
792 ** ret
793 */
794 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_big3_f\n} } } */
795 svint8_t
796 test_pst_big3_f (struct pst_big3 x)
797 {
798 return x.b[1];
799 }
800
801 struct pst_zero1
802 {
803 fixed_bool_t a[0];
804 fixed_int32_t b;
805 };
806 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_pst_zero1\n} } } */
807 SEL2 (struct, pst_zero1)
808
809 /*
810 ** test_pst_zero1:
811 ** ret
812 */
813 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_zero1\n} } } */
814 svint32_t
815 test_pst_zero1 (struct pst_zero1 x)
816 {
817 return x.b;
818 }
819
820 struct pst_zero2
821 {
822 unsigned int : 0;
823 fixed_bool_t b;
824 };
825 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_pst_zero2\n} } } */
826 SEL2 (struct, pst_zero2)
827
828 /*
829 ** test_pst_zero2:
830 ** (
831 ** sub sp, sp, #16
832 ** add sp, sp, #?16
833 ** |
834 ** )
835 ** ret
836 */
837 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_zero2\n} } } */
838 svbool_t
839 test_pst_zero2 (struct pst_zero2 x)
840 {
841 return x.b;
842 }
843
844 struct pst_zero3
845 {
846 struct {} empty;
847 fixed_uint64_t b;
848 };
849 /* { dg-final { scan-assembler {\t\.variant_pcs\tsel2_pst_zero3\n} } } */
850 SEL2 (struct, pst_zero3)
851
852 /*
853 ** test_pst_zero3:
854 ** ret
855 */
856 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_pst_zero3\n} } } */
857 svuint64_t
858 test_pst_zero3 (struct pst_zero3 x)
859 {
860 return x.b;
861 }
862
863 typedef unsigned char small_vec __attribute__((vector_size(SVE_BYTES / 4)));
864
865 struct nonpst1
866 {
867 small_vec a[4];
868 };
869 /* { dg-final { scan-assembler-not {\t\.variant_pcs\tsel2_pst_nonpst1\n} } } */
870 SEL2 (struct, nonpst1)
871
872 /*
873 ** test_nonpst1:
874 ** ...
875 ** lsr x0, x1, #?32
876 ** ...
877 ** ret
878 */
879 /* { dg-final { scan-assembler-not {\t\.variant_pcs\ttest_nonpst1\n} } } */
880 small_vec
881 test_nonpst1 (struct nonpst1 x)
882 {
883 return x.a[3];
884 }
885
886 union nonpst2
887 {
888 struct {
889 fixed_bool_t a[0];
890 fixed_int32_t b;
891 };
892 };
893 /* { dg-final { scan-assembler-not {\t\.variant_pcs\tsel2_pst_nonpst2\n} } } */
894 SEL2 (union, nonpst2)
895
896 /*
897 ** test_nonpst2:
898 ** sub sp, sp, #16
899 ** stp x0, x1, \[sp\]
900 ** ...
901 ** ldr z0, \[sp\]
902 ** add sp, sp, #?16
903 ** ret
904 */
905 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_nonpst2\n} } } */
906 svint32_t
907 test_nonpst2 (union nonpst2 x)
908 {
909 return x.b;
910 }
911
912 /*
913 ** ret_nonpst2:
914 ** mov x0, #?1
915 ** movk x0, #?0x3, lsl #?32
916 ** mov x1, #?5
917 ** movk x1, #?0x7, lsl #?32
918 ** ret
919 */
920 /* { dg-final { scan-assembler-not {\t\.variant_pcs\tret_nonpst2\n} } } */
921 union nonpst2
922 ret_nonpst2 (void)
923 {
924 return (union nonpst2) { { {}, 1, 3, 5, 7 } };
925 }
926
927 union nonpst3
928 {
929 struct {
930 unsigned int : 0;
931 fixed_bool_t b;
932 };
933 };
934 /* { dg-final { scan-assembler-not {\t\.variant_pcs\tsel2_pst_nonpst3\n} } } */
935 SEL2 (union, nonpst3)
936
937 /*
938 ** test_nonpst3:
939 ** sub sp, sp, #16
940 ** str w0, \[sp, #?12\]
941 ** ldr p0, \[sp, #6, mul vl\]
942 ** add sp, sp, #?16
943 ** ret
944 */
945 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_nonpst3\n} } } */
946 svbool_t
947 test_nonpst3 (union nonpst3 x)
948 {
949 return x.b;
950 }
951
952 /*
953 ** ret_nonpst3:
954 ** mov w0, #?(?:0xffff|65535)
955 ** ret
956 */
957 /* { dg-final { scan-assembler-not {\t\.variant_pcs\tret_nonpst3\n} } } */
958 union nonpst3
959 ret_nonpst3 (void)
960 {
961 return (union nonpst3) { { svptrue_b8 () } };
962 }
963
964 union nonpst4
965 {
966 struct {
967 struct {} empty;
968 fixed_uint64_t b;
969 };
970 };
971 /* { dg-final { scan-assembler-not {\t\.variant_pcs\tsel2_pst_nonpst4\n} } } */
972 SEL2 (union, nonpst4)
973
974 /*
975 ** test_nonpst4:
976 ** sub sp, sp, #16
977 ** stp x0, x1, \[sp\]
978 ** ...
979 ** ldr z0, \[sp\]
980 ** add sp, sp, #?16
981 ** ret
982 */
983 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_nonpst4\n} } } */
984 svuint64_t
985 test_nonpst4 (union nonpst4 x)
986 {
987 return x.b;
988 }
989
990 /*
991 ** ret_nonpst4:
992 ** mov x0, 1
993 ** mov x1, 2
994 ** ret
995 */
996 /* { dg-final { scan-assembler-not {\t\.variant_pcs\tret_nonpst4\n} } } */
997 union nonpst4
998 ret_nonpst4 (void)
999 {
1000 return (union nonpst4) { { {}, 1, 2 } };
1001 }
1002
1003 struct nonpst5
1004 {
1005 union {
1006 fixed_uint16_t b;
1007 };
1008 };
1009 /* { dg-final { scan-assembler-not {\t\.variant_pcs\tsel2_pst_nonpst5\n} } } */
1010 SEL2 (struct, nonpst5)
1011
1012 /*
1013 ** test_nonpst5:
1014 ** sub sp, sp, #16
1015 ** stp x0, x1, \[sp\]
1016 ** ...
1017 ** ldr z0, \[sp\]
1018 ** add sp, sp, #?16
1019 ** ret
1020 */
1021 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_nonpst5\n} } } */
1022 svuint16_t
1023 test_nonpst5 (struct nonpst5 x)
1024 {
1025 return x.b;
1026 }
1027
1028 struct nonpst6
1029 {
1030 fixed_uint64_t b;
1031 fixed_uint64_t *ptr;
1032 };
1033 /* { dg-final { scan-assembler-not {\t\.variant_pcs\tsel2_pst_nonpst6\n} } } */
1034 SEL2 (struct, nonpst6)
1035
1036 /*
1037 ** test_nonpst6: { target lp64 }
1038 ** ptrue (p[0-3])\.b, vl16
1039 ** ld1d z0\.d, \1/z, \[x0\]
1040 ** ret
1041 */
1042 /*
1043 ** test_nonpst6: { target ilp32 }
1044 ** uxtw x0, w0
1045 ** ptrue (p[0-3])\.b, vl16
1046 ** ld1d z0\.d, \1/z, \[x0\]
1047 ** ret
1048 */
1049 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_nonpst6\n} } } */
1050 svuint64_t
1051 test_nonpst6 (struct nonpst6 x)
1052 {
1053 return x.b;
1054 }
1055
1056 struct nonpst7
1057 {
1058 fixed_uint64_t b;
1059 uint32_t foo __attribute__((vector_size(SVE_BYTES)));
1060 };
1061 /* { dg-final { scan-assembler-not {\t\.variant_pcs\tsel2_pst_nonpst7\n} } } */
1062 SEL2 (struct, nonpst7)
1063
1064 /*
1065 ** test_nonpst7: { target lp64 }
1066 ** ptrue (p[0-3])\.b, vl16
1067 ** ld1d z0\.d, \1/z, \[x0\]
1068 ** ret
1069 */
1070 /*
1071 ** test_nonpst7: { target ilp32 }
1072 ** uxtw x0, w0
1073 ** ptrue (p[0-3])\.b, vl16
1074 ** ld1d z0\.d, \1/z, \[x0\]
1075 ** ret
1076 */
1077 /* { dg-final { scan-assembler {\t\.variant_pcs\ttest_nonpst7\n} } } */
1078 svuint64_t
1079 test_nonpst7 (struct nonpst7 x)
1080 {
1081 return x.b;
1082 }
1083
1084 typedef unsigned char tiny_vec __attribute__((vector_size(SVE_BYTES / 8)));
1085
1086 struct nonpst8
1087 {
1088 tiny_vec a;
1089 };
1090 /* { dg-final { scan-assembler-not {\t\.variant_pcs\tsel2_pst_nonpst8\n} } } */
1091 SEL2 (struct, nonpst8)
1092
1093 /*
1094 ** test_nonpst8:
1095 ** ubfx x0, x0, 8, 8
1096 ** ret
1097 */
1098 /* { dg-final { scan-assembler-not {\t\.variant_pcs\ttest_nonpst8\n} } } */
1099 unsigned int
1100 test_nonpst8 (struct nonpst8 x)
1101 {
1102 return x.a[1];
1103 }
1104
1105 /*
1106 ** ret_nonpst8:
1107 ** (
1108 ** sub sp, sp, #16
1109 ** mov w0, #?513
1110 ** add sp, sp, #?16
1111 ** |
1112 ** mov w0, #?513
1113 ** )
1114 ** ret
1115 */
1116 /* { dg-final { scan-assembler-not {\t\.variant_pcs\tret_nonpst8\n} } } */
1117 struct nonpst8
1118 ret_nonpst8 (void)
1119 {
1120 return (struct nonpst8) { { 1, 2 } };
1121 }