| 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 |
|
| 10 |
__attribute__ ((noinline)) int |
| 11 |
foo (){ |
| 12 |
int i,j; |
| 13 |
int sum; |
| 14 |
|
| 15 |
for (i = 0; i < N; i++) { |
| 16 |
sum = 0; |
| 17 |
for (j = 0; j < N; j++) { |
| 18 |
sum += j; |
| 19 |
} |
| 20 |
a[i] += sum + i; |
| 21 |
} |
| 22 |
} |
| 23 |
|
| 24 |
int main (void) |
| 25 |
{ |
| 26 |
int i,j; |
| 27 |
int sum; |
| 28 |
int aa[N]; |
| 29 |
|
| 30 |
check_vect (); |
| 31 |
|
| 32 |
for (i=0; i<N; i++){ |
| 33 |
a[i] = i; |
| 34 |
aa[i] = i; |
| 35 |
} |
| 36 |
|
| 37 |
foo (); |
| 38 |
|
| 39 |
/* check results: */ |
| 40 |
#pragma GCC novector |
| 41 |
for (i=0; i<N; i++) |
| 42 |
{ |
| 43 |
sum = 0; |
| 44 |
for (j = 0; j < N; j++) |
| 45 |
sum += j; |
| 46 |
if (a[i] != aa[i] + sum + i) |
| 47 |
abort(); |
| 48 |
} |
| 49 |
|
| 50 |
return 0; |
| 51 |
} |
| 52 |
|
| 53 |
/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED." 1 "vect" } } */ |