111
|
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[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};
|
|
13
|
|
14 __attribute__ ((noinline)) void
|
|
15 foo ()
|
|
16 {
|
|
17 int j, i, x;
|
|
18 int curr_a, next_a;
|
|
19
|
|
20 for (j = 0; j < M; j++)
|
|
21 {
|
|
22 x = x_in[j];
|
|
23 curr_a = a[0];
|
|
24
|
|
25 for (i = 0; i < N; i++)
|
|
26 {
|
|
27 next_a = a[i+1];
|
|
28 curr_a = x > c[i] ? curr_a : next_a;
|
|
29 }
|
|
30
|
|
31 x_out[j] = curr_a;
|
|
32 }
|
|
33 }
|
|
34
|
|
35 int main (void)
|
|
36 {
|
|
37 int i,j;
|
|
38
|
|
39 check_vect ();
|
|
40
|
|
41 for (j = 0; j < M; j++)
|
|
42 x_in[j] = j;
|
|
43
|
|
44 foo ();
|
|
45
|
|
46 for (j = 0; j < M; j++)
|
|
47 if (x_out[j] != check_result[j])
|
|
48 abort ();
|
|
49
|
|
50 return 0;
|
|
51 }
|
|
52
|
|
53 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
|
|
54
|
|
55
|