testsuite: Revert to the original version of pr100056.c
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-cond-5.c
blobf10feab71df6daa76966f8d6bc3a4deba8a7b56a
1 /* { dg-require-effective-target vect_condition } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define K 32
8 int cond_array[2*K][K] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
9 int a[K][K] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
10 int out[K];
11 int check_result[K] = {2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
13 __attribute__ ((noinline)) void
14 foo (int c)
16 int res, i, j, k, next;
18 for (k = 0; k < K; k++)
20 res = 0;
21 for (j = 0; j < K; j++)
22 for (i = 0; i < K; i++)
24 next = a[i][j];
25 res = c > cond_array[i+k][j] ? next : res;
28 out[k] = res;
32 int main ()
34 int i, j, k;
36 check_vect ();
38 for (j = 0; j < K; j++)
40 for (i = 0; i < 2*K; i++)
41 cond_array[i][j] = i+j;
43 for (i = 0; i < K; i++)
44 a[i][j] = i+2;
47 foo(5);
49 #pragma GCC novector
50 for (k = 0; k < K; k++)
51 if (out[k] != check_result[k])
52 abort ();
54 return 0;
57 /* Double reduction with cond_expr is not supported, since even though the order
58 of computation is the same, but vector results should be reduced to scalar
59 result, which can'be done for cond_expr. */
60 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail *-*-* } } } */