| 1 |
/* { dg-do run { target avx_runtime } } */ |
| 2 |
/* { dg-require-effective-target avx } */ |
| 3 |
/* { dg-options "-O3 -mavx -fdump-tree-slp2" } */ |
| 4 |
|
| 5 |
double x[4], y[4], z[4]; |
| 6 |
void __attribute__((noipa)) foo () |
| 7 |
{ |
| 8 |
x[0] = y[0] - z[0]; |
| 9 |
x[1] = y[1] + z[1]; |
| 10 |
x[2] = y[2] - z[2]; |
| 11 |
x[3] = y[3] + z[3]; |
| 12 |
} |
| 13 |
void __attribute__((noipa)) bar () |
| 14 |
{ |
| 15 |
x[0] = y[0] + z[0]; |
| 16 |
x[1] = y[1] - z[1]; |
| 17 |
x[2] = y[2] + z[2]; |
| 18 |
x[3] = y[3] - z[3]; |
| 19 |
} |
| 20 |
int main() |
| 21 |
{ |
| 22 |
for (int i = 0; i < 4; ++i) |
| 23 |
{ |
| 24 |
y[i] = i + 1; |
| 25 |
z[i] = 2 * i + 1; |
| 26 |
} |
| 27 |
foo (); |
| 28 |
if (x[0] != 0 || x[1] != 5 || x[2] != -2 || x[3] != 11) |
| 29 |
__builtin_abort (); |
| 30 |
bar (); |
| 31 |
if (x[0] != 2 || x[1] != -1 || x[2] != 8 || x[3] != -3) |
| 32 |
__builtin_abort (); |
| 33 |
return 0; |
| 34 |
} |
| 35 |
|
| 36 |
/* { dg-final { scan-tree-dump-times "ADDSUB" 1 "slp2" } } */ |