| 1 |
/* { dg-require-effective-target vect_condition } */ |
| 2 |
|
| 3 |
#include "tree-vect.h" |
| 4 |
|
| 5 |
#define N 16 |
| 6 |
|
| 7 |
int c[N] = {3,2,1,10,1,42,3,4,50,9,32,8,11,10,1,2}; |
| 8 |
int a[N+1] = {0,16,32,48,64,128,256,512,0,16,32,48,64,128,256,512,1024}; |
| 9 |
|
| 10 |
__attribute__ ((noinline)) void |
| 11 |
foo (int *x) |
| 12 |
{ |
| 13 |
int i; |
| 14 |
int curr_a, flag, next_a; |
| 15 |
|
| 16 |
curr_a = a[0]; |
| 17 |
|
| 18 |
for (i = 0; i < N; i++) |
| 19 |
{ |
| 20 |
flag = *x > c[i]; |
| 21 |
next_a = a[i+1]; |
| 22 |
curr_a = flag ? curr_a : next_a; |
| 23 |
} |
| 24 |
|
| 25 |
*x = curr_a; |
| 26 |
} |
| 27 |
|
| 28 |
int main (void) |
| 29 |
{ |
| 30 |
int x = 7; |
| 31 |
|
| 32 |
check_vect (); |
| 33 |
|
| 34 |
foo (&x); |
| 35 |
|
| 36 |
if (x != 256) |
| 37 |
abort (); |
| 38 |
|
| 39 |
return 0; |
| 40 |
} |
| 41 |
|
| 42 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ |