| 1 |
/* { dg-require-effective-target vect_int } */ |
| 2 |
|
| 3 |
#include <stdarg.h> |
| 4 |
#include "../../tree-vect.h" |
| 5 |
|
| 6 |
#define N 32 |
| 7 |
|
| 8 |
struct s{ |
| 9 |
int m; |
| 10 |
int n[N][N][N]; |
| 11 |
}; |
| 12 |
|
| 13 |
struct test1{ |
| 14 |
struct s a; /* array a.n is unaligned */ |
| 15 |
int b; |
| 16 |
int c; |
| 17 |
struct s e; /* array e.n is aligned */ |
| 18 |
}; |
| 19 |
|
| 20 |
int main1 () |
| 21 |
{ |
| 22 |
int i,j; |
| 23 |
struct test1 tmp1; |
| 24 |
|
| 25 |
/* 1. unaligned */ |
| 26 |
for (i = 0; i < N; i++) |
| 27 |
{ |
| 28 |
tmp1.a.n[1][2][i] = 5; |
| 29 |
} |
| 30 |
|
| 31 |
/* check results: */ |
| 32 |
#pragma GCC novector |
| 33 |
for (i = 0; i <N; i++) |
| 34 |
{ |
| 35 |
if (tmp1.a.n[1][2][i] != 5) |
| 36 |
abort (); |
| 37 |
} |
| 38 |
|
| 39 |
/* 2. aligned */ |
| 40 |
for (i = 3; i < N-1; i++) |
| 41 |
{ |
| 42 |
tmp1.a.n[1][2][i] = 6; |
| 43 |
} |
| 44 |
|
| 45 |
/* check results: */ |
| 46 |
#pragma GCC novector |
| 47 |
for (i = 3; i < N-1; i++) |
| 48 |
{ |
| 49 |
if (tmp1.a.n[1][2][i] != 6) |
| 50 |
abort (); |
| 51 |
} |
| 52 |
|
| 53 |
/* 3. aligned */ |
| 54 |
for (i = 0; i < N; i++) |
| 55 |
{ |
| 56 |
tmp1.e.n[1][2][i] = 7; |
| 57 |
} |
| 58 |
|
| 59 |
/* check results: */ |
| 60 |
#pragma GCC novector |
| 61 |
for (i = 0; i < N; i++) |
| 62 |
{ |
| 63 |
if (tmp1.e.n[1][2][i] != 7) |
| 64 |
abort (); |
| 65 |
} |
| 66 |
|
| 67 |
/* 4. unaligned */ |
| 68 |
for (i = 3; i < N-3; i++) |
| 69 |
{ |
| 70 |
tmp1.e.n[1][2][i] = 8; |
| 71 |
} |
| 72 |
|
| 73 |
/* check results: */ |
| 74 |
#pragma GCC novector |
| 75 |
for (i = 3; i <N-3; i++) |
| 76 |
{ |
| 77 |
if (tmp1.e.n[1][2][i] != 8) |
| 78 |
abort (); |
| 79 |
} |
| 80 |
|
| 81 |
return 0; |
| 82 |
} |
| 83 |
|
| 84 |
int main (void) |
| 85 |
{ |
| 86 |
check_vect (); |
| 87 |
|
| 88 |
return main1 (); |
| 89 |
} |
| 90 |
|
| 91 |
/* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */ |