| 1 |
/* PR tree-optimization/123672 */ |
| 2 |
/* { dg-do run } */ |
| 3 |
/* { dg-options "-O2 -fdump-tree-forwprop1-details" } */ |
| 4 |
/* { dg-additional-options "-msse2" { target i?86-*-* x86_64-*-* } } */ |
| 5 |
/* { dg-final { scan-tree-dump "Vec perm simplify sequences have been blended" "forwprop1" { target { aarch64*-*-* i?86-*-* x86_64-*-* } } } } */ |
| 6 |
|
| 7 |
typedef int V __attribute__((vector_size (4 * sizeof (int)))); |
| 8 |
|
| 9 |
[[gnu::noipa]] void |
| 10 |
foo (V *x, V *y) |
| 11 |
{ |
| 12 |
V a = *x; |
| 13 |
V b = *y; |
| 14 |
V c = __builtin_shufflevector (a, a, 0, 2, 0, 2); |
| 15 |
V d = __builtin_shufflevector (a, a, 1, 3, 1, 3); |
| 16 |
V e = __builtin_shufflevector (b, b, 0, 2, 0, 2); |
| 17 |
V f = __builtin_shufflevector (b, b, 1, 3, 1, 3); |
| 18 |
V g = __builtin_shufflevector (c + d, c - d, 0, 4, 1, 5); |
| 19 |
V h = __builtin_shufflevector (e + f, e - f, 0, 4, 1, 5); |
| 20 |
*x = g; |
| 21 |
*y = h; |
| 22 |
} |
| 23 |
|
| 24 |
int |
| 25 |
main () |
| 26 |
{ |
| 27 |
V a = { 1, 21, 2, 32 }; |
| 28 |
V b = { 3, 43, 4, 54 }; |
| 29 |
foo (&a, &b); |
| 30 |
if (a[0] != 22 || a[1] != -20 || a[2] != 34 || a[3] != -30 |
| 31 |
|| b[0] != 46 || b[1] != -40 || b[2] != 58 || b[3] != -50) |
| 32 |
__builtin_abort (); |
| 33 |
} |