| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O1 -fdump-tree-optimized-raw" } */ |
| 3 |
|
| 4 |
_Bool eqeq0(unsigned x) |
| 5 |
{ |
| 6 |
return x == (x == 0); |
| 7 |
} |
| 8 |
_Bool eqeq1(unsigned x) |
| 9 |
{ |
| 10 |
return x == (x == 1); |
| 11 |
} |
| 12 |
_Bool eqeq2(unsigned x) |
| 13 |
{ |
| 14 |
return x == (x == 2); |
| 15 |
} |
| 16 |
|
| 17 |
_Bool neeq0(unsigned x) |
| 18 |
{ |
| 19 |
return x != (x == 0); |
| 20 |
} |
| 21 |
_Bool neeq1(unsigned x) |
| 22 |
{ |
| 23 |
return x != (x == 1); |
| 24 |
} |
| 25 |
_Bool neeq2(unsigned x) |
| 26 |
{ |
| 27 |
return x != (x == 2); |
| 28 |
} |
| 29 |
|
| 30 |
_Bool eqne0(unsigned x) |
| 31 |
{ |
| 32 |
return x == (x != 0); |
| 33 |
} |
| 34 |
_Bool eqne1(unsigned x) |
| 35 |
{ |
| 36 |
return x == (x != 1); |
| 37 |
} |
| 38 |
_Bool eqne2(unsigned x) |
| 39 |
{ |
| 40 |
return x == (x != 2); |
| 41 |
} |
| 42 |
|
| 43 |
_Bool nene0(unsigned x) |
| 44 |
{ |
| 45 |
return x != (x != 0); |
| 46 |
} |
| 47 |
_Bool nene1(unsigned x) |
| 48 |
{ |
| 49 |
return x != (x != 1); |
| 50 |
} |
| 51 |
_Bool nene2(unsigned x) |
| 52 |
{ |
| 53 |
return x != (x != 2); |
| 54 |
} |
| 55 |
|
| 56 |
/* All of these functions should have removed the inner most comparison which |
| 57 |
means all of the conversions from bool to unsigned should have been removed too. */ |
| 58 |
/* { dg-final { scan-tree-dump-not "nop_expr," "optimized"} } */ |