PR tree-optimization/84740
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr78005.c
blob7cefe73fe1b3d0050befeb5e25aec169867fd96a
1 /* { dg-require-effective-target vect_int } */
2 #include "tree-vect.h"
4 #define N 20
5 int u[N] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
6 int z[N] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18};
7 int res4[N] = {0, 1, 8, 3, 22, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
8 int res5[N] = {0, 1, 8, 3, 22, 5, 36, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
9 int res6[N] = {0, 1, 8, 3, 22, 5, 36, 7, 50, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
10 int res7[N] = {0, 1, 8, 3, 22, 5, 36, 7, 50, 9, 64, 11, 12, 13, 14, 15, 16, 17, 18, 19};
11 int res8[N] = {0, 1, 8, 3, 22, 5, 36, 7, 50, 9, 64, 11, 78, 13, 14, 15, 16, 17, 18, 19};
12 int res9[N] = {0, 1, 8, 3, 22, 5, 36, 7, 50, 9, 64, 11, 78, 13, 92, 15, 16, 17, 18, 19};
13 int res10[N] = {0, 1, 8, 3, 22, 5, 36, 7, 50, 9, 64, 11, 78, 13, 92, 15, 106, 17, 18, 19};
15 __attribute__ ((noinline)) void
16 foo (int n, int d)
18 int i;
19 for (i = 2; i < n; i++)
20 u[2*i-2] = u[2*i-2] + d * (z[i-1] + z[i] + z[i-1] + z[i] + z[i-1] + z[i]);
23 #define check_u(x) \
24 foo (x, 2); \
25 for (i = 0; i < N; i++) \
26 { \
27 if (u[i] != res##x[i]) \
28 abort (); \
29 u[i] = i; \
32 int main(void)
34 int i;
36 check_vect ();
38 /* Need to check for all possible vector factors. */
39 check_u(4);
40 check_u(5);
41 check_u(6);
42 check_u(7);
43 check_u(8);
44 check_u(9);
45 check_u(10);
47 return 0;