Debian Codegraph @

gcc/testsuite/gcc.target/i386/vect-addsubv8sf.c

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