| 1 |
/* { dg-require-effective-target vect_int } */ |
| 2 |
|
| 3 |
#include <stdarg.h> |
| 4 |
#include "tree-vect.h" |
| 5 |
|
| 6 |
#define N 40 |
| 7 |
|
| 8 |
int a[N]; |
| 9 |
int b[N]; |
| 10 |
|
| 11 |
__attribute__ ((noinline)) int |
| 12 |
foo (int n){ |
| 13 |
int i,j; |
| 14 |
int sum,x,y; |
| 15 |
|
| 16 |
for (i = 0; i < N/2; i++) { |
| 17 |
sum = 0; |
| 18 |
x = b[2*i]; |
| 19 |
y = b[2*i+1]; |
| 20 |
for (j = 0; j < n; j++) { |
| 21 |
sum += j; |
| 22 |
} |
| 23 |
a[2*i] = sum + x; |
| 24 |
a[2*i+1] = sum + y; |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
int main (void) |
| 29 |
{ |
| 30 |
int i,j; |
| 31 |
int sum; |
| 32 |
|
| 33 |
check_vect (); |
| 34 |
|
| 35 |
for (i=0; i<N; i++) |
| 36 |
b[i] = i; |
| 37 |
|
| 38 |
foo (N-1); |
| 39 |
|
| 40 |
/* check results: */ |
| 41 |
#pragma GCC novector |
| 42 |
for (i=0; i<N/2; i++) |
| 43 |
{ |
| 44 |
sum = 0; |
| 45 |
for (j = 0; j < N-1; j++) |
| 46 |
sum += j; |
| 47 |
if (a[2*i] != sum + b[2*i] || a[2*i+1] != sum + b[2*i+1]) |
| 48 |
abort(); |
| 49 |
} |
| 50 |
|
| 51 |
return 0; |
| 52 |
} |
| 53 |
|
| 54 |
/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED." 1 "vect" { xfail *-*-* } } } */ |