| 1 |
/* { dg-require-effective-target vect_int } */ |
| 2 |
/* { dg-additional-options "-fdump-tree-optimized-details-blocks" } */ |
| 3 |
|
| 4 |
#include <stdarg.h> |
| 5 |
#include "tree-vect.h" |
| 6 |
|
| 7 |
#define N 16 |
| 8 |
|
| 9 |
__attribute__ ((noinline)) |
| 10 |
int main1 (int *a) |
| 11 |
{ |
| 12 |
int i, j, k; |
| 13 |
int b[N]; |
| 14 |
|
| 15 |
for (i = 0; i < N; i++) |
| 16 |
{ |
| 17 |
for (j = 0; j < N; j++) |
| 18 |
{ |
| 19 |
k = i + N; |
| 20 |
a[j] = k; |
| 21 |
} |
| 22 |
b[i] = k; |
| 23 |
} |
| 24 |
|
| 25 |
|
| 26 |
#pragma GCC novector |
| 27 |
for (j = 0; j < N; j++) |
| 28 |
if (a[j] != i + N - 1) |
| 29 |
abort(); |
| 30 |
|
| 31 |
#pragma GCC novector |
| 32 |
for (j = 0; j < N; j++) |
| 33 |
if (b[j] != j + N) |
| 34 |
abort(); |
| 35 |
|
| 36 |
return 0; |
| 37 |
} |
| 38 |
|
| 39 |
int main (void) |
| 40 |
{ |
| 41 |
int a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); |
| 42 |
|
| 43 |
check_vect (); |
| 44 |
|
| 45 |
main1 (a); |
| 46 |
|
| 47 |
return 0; |
| 48 |
} |
| 49 |
|
| 50 |
/* Fails for targets that don't vectorize PLUS (e.g alpha). */ |
| 51 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ |
| 52 |
/* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */ |