| 1 |
/* { dg-require-effective-target vect_int } */ |
| 2 |
/* { dg-additional-options "--param vect-max-version-for-alias-checks=0" } */ |
| 3 |
|
| 4 |
#include <stdarg.h> |
| 5 |
#include "tree-vect.h" |
| 6 |
|
| 7 |
#define N 16 |
| 8 |
char x[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); |
| 9 |
char cb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; |
| 10 |
|
| 11 |
__attribute__ ((noinline)) |
| 12 |
int main1 (char *y) |
| 13 |
{ |
| 14 |
struct { |
| 15 |
char *p; |
| 16 |
char *q; |
| 17 |
} s; |
| 18 |
int i; |
| 19 |
|
| 20 |
/* Not vectorized - can't antialias the pointer s.p from the array cb. */ |
| 21 |
s.p = y; |
| 22 |
for (i = 0; i < N; i++) |
| 23 |
{ |
| 24 |
s.p[i] = cb[i]; |
| 25 |
} |
| 26 |
|
| 27 |
/* check results: */ |
| 28 |
#pragma GCC novector |
| 29 |
for (i = 0; i < N; i++) |
| 30 |
{ |
| 31 |
if (s.p[i] != cb[i]) |
| 32 |
abort (); |
| 33 |
} |
| 34 |
|
| 35 |
/* Not vectorized - can't antialias the pointer s.p from the pointer s.q. */ |
| 36 |
s.q = cb; |
| 37 |
for (i = 0; i < N; i++) |
| 38 |
{ |
| 39 |
s.p[i] = s.q[i]; |
| 40 |
} |
| 41 |
|
| 42 |
/* check results: */ |
| 43 |
#pragma GCC novector |
| 44 |
for (i = 0; i < N; i++) |
| 45 |
{ |
| 46 |
if (s.p[i] != s.q[i]) |
| 47 |
abort (); |
| 48 |
} |
| 49 |
|
| 50 |
return 0; |
| 51 |
} |
| 52 |
|
| 53 |
int main (void) |
| 54 |
{ |
| 55 |
check_vect (); |
| 56 |
|
| 57 |
return main1 (x); |
| 58 |
} |
| 59 |
|
| 60 |
/* Currently the loops fail to vectorize due to aliasing problems. |
| 61 |
If/when the aliasing problems are resolved, unalignment may |
| 62 |
prevent vectorization on some targets. */ |
| 63 |
/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { xfail *-*-* } } } */ |
| 64 |
/* { dg-final { scan-tree-dump-times "can't determine dependence" 2 "vect" { target { ! vect_multiple_sizes } } } } */ |
| 65 |
/* { dg-final { scan-tree-dump "can't determine dependence" "vect" { target vect_multiple_sizes } } } */ |