PR tree-optimization/84740
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-double-reduc-7.c
blobc3145a2ad029f92e96995f59e9be9823e016ec11
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define K 32
8 int in[2*K][K] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
9 int out[K];
10 int check_result[K] = {63,63,191,191,127,127,191,191,127,127,191,191,127,127,191,191,127,127,191,191,127,127,191,191,127,127,191,191,127,127,191,191};
12 __attribute__ ((noinline)) void
13 foo ()
15 int res_or, res_and, res_xor, i, j, k;
17 for (k = 0; k < K; k++)
19 res_or = 0;
20 for (j = 0; j < K; j++)
21 for (i = 0; i < K; i++)
22 res_or = res_or | in[i+k][j];
24 res_and = 1;
25 for (j = 0; j < K; j++)
26 for (i = 0; i < K; i++)
27 res_and = res_and & in[i+k][j];
29 res_xor = 0;
30 for (j = 0; j < K; j++)
31 for (i = 0; i < K; i++)
32 res_xor = res_xor ^ in[i+k][j];
34 out[k] = res_or + res_and + res_xor;
38 int main ()
40 int i, j, k;
42 check_vect ();
44 for (j = 0; j < K; j++)
46 for (i = 0; i < 2*K; i++)
47 in[i][j] = i+j;
49 for (i = 0; i < K; i++)
50 out[i] = i+j;
53 foo();
55 for (k = 0; k < K; k++)
56 if (out[k] != check_result[k])
57 abort ();
59 return 0;
62 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 3 "vect" } } */