1 /* { dg-require-effective-target vect_condition } */
2 
3 #include "tree-vect.h"
4 
5 #define M 32
6 #define N 16
7 
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};
15 
16 __attribute__ ((noinline)) void
foo(int z)17 foo (int z)
18 {
19   int j, i, x;
20   int curr_a, curr_b;
21 
22   for (j = 0; j < M; j++)
23     {
24       x = x_in[j];
25       curr_a = a[0];
26       curr_b = b[0];
27 
28       for (i = 0; i < N; i++)
29         {
30           curr_a = x > c[i] ? curr_a : z;
31           curr_b = x > c[i] ? curr_b : 5;
32         }
33 
34       x_out_a[j] = curr_a;
35       x_out_b[j] = curr_b;
36     }
37 }
38 
main(void)39 int main (void)
40 {
41   int i,j;
42 
43   check_vect ();
44 
45   for (j = 0; j < M; j++)
46     x_in[j] = j;
47 
48   foo (125);
49 
50   for (j = 0; j < M; j++)
51     if (x_out_a[j] != 125
52         || x_out_b[j] != 5)
53       abort ();
54 
55   return 0;
56 }
57 
58 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
59 
60 
61