| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O -fdump-tree-ifcombine-details" } */ |
| 3 |
|
| 4 |
/* Check that bitfield compares-with-zero turned into GT and LE compares with |
| 5 |
powers-of-two minus 1 are optimized. */ |
| 6 |
|
| 7 |
struct s { |
| 8 |
short a : sizeof (short) * __CHAR_BIT__ - 3; |
| 9 |
short b : 3; |
| 10 |
short c : 3; |
| 11 |
short d : sizeof (short) * __CHAR_BIT__ - 3; |
| 12 |
} __attribute__ ((aligned (4))); |
| 13 |
|
| 14 |
struct s p = { 15, 7, 3, 1 }; |
| 15 |
struct s q = { 0, 0, 0, 0 }; |
| 16 |
|
| 17 |
void f () |
| 18 |
{ |
| 19 |
if (p.a || p.b || p.c || p.d) |
| 20 |
return; |
| 21 |
__builtin_abort (); |
| 22 |
} |
| 23 |
|
| 24 |
void g () |
| 25 |
{ |
| 26 |
if (q.a || q.b || q.c || q.d) |
| 27 |
__builtin_abort (); |
| 28 |
} |
| 29 |
|
| 30 |
int main () { |
| 31 |
f (); |
| 32 |
g (); |
| 33 |
return 0; |
| 34 |
} |
| 35 |
|
| 36 |
/* { dg-final { scan-tree-dump-times "optimizing" 6 "ifcombine" { target { ! { avr-*-* pru-*-* } } } } } */ |