| 1 |
/* { dg-require-effective-target vect_float } */ |
| 2 |
/* { dg-add-options bind_pic_locally } */ |
| 3 |
/* { dg-additional-options "-fdump-tree-optimized-details-blocks" } */ |
| 4 |
|
| 5 |
#include <stdarg.h> |
| 6 |
#include "tree-vect.h" |
| 7 |
|
| 8 |
#define N 16 |
| 9 |
|
| 10 |
float a[N]; |
| 11 |
float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; |
| 12 |
float d[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30}; |
| 13 |
|
| 14 |
__attribute__ ((noinline)) |
| 15 |
int main1 () |
| 16 |
{ |
| 17 |
int i, j; |
| 18 |
|
| 19 |
i = 0; |
| 20 |
j = 0; |
| 21 |
while (i < 5*N) |
| 22 |
{ |
| 23 |
a[j] = c[j]; |
| 24 |
i += 5; |
| 25 |
j++; |
| 26 |
} |
| 27 |
|
| 28 |
/* check results: */ |
| 29 |
#pragma GCC novector |
| 30 |
for (i = 0; i <N; i++) |
| 31 |
{ |
| 32 |
if (a[i] != c[i]) |
| 33 |
abort (); |
| 34 |
} |
| 35 |
|
| 36 |
|
| 37 |
for (i = N; i > 0; i--) |
| 38 |
{ |
| 39 |
a[N-i] = d[N-i]; |
| 40 |
} |
| 41 |
|
| 42 |
/* check results: */ |
| 43 |
#pragma GCC novector |
| 44 |
for (i = 0; i < N; i++) |
| 45 |
{ |
| 46 |
if (a[i] != d[i]) |
| 47 |
abort (); |
| 48 |
} |
| 49 |
|
| 50 |
return 0; |
| 51 |
} |
| 52 |
|
| 53 |
int main (void) |
| 54 |
{ |
| 55 |
check_vect (); |
| 56 |
|
| 57 |
return main1 (); |
| 58 |
} |
| 59 |
|
| 60 |
/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */ |
| 61 |
/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ |
| 62 |
/* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */ |