| 1 |
/* { dg-require-effective-target vect_int } */ |
| 2 |
/* { dg-additional-options "-fno-tree-loop-distribute-patterns" } */ |
| 3 |
|
| 4 |
#include <stdarg.h> |
| 5 |
#include "../../tree-vect.h" |
| 6 |
|
| 7 |
/* On Power7 without misalign vector support, this case is to check it's not |
| 8 |
profitable to perform vectorization by peeling to align the store. */ |
| 9 |
#define N 13 |
| 10 |
#define OFF 4 |
| 11 |
|
| 12 |
/* Check handling of accesses for which the "initial condition" - |
| 13 |
the expression that represents the first location accessed - is |
| 14 |
more involved than just an ssa_name. */ |
| 15 |
|
| 16 |
int ib[N+OFF] __attribute__ ((__aligned__(16))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10}; |
| 17 |
|
| 18 |
int main1 (int *pib) |
| 19 |
{ |
| 20 |
int i; |
| 21 |
int ia[N+OFF]; |
| 22 |
int ic[N+OFF] = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10}; |
| 23 |
|
| 24 |
for (i = OFF; i < N; i++) |
| 25 |
{ |
| 26 |
pib[i - OFF] = ic[i]; |
| 27 |
} |
| 28 |
|
| 29 |
|
| 30 |
/* check results: */ |
| 31 |
#pragma GCC novector |
| 32 |
for (i = OFF; i < N; i++) |
| 33 |
{ |
| 34 |
if (pib[i - OFF] != ic[i]) |
| 35 |
abort (); |
| 36 |
} |
| 37 |
|
| 38 |
return 0; |
| 39 |
} |
| 40 |
|
| 41 |
int main (void) |
| 42 |
{ |
| 43 |
check_vect (); |
| 44 |
|
| 45 |
main1 (&ib[OFF]); |
| 46 |
return 0; |
| 47 |
} |
| 48 |
|
| 49 |
/* Peeling to align the store is used. Overhead of peeling is too high. */ |
| 50 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target { vector_alignment_reachable && {! vect_no_align} } } } } */ |
| 51 |
/* { dg-final { scan-tree-dump-times "vectorization not profitable" 1 "vect" { target { vector_alignment_reachable && {! vect_hw_misalign} } } } } */ |
| 52 |
|
| 53 |
/* Versioning to align the store is used. Overhead of versioning is not too high. */ |
| 54 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_no_align || {! vector_alignment_reachable} } } } } */ |