Add compile command to each testcase
[gcc-vect-testsuite.git] / vect-cond-1.c
blobe42752f97a4e795a1e4da0bf171a0adaf532d7b2
1 /* { dg-require-effective-target vect_condition } */
3 #include <stdlib.h>
4 #include "tree-vect.h"
6 #define M 32
7 #define N 16
9 int x_in[M];
10 int x_out[M];
11 int c[N] = {3,2,1,10,1,42,3,4,50,9,32,8,11,10,1,2};
12 int a[N+1] = {0,16,32,48,64,128,256,512,0,16,32,48,64,128,256,512,1024};
13 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};
15 __attribute__ ((noinline)) void
16 foo ()
18 int j, i, x;
19 int curr_a, next_a;
21 for (j = 0; j < M; j++)
23 x = x_in[j];
24 curr_a = a[0];
26 for (i = 0; i < N; i++)
28 next_a = a[i+1];
29 curr_a = x > c[i] ? curr_a : next_a;
32 x_out[j] = curr_a;
36 int main (void)
38 int i,j;
40 check_vect ();
42 for (j = 0; j < M; j++)
43 x_in[j] = j;
45 foo ();
47 for (j = 0; j < M; j++)
48 if (x_out[j] != check_result[j])
49 abort ();
51 return 0;
54 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail vect_no_align } } } */
55 /* { dg-final { cleanup-tree-dump "vect" } } */