Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gcc.dg / vect / vect-cond-2.c
blob97d3241a93e3d2a049aebb12c18b34ad6d096d3a
1 /* { dg-require-effective-target vect_condition } */
3 #include <stdlib.h>
4 #include "tree-vect.h"
6 #define N 16
8 int c[N] = {3,2,1,10,1,42,3,4,50,9,32,8,11,10,1,2};
9 int a[N+1] = {0,16,32,48,64,128,256,512,0,16,32,48,64,128,256,512,1024};
11 __attribute__ ((noinline)) void
12 foo (int *x)
14 int i;
15 int curr_a, flag, next_a;
17 curr_a = a[0];
19 for (i = 0; i < N; i++)
21 flag = *x > c[i];
22 next_a = a[i+1];
23 curr_a = flag ? curr_a : next_a;
26 *x = curr_a;
29 int main (void)
31 int x = 7;
33 check_vect ();
35 foo (&x);
37 if (x != 256)
38 abort ();
40 return 0;
43 /* The order of computation should not be changed for cond_expr, therefore,
44 it cannot be vectorized in reduction. */
45 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */
46 /* { dg-final { cleanup-tree-dump "vect" } } */