| 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 64 |
| 9 |
|
| 10 |
int ia[N]; |
| 11 |
int ib[N]= |
| 12 |
{1,1,0,0,1,0,1,0, |
| 13 |
1,1,0,0,1,0,1,0, |
| 14 |
1,1,0,0,1,0,1,0, |
| 15 |
1,1,0,0,1,0,1,0, |
| 16 |
1,1,0,0,1,0,1,0, |
| 17 |
1,1,0,0,1,0,1,0, |
| 18 |
1,1,0,0,1,0,1,0, |
| 19 |
1,1,0,0,1,0,1,0}; |
| 20 |
|
| 21 |
signed char ca[N]; |
| 22 |
signed char cb[N] = |
| 23 |
{1,1,0,0,1,0,1,0, |
| 24 |
1,1,0,0,1,0,1,0, |
| 25 |
1,1,0,0,1,0,1,0, |
| 26 |
1,1,0,0,1,0,1,0, |
| 27 |
1,1,0,0,1,0,1,0, |
| 28 |
1,1,0,0,1,0,1,0, |
| 29 |
1,1,0,0,1,0,1,0, |
| 30 |
1,1,0,0,1,0,1,0}; |
| 31 |
|
| 32 |
short sa[N]; |
| 33 |
short sb[N] = |
| 34 |
{1,1,0,0,1,0,1,0, |
| 35 |
1,1,0,0,1,0,1,0, |
| 36 |
1,1,0,0,1,0,1,0, |
| 37 |
1,1,0,0,1,0,1,0, |
| 38 |
1,1,0,0,1,0,1,0, |
| 39 |
1,1,0,0,1,0,1,0, |
| 40 |
1,1,0,0,1,0,1,0, |
| 41 |
1,1,0,0,1,0,1,0}; |
| 42 |
|
| 43 |
__attribute__ ((noinline)) int |
| 44 |
main1 () |
| 45 |
{ |
| 46 |
int i; |
| 47 |
|
| 48 |
/* Check ints. */ |
| 49 |
|
| 50 |
for (i = 0; i < N; i++) |
| 51 |
{ |
| 52 |
ia[i] = ~ib[i]; |
| 53 |
} |
| 54 |
|
| 55 |
/* check results: */ |
| 56 |
#pragma GCC novector |
| 57 |
for (i = 0; i <N; i++) |
| 58 |
{ |
| 59 |
if (ia[i] != ~ib[i]) |
| 60 |
abort (); |
| 61 |
} |
| 62 |
|
| 63 |
/* Check chars. */ |
| 64 |
|
| 65 |
for (i = 0; i < N; i++) |
| 66 |
{ |
| 67 |
ca[i] = ~cb[i]; |
| 68 |
} |
| 69 |
|
| 70 |
/* check results: */ |
| 71 |
#pragma GCC novector |
| 72 |
for (i = 0; i <N; i++) |
| 73 |
{ |
| 74 |
if (ca[i] != ~cb[i]) |
| 75 |
abort (); |
| 76 |
} |
| 77 |
|
| 78 |
/* Check shorts. */ |
| 79 |
|
| 80 |
for (i = 0; i < N; i++) |
| 81 |
{ |
| 82 |
sa[i] = ~sb[i]; |
| 83 |
} |
| 84 |
|
| 85 |
/* check results: */ |
| 86 |
#pragma GCC novector |
| 87 |
for (i = 0; i <N; i++) |
| 88 |
{ |
| 89 |
if (sa[i] != ~sb[i]) |
| 90 |
abort (); |
| 91 |
} |
| 92 |
|
| 93 |
return 0; |
| 94 |
} |
| 95 |
|
| 96 |
int main (void) |
| 97 |
{ |
| 98 |
check_vect (); |
| 99 |
|
| 100 |
return main1 (); |
| 101 |
} |
| 102 |
|
| 103 |
/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail vect_no_bitwise } } } */ |
| 104 |
/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ |
| 105 |
/* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */ |