libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / bb-slp-41.c
blob72245115f305de8ef26c9c481f160a05db8c3dcb
1 /* { dg-require-effective-target vect_int } */
3 #define ARR_SIZE 1000
5 void __attribute__((optimize (0)))
6 foo (int *a, int *b)
8 int i;
9 for (i = 0; i < (ARR_SIZE - 2); ++i)
10 a[i] = b[0] + b[1] + b[i+1] + b[i+2];
13 /* Disable pre-slp FRE to avoid unexpected SLP on the epilogue
14 of the 1st loop. */
15 void __attribute__((optimize("-fno-tree-fre")))
16 bar (int *a, int *b)
18 int i;
19 for (i = 0; i < (ARR_SIZE - 2); ++i)
21 a[i] = b[0];
23 for (i = 0; i < (ARR_SIZE - 2); ++i)
25 a[i] = a[i] + b[1];
27 for (i = 0; i < (ARR_SIZE - 2); ++i)
29 a[i] = a[i] + b[i+1];
31 for (i = 0; i < (ARR_SIZE - 2); ++i)
33 a[i] = a[i] + b[i+2];
37 int main ()
39 int a1[ARR_SIZE];
40 int a2[ARR_SIZE];
41 int b[ARR_SIZE];
42 int i;
44 for (i = 0; i < ARR_SIZE; i++)
46 a1[i] = 0;
47 a2[i] = 0;
48 b[i] = i;
51 foo (a1, b);
52 bar (a2, b);
54 for (i = 0; i < ARR_SIZE; i++)
55 if (a1[i] != a2[i])
56 return 1;
58 return 0;
61 /* { dg-final { scan-tree-dump-not "vectorizing stmts using SLP" "slp1" } } */