| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-require-effective-target vect_int } */ |
| 3 |
/* { dg-additional-options "-fno-tree-loop-distribute-patterns" } */ |
| 4 |
|
| 5 |
#include <stdarg.h> |
| 6 |
#include "../../tree-vect.h" |
| 7 |
|
| 8 |
#define N 16 |
| 9 |
struct test { |
| 10 |
char ca[N]; |
| 11 |
}; |
| 12 |
|
| 13 |
extern struct test s; |
| 14 |
|
| 15 |
__attribute__((noipa)) int main1 () |
| 16 |
{ |
| 17 |
int i; |
| 18 |
|
| 19 |
for (i = 0; i < N; i++) |
| 20 |
{ |
| 21 |
s.ca[i] = 5; |
| 22 |
} |
| 23 |
|
| 24 |
/* check results: */ |
| 25 |
#pragma GCC novector |
| 26 |
for (i = 0; i < N; i++) |
| 27 |
{ |
| 28 |
if (s.ca[i] != 5) |
| 29 |
abort (); |
| 30 |
} |
| 31 |
|
| 32 |
return 0; |
| 33 |
} |
| 34 |
|
| 35 |
int main (void) |
| 36 |
{ |
| 37 |
return main1 (); |
| 38 |
} |
| 39 |
|
| 40 |
/* Peeling to align the store is used. Overhead of peeling is too high. */ |
| 41 |
/* { dg-final { scan-tree-dump-times "vectorization not profitable" 1 "vect" { target { ! natural_alignment_32 } } } } */ |
| 42 |
|
| 43 |
/* Vectorization occurs, either because overhead of versioning is not |
| 44 |
too high, or because the hardware supports efficient unaligned accesses. */ |
| 45 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { natural_alignment_32 } } } } */ |
| 46 |
|
| 47 |
/* Versioning to align the store is used. Overhead of versioning is not |
| 48 |
too high. */ |
| 49 |
/* { dg-final { scan-tree-dump-times "loop versioned for vectorization to enhance alignment" 1 "vect" { target { natural_alignment_32 && { ! vect_hw_misalign } } } } } */ |