| 1 |
/* { dg-do run } */ |
| 2 |
/* PR target/101529 */ |
| 3 |
typedef unsigned char C; |
| 4 |
typedef unsigned char __attribute__((__vector_size__ (8))) V; |
| 5 |
typedef unsigned char __attribute__((__vector_size__ (32))) U; |
| 6 |
|
| 7 |
C c; |
| 8 |
|
| 9 |
/* aarch64 used to miscompile foo to just return a vector of 0s */ |
| 10 |
V |
| 11 |
foo (V v) |
| 12 |
{ |
| 13 |
v |= __builtin_shufflevector (c * v, (U) (0 == (U){ }), |
| 14 |
0, 1, 8, 32, 8, 20, 36, 36); |
| 15 |
return v; |
| 16 |
} |
| 17 |
|
| 18 |
int |
| 19 |
main (void) |
| 20 |
{ |
| 21 |
V v = foo ((V) { }); |
| 22 |
for (unsigned i = 0; i < sizeof (v); i++) |
| 23 |
if (v[i] != (i >= 2 ? 0xff : 0)) |
| 24 |
__builtin_abort (); |
| 25 |
return 0; |
| 26 |
} |
| 27 |
|
| 28 |
// On i?86-*-* an ABI warning would actually surface. |
| 29 |
// { dg-prune-output "MMX vector (argument|return) without MMX enabled changes the ABI" } |