| 1 |
/* { dg-require-effective-target vect_int } */ |
| 2 |
|
| 3 |
#include <stdlib.h> |
| 4 |
#include <stdarg.h> |
| 5 |
#include "tree-vect.h" |
| 6 |
|
| 7 |
/* Compile time unknown misalignment. Cannot use loop peeling to align |
| 8 |
the store. */ |
| 9 |
|
| 10 |
#define N 17 |
| 11 |
|
| 12 |
struct foo { |
| 13 |
char x0; |
| 14 |
int y[N][N]; |
| 15 |
} __attribute__ ((packed)); |
| 16 |
|
| 17 |
struct foo f2; |
| 18 |
int z[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; |
| 19 |
|
| 20 |
__attribute__ ((noinline)) |
| 21 |
void fbar(struct foo *fp) |
| 22 |
{ |
| 23 |
int i,j; |
| 24 |
for (i=0; i<N; i++) |
| 25 |
for (j=0; j<N; j++) |
| 26 |
f2.y[i][j] = z[i]; |
| 27 |
|
| 28 |
for (i=0; i<N; i++) |
| 29 |
#pragma GCC novector |
| 30 |
for (j=0; j<N; j++) |
| 31 |
if (f2.y[i][j] != z[i]) |
| 32 |
abort (); |
| 33 |
} |
| 34 |
|
| 35 |
int main (void) |
| 36 |
{ |
| 37 |
struct foo *fp = (struct foo *) malloc (2*sizeof (struct foo)); |
| 38 |
|
| 39 |
check_vect (); |
| 40 |
|
| 41 |
fbar(fp); |
| 42 |
return 0; |
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */ |
| 47 |
/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { vect_hw_misalign && arm_vect_no_misalign } } } } */ |
| 48 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ |