2018-01-16 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-cond-5.c
blob41e57f9235b90347e7842d88c9710ee682ea4bd4
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 for (k = 0; k < K; k++)
50 if (out[k] != check_result[k])
51 abort ();
53 return 0;
56 /* Double reduction with cond_expr is not supported, since even though the order
57 of computation is the same, but vector results should be reduced to scalar
58 result, which can'be done for cond_expr. */
59 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail *-*-* } } } */