| 1 |
/* Disabling epilogues until we find a better way to deal with scans. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-additional-options "--param vect-epilogues-nomask=0 -fdump-tree-optimized-details-blocks" } */ |
| 4 |
/* { dg-require-effective-target vect_int } */ |
| 5 |
/* { dg-additional-options "--param vect-max-peeling-for-alignment=0" } */ |
| 6 |
|
| 7 |
#include <stdarg.h> |
| 8 |
#include "tree-vect.h" |
| 9 |
|
| 10 |
#define N 256 |
| 11 |
|
| 12 |
/* Pick a value greater than the vector length. */ |
| 13 |
#if VECTOR_BITS > 128 |
| 14 |
#define OFF (VECTOR_BITS * 5 / 32) |
| 15 |
#else |
| 16 |
#define OFF 20 |
| 17 |
#endif |
| 18 |
|
| 19 |
extern int a[N + OFF]; |
| 20 |
|
| 21 |
/* The alignment of 'pa' is unknown. |
| 22 |
Yet we do know that both the read access and write access have |
| 23 |
the same alignment. Peeling to align one of the accesses will |
| 24 |
align the other. */ |
| 25 |
|
| 26 |
__attribute__ ((noinline)) int |
| 27 |
main1 (int * pa) |
| 28 |
{ |
| 29 |
int i; |
| 30 |
|
| 31 |
for (i = 0; i < N; i++) |
| 32 |
{ |
| 33 |
pa[i] = pa[i] + 1; |
| 34 |
} |
| 35 |
|
| 36 |
return 0; |
| 37 |
} |
| 38 |
|
| 39 |
/* The alignment of 'a' is unknown. |
| 40 |
Yet we do know that both the read access and write access have |
| 41 |
the same alignment. Peeling to align one of the accesses will |
| 42 |
align the other. */ |
| 43 |
|
| 44 |
__attribute__ ((noinline)) int |
| 45 |
main2 () |
| 46 |
{ |
| 47 |
int i; |
| 48 |
|
| 49 |
for (i = 0; i < N; i++) |
| 50 |
{ |
| 51 |
a[i] = a[i] + 1; |
| 52 |
} |
| 53 |
|
| 54 |
return 0; |
| 55 |
} |
| 56 |
|
| 57 |
__attribute__ ((noinline)) int |
| 58 |
main3 () |
| 59 |
{ |
| 60 |
int i; |
| 61 |
|
| 62 |
for (i = 0; i < N; i++) |
| 63 |
{ |
| 64 |
a[i] = a[i + OFF]; |
| 65 |
} |
| 66 |
|
| 67 |
return 0; |
| 68 |
} |
| 69 |
|
| 70 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 3 "vect" { xfail vect_no_int_add } } } */ |
| 71 |
/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" {target { {! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */ |
| 72 |
/* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */ |