| 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 |
int ic[N] = |
| 21 |
{1,1,0,0,1,0,1,0, |
| 22 |
1,1,0,0,1,0,1,0, |
| 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 |
|
| 30 |
char ca[N]; |
| 31 |
char cb[N] = |
| 32 |
{1,1,0,0,1,0,1,0, |
| 33 |
1,1,0,0,1,0,1,0, |
| 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 |
|
| 41 |
char cc[N] = |
| 42 |
{1,1,0,0,1,0,1,0, |
| 43 |
1,1,0,0,1,0,1,0, |
| 44 |
1,1,0,0,1,0,1,0, |
| 45 |
1,1,0,0,1,0,1,0, |
| 46 |
1,1,0,0,1,0,1,0, |
| 47 |
1,1,0,0,1,0,1,0, |
| 48 |
1,1,0,0,1,0,1,0, |
| 49 |
1,1,0,0,1,0,1,0}; |
| 50 |
|
| 51 |
short sa[N]; |
| 52 |
short sb[N] = |
| 53 |
{1,1,0,0,1,0,1,0, |
| 54 |
1,1,0,0,1,0,1,0, |
| 55 |
1,1,0,0,1,0,1,0, |
| 56 |
1,1,0,0,1,0,1,0, |
| 57 |
1,1,0,0,1,0,1,0, |
| 58 |
1,1,0,0,1,0,1,0, |
| 59 |
1,1,0,0,1,0,1,0, |
| 60 |
1,1,0,0,1,0,1,0}; |
| 61 |
|
| 62 |
short sc[N] = |
| 63 |
{1,1,0,0,1,0,1,0, |
| 64 |
1,1,0,0,1,0,1,0, |
| 65 |
1,1,0,0,1,0,1,0, |
| 66 |
1,1,0,0,1,0,1,0, |
| 67 |
1,1,0,0,1,0,1,0, |
| 68 |
1,1,0,0,1,0,1,0, |
| 69 |
1,1,0,0,1,0,1,0, |
| 70 |
1,1,0,0,1,0,1,0}; |
| 71 |
|
| 72 |
__attribute__ ((noinline)) int |
| 73 |
main1 () |
| 74 |
{ |
| 75 |
int i; |
| 76 |
/* Check ints. */ |
| 77 |
|
| 78 |
for (i = 0; i < N; i++) |
| 79 |
{ |
| 80 |
ia[i] = !ib[i]; |
| 81 |
} |
| 82 |
|
| 83 |
/* check results: */ |
| 84 |
#pragma GCC novector |
| 85 |
for (i = 0; i <N; i++) |
| 86 |
{ |
| 87 |
if (ia[i] != !ib[i]) |
| 88 |
abort (); |
| 89 |
} |
| 90 |
|
| 91 |
/* Check chars. */ |
| 92 |
|
| 93 |
for (i = 0; i < N; i++) |
| 94 |
{ |
| 95 |
ca[i] = !cb[i]; |
| 96 |
} |
| 97 |
|
| 98 |
/* check results: */ |
| 99 |
#pragma GCC novector |
| 100 |
for (i = 0; i <N; i++) |
| 101 |
{ |
| 102 |
if (ca[i] != !cb[i]) |
| 103 |
abort (); |
| 104 |
} |
| 105 |
|
| 106 |
/* Check shorts. */ |
| 107 |
|
| 108 |
for (i = 0; i < N; i++) |
| 109 |
{ |
| 110 |
sa[i] = !sb[i]; |
| 111 |
} |
| 112 |
|
| 113 |
/* check results: */ |
| 114 |
#pragma GCC novector |
| 115 |
for (i = 0; i <N; i++) |
| 116 |
{ |
| 117 |
if (sa[i] != !sb[i]) |
| 118 |
abort (); |
| 119 |
} |
| 120 |
|
| 121 |
return 0; |
| 122 |
} |
| 123 |
|
| 124 |
int main (void) |
| 125 |
{ |
| 126 |
check_vect (); |
| 127 |
|
| 128 |
return main1 (); |
| 129 |
} |
| 130 |
|
| 131 |
/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { target vect_condition } } } */ |
| 132 |
/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ |
| 133 |
|
| 134 |
/* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */ |