Small ChangeLog tweak.
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-cond-3.c
blob8a66b4b52ed8a98dd52ef945afb3822de8fe37e9
1 /* { dg-require-effective-target vect_condition } */
3 #include "tree-vect.h"
5 #define M 32
6 #define N 16
8 int x_in[M];
9 int x_out_a[M], x_out_b[M];
10 int c[N] = {3,2,1,10,1,42,3,4,50,9,32,8,11,10,1,2};
11 int a[N+1] = {0,16,32,48,64,128,256,512,0,16,32,48,64,128,256,512,1024};
12 int b[N+1] = {17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1};
13 int check_result_a[M] = {1024,1024,1024,256,256,256,256,256,256,256,256,128,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48};
14 int check_result_b[M] = {17,17,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
16 __attribute__ ((noinline)) void
17 foo ()
19 int j, i, x;
20 int curr_a, flag, next_a, curr_b, next_b;
22 for (j = 0; j < M; j++)
24 x = x_in[j];
25 curr_a = a[0];
26 curr_b = b[0];
28 for (i = 0; i < N; i++)
30 flag = x > c[i];
31 next_a = a[i+1];
32 next_b = b[i+1];
33 curr_a = flag ? curr_a : next_a;
34 curr_b = flag ? next_b : curr_b;
37 x_out_a[j] = curr_a;
38 x_out_b[j] = curr_b;
42 int main (void)
44 int i,j;
46 check_vect ();
48 for (j = 0; j < M; j++)
49 x_in[j] = j;
51 foo ();
53 for (j = 0; j < M; j++)
54 if (x_out_a[j] != check_result_a[j]
55 || x_out_b[j] != check_result_b[j])
56 abort ();
58 return 0;
61 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */