blob: 0eed33b65319ddb7404061ee37f0afdccb3da91a [file] [log] [blame]
/* { dg-do run { target avx_runtime } } */
/* { dg-require-effective-target avx } */
/* { dg-options "-O3 -mavx -fdump-tree-slp2" } */
float x[8], y[8], z[8];
void __attribute__((noipa)) foo ()
{
x[0] = y[0] - z[0];
x[1] = y[1] + z[1];
x[2] = y[2] - z[2];
x[3] = y[3] + z[3];
x[4] = y[4] - z[4];
x[5] = y[5] + z[5];
x[6] = y[6] - z[6];
x[7] = y[7] + z[7];
}
void __attribute__((noipa)) bar ()
{
x[0] = y[0] + z[0];
x[1] = y[1] - z[1];
x[2] = y[2] + z[2];
x[3] = y[3] - z[3];
x[4] = y[4] + z[4];
x[5] = y[5] - z[5];
x[6] = y[6] + z[6];
x[7] = y[7] - z[7];
}
int main()
{
for (int i = 0; i < 8; ++i)
{
y[i] = i + 1;
z[i] = 2 * i + 1;
}
foo ();
if (x[0] != 0 || x[1] != 5 || x[2] != -2 || x[3] != 11
|| x[4] != -4 || x[5] != 17 || x[6] != -6 || x[7] != 23)
__builtin_abort ();
bar ();
if (x[0] != 2 || x[1] != -1 || x[2] != 8 || x[3] != -3
|| x[4] != 14 || x[5] != -5 || x[6] != 20 || x[7] != -7)
__builtin_abort ();
return 0;
}
/* { dg-final { scan-tree-dump-times "ADDSUB" 1 "slp2" } } */