| 1 |
/* { dg-require-effective-target vect_int } */ |
| 2 |
/* { dg-additional-options "--param vect-max-peeling-for-alignment=0 -fdump-tree-optimized-details-blocks" } */ |
| 3 |
|
| 4 |
#include <stdarg.h> |
| 5 |
#include "tree-vect.h" |
| 6 |
|
| 7 |
#if VECTOR_BITS > 128 |
| 8 |
#define NINTS (VECTOR_BITS / 32) |
| 9 |
#else |
| 10 |
#define NINTS 4 |
| 11 |
#endif |
| 12 |
|
| 13 |
#define N (NINTS * 6) |
| 14 |
|
| 15 |
/* Keep execution time down. */ |
| 16 |
#if N <= 24 |
| 17 |
#define OUTERN N |
| 18 |
#else |
| 19 |
#define OUTERN NINTS |
| 20 |
#endif |
| 21 |
|
| 22 |
struct s{ |
| 23 |
int m; |
| 24 |
int n[4][4][N]; |
| 25 |
}; |
| 26 |
|
| 27 |
struct test1{ |
| 28 |
struct s a; /* array a.n is unaligned */ |
| 29 |
int b; |
| 30 |
int c; |
| 31 |
struct s e[N]; /* array e.n is aligned */ |
| 32 |
}; |
| 33 |
|
| 34 |
/* Avoid big local temporaries. */ |
| 35 |
#if NINTS > 8 |
| 36 |
struct test1 tmp1; |
| 37 |
#endif |
| 38 |
|
| 39 |
__attribute__ ((noinline)) |
| 40 |
int main1 () |
| 41 |
{ |
| 42 |
int i,j; |
| 43 |
#if NINTS <= 8 |
| 44 |
struct test1 tmp1; |
| 45 |
#endif |
| 46 |
|
| 47 |
for (i = 0; i < OUTERN; i++) |
| 48 |
for (j = NINTS - 1; j < N - NINTS + 1; j++) |
| 49 |
{ |
| 50 |
tmp1.e[i].n[1][2][j] = 8; |
| 51 |
} |
| 52 |
|
| 53 |
/* check results: */ |
| 54 |
for (i = 0; i < OUTERN; i++) |
| 55 |
#pragma GCC novector |
| 56 |
for (j = NINTS - 1; j < N - NINTS + 1; j++) |
| 57 |
{ |
| 58 |
if (tmp1.e[i].n[1][2][j] != 8) |
| 59 |
abort (); |
| 60 |
} |
| 61 |
|
| 62 |
/* not consecutive, will use strided stores */ |
| 63 |
for (i = 0; i < OUTERN; i++) |
| 64 |
for (j = NINTS - 1; j < N - NINTS + 1; j++) |
| 65 |
{ |
| 66 |
tmp1.e[j].n[1][2][j] = 8; |
| 67 |
} |
| 68 |
|
| 69 |
/* check results: */ |
| 70 |
for (i = 0; i < OUTERN; i++) |
| 71 |
#pragma GCC novector |
| 72 |
for (j = NINTS - 1; j < N - NINTS + 1; j++) |
| 73 |
{ |
| 74 |
if (tmp1.e[j].n[1][2][j] != 8) |
| 75 |
abort (); |
| 76 |
} |
| 77 |
|
| 78 |
return 0; |
| 79 |
} |
| 80 |
|
| 81 |
int main (void) |
| 82 |
{ |
| 83 |
check_vect (); |
| 84 |
|
| 85 |
return main1 (); |
| 86 |
} |
| 87 |
|
| 88 |
/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */ |
| 89 |
/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" {target {{! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */ |
| 90 |
/* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */ |