| 1 |
/* Disabling epilogues until we find a better way to deal with scans. */ |
| 2 |
/* { dg-additional-options "--param vect-epilogues-nomask=0" } */ |
| 3 |
/* { dg-require-effective-target vect_int } */ |
| 4 |
/* { dg-skip-if "AArch64 tiny code model does not support programs larger than 1MiB" {aarch64_tiny} } */ |
| 5 |
/* { dg-add-options bind_pic_locally } */ |
| 6 |
|
| 7 |
#include <stdarg.h> |
| 8 |
#include "tree-vect.h" |
| 9 |
|
| 10 |
#define N 64 |
| 11 |
|
| 12 |
struct s{ |
| 13 |
int m; |
| 14 |
int n[N][N][N]; |
| 15 |
}; |
| 16 |
|
| 17 |
struct test1{ |
| 18 |
struct s a; /* array a.n is unaligned */ |
| 19 |
int b; |
| 20 |
int c; |
| 21 |
struct s e; /* array e.n is aligned */ |
| 22 |
}; |
| 23 |
|
| 24 |
struct test1 tmp1; |
| 25 |
|
| 26 |
__attribute__ ((noinline)) |
| 27 |
int main1 () |
| 28 |
{ |
| 29 |
int i,j; |
| 30 |
|
| 31 |
/* 1. unaligned */ |
| 32 |
for (i = 0; i < N; i++) |
| 33 |
{ |
| 34 |
tmp1.a.n[1][2][i] = 5; |
| 35 |
} |
| 36 |
|
| 37 |
/* check results: */ |
| 38 |
#pragma GCC novector |
| 39 |
for (i = 0; i <N; i++) |
| 40 |
{ |
| 41 |
if (tmp1.a.n[1][2][i] != 5) |
| 42 |
abort (); |
| 43 |
} |
| 44 |
|
| 45 |
/* 2. aligned */ |
| 46 |
for (i = 3; i < N-1; i++) |
| 47 |
{ |
| 48 |
tmp1.a.n[1][2][i] = 6; |
| 49 |
} |
| 50 |
|
| 51 |
/* check results: */ |
| 52 |
#pragma GCC novector |
| 53 |
for (i = 3; i < N-1; i++) |
| 54 |
{ |
| 55 |
if (tmp1.a.n[1][2][i] != 6) |
| 56 |
abort (); |
| 57 |
} |
| 58 |
|
| 59 |
/* 3. aligned */ |
| 60 |
for (i = 0; i < N; i++) |
| 61 |
{ |
| 62 |
tmp1.e.n[1][2][i] = 7; |
| 63 |
} |
| 64 |
|
| 65 |
/* check results: */ |
| 66 |
#pragma GCC novector |
| 67 |
for (i = 0; i < N; i++) |
| 68 |
{ |
| 69 |
if (tmp1.e.n[1][2][i] != 7) |
| 70 |
abort (); |
| 71 |
} |
| 72 |
|
| 73 |
/* 4. unaligned */ |
| 74 |
for (i = 3; i < N-3; i++) |
| 75 |
{ |
| 76 |
tmp1.e.n[1][2][i] = 8; |
| 77 |
} |
| 78 |
|
| 79 |
/* check results: */ |
| 80 |
#pragma GCC novector |
| 81 |
for (i = 3; i <N-3; i++) |
| 82 |
{ |
| 83 |
if (tmp1.e.n[1][2][i] != 8) |
| 84 |
abort (); |
| 85 |
} |
| 86 |
|
| 87 |
return 0; |
| 88 |
} |
| 89 |
|
| 90 |
int main (void) |
| 91 |
{ |
| 92 |
check_vect (); |
| 93 |
|
| 94 |
return main1 (); |
| 95 |
} |
| 96 |
|
| 97 |
/* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */ |
| 98 |
/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ |
| 99 |
/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 4 "vect" { target { {! vect_aligned_arrays} && {vect_sizes_32B_16B} } } } } */ |
| 100 |
/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { target { {vect_aligned_arrays} && {! vect_sizes_32B_16B} } } } } */ |