PR tree-optimization/84740
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-cond-1.c
blob261d828dbb2855fe680b396d3fcbf094e814b6fd
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[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 check_result[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 __attribute__ ((noinline)) void
15 foo ()
17 int j, i, x;
18 int curr_a, next_a;
20 for (j = 0; j < M; j++)
22 x = x_in[j];
23 curr_a = a[0];
25 for (i = 0; i < N; i++)
27 next_a = a[i+1];
28 curr_a = x > c[i] ? curr_a : next_a;
31 x_out[j] = curr_a;
35 int main (void)
37 int i,j;
39 check_vect ();
41 for (j = 0; j < M; j++)
42 x_in[j] = j;
44 foo ();
46 for (j = 0; j < M; j++)
47 if (x_out[j] != check_result[j])
48 abort ();
50 return 0;
53 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */