| 1 |
/* { dg-require-effective-target vect_int } */ |
| 2 |
/* { dg-add-options bind_pic_locally } */ |
| 3 |
|
| 4 |
#include <stdarg.h> |
| 5 |
#include "tree-vect.h" |
| 6 |
|
| 7 |
#define N 16 |
| 8 |
#define M 4 |
| 9 |
|
| 10 |
int ib[M][M][N] = {{{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, |
| 11 |
{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, |
| 12 |
{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, |
| 13 |
{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}}, |
| 14 |
{{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, |
| 15 |
{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, |
| 16 |
{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, |
| 17 |
{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}}, |
| 18 |
{{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, |
| 19 |
{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, |
| 20 |
{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, |
| 21 |
{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}}, |
| 22 |
{{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, |
| 23 |
{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, |
| 24 |
{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, |
| 25 |
{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}}}; |
| 26 |
int ia[M][M][N]; |
| 27 |
int ic[N]; |
| 28 |
|
| 29 |
__attribute__ ((noinline)) |
| 30 |
int main1 () |
| 31 |
{ |
| 32 |
int i, j; |
| 33 |
|
| 34 |
/* Multidimensional array. Aligned. The "inner" dimensions |
| 35 |
are invariant in the inner loop. Load and store. */ |
| 36 |
for (i = 0; i < M; i++) |
| 37 |
{ |
| 38 |
for (j = 0; j < N; j++) |
| 39 |
{ |
| 40 |
ia[i][1][j] = ib[2][i][j]; |
| 41 |
} |
| 42 |
} |
| 43 |
|
| 44 |
/* check results: */ |
| 45 |
for (i = 0; i < M; i++) |
| 46 |
{ |
| 47 |
#pragma GCC novector |
| 48 |
for (j = 0; j < N; j++) |
| 49 |
{ |
| 50 |
if (ia[i][1][j] != ib[2][i][j]) |
| 51 |
abort(); |
| 52 |
} |
| 53 |
} |
| 54 |
|
| 55 |
/* Multidimensional array. Aligned. The "inner" dimensions |
| 56 |
are invariant in the inner loop. Load. */ |
| 57 |
for (i = 0; i < M; i++) |
| 58 |
{ |
| 59 |
for (j = 0; j < N; j++) |
| 60 |
{ |
| 61 |
ic[j] = ib[2][i][j]; |
| 62 |
} |
| 63 |
} |
| 64 |
|
| 65 |
/* check results: */ |
| 66 |
for (i = 0; i < M; i++) |
| 67 |
{ |
| 68 |
#pragma GCC novector |
| 69 |
for (j = 0; j < N; j++) |
| 70 |
{ |
| 71 |
if (ic[j] != ib[2][i][j]) |
| 72 |
abort(); |
| 73 |
} |
| 74 |
} |
| 75 |
|
| 76 |
return 0; |
| 77 |
} |
| 78 |
|
| 79 |
int main (void) |
| 80 |
{ |
| 81 |
check_vect (); |
| 82 |
|
| 83 |
return main1 (); |
| 84 |
} |
| 85 |
|
| 86 |
/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */ |
| 87 |
/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ |