| 1 |
/* { dg-require-effective-target vect_int } */ |
| 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 128 |
| 9 |
|
| 10 |
short sa[N]; |
| 11 |
short sb[N]; |
| 12 |
|
| 13 |
__attribute__ ((noinline)) |
| 14 |
int main1 () |
| 15 |
{ |
| 16 |
int i; |
| 17 |
|
| 18 |
for (i = 0; i < N; i++) |
| 19 |
{ |
| 20 |
sb[i] = 5; |
| 21 |
} |
| 22 |
|
| 23 |
/* check results: */ |
| 24 |
#pragma GCC novector |
| 25 |
for (i = 0; i < N; i++) |
| 26 |
{ |
| 27 |
if (sb[i] != 5) |
| 28 |
abort (); |
| 29 |
} |
| 30 |
|
| 31 |
for (i = 0; i < N; i++) |
| 32 |
{ |
| 33 |
sa[i] = sb[i] + 100; |
| 34 |
} |
| 35 |
|
| 36 |
/* check results: */ |
| 37 |
#pragma GCC novector |
| 38 |
for (i = 0; i < N; i++) |
| 39 |
{ |
| 40 |
if (sa[i] != 105) |
| 41 |
abort (); |
| 42 |
} |
| 43 |
|
| 44 |
return 0; |
| 45 |
} |
| 46 |
|
| 47 |
int main (void) |
| 48 |
{ |
| 49 |
check_vect (); |
| 50 |
|
| 51 |
return main1 (); |
| 52 |
} |
| 53 |
|
| 54 |
/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */ |
| 55 |
/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ |
| 56 |
/* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */ |