| 1 |
#include <stdbool.h> |
| 2 |
#include "tree-vect.h" |
| 3 |
|
| 4 |
struct C |
| 5 |
{ |
| 6 |
int c; |
| 7 |
int d; |
| 8 |
bool f :1; |
| 9 |
float e; |
| 10 |
}; |
| 11 |
|
| 12 |
struct A |
| 13 |
{ |
| 14 |
unsigned int a; |
| 15 |
unsigned char c1, c2; |
| 16 |
bool b1 : 1; |
| 17 |
bool b2 : 1; |
| 18 |
bool b3 : 1; |
| 19 |
struct C b4; |
| 20 |
}; |
| 21 |
|
| 22 |
void __attribute__((noipa)) |
| 23 |
foo (const struct A * __restrict x, int y) |
| 24 |
{ |
| 25 |
int s = 0, i = 0; |
| 26 |
for (i = 0; i < y; ++i) |
| 27 |
{ |
| 28 |
const struct A a = x[i]; |
| 29 |
s += a.b4.f ? 1 : 0; |
| 30 |
} |
| 31 |
if (s != 0) |
| 32 |
__builtin_abort (); |
| 33 |
} |
| 34 |
|
| 35 |
int |
| 36 |
main () |
| 37 |
{ |
| 38 |
struct A x[100]; |
| 39 |
int i; |
| 40 |
|
| 41 |
check_vect (); |
| 42 |
|
| 43 |
__builtin_memset (x, -1, sizeof (x)); |
| 44 |
#pragma GCC novect |
| 45 |
for (i = 0; i < 100; i++) |
| 46 |
{ |
| 47 |
x[i].b1 = false; |
| 48 |
x[i].b2 = false; |
| 49 |
x[i].b3 = false; |
| 50 |
x[i].b4.f = false; |
| 51 |
} |
| 52 |
foo (x, 100); |
| 53 |
return 0; |
| 54 |
} |
| 55 |
|
| 56 |
/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target { vect_int && { le || { be && vect_shift_char } } } } } } */ |