| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-tree-optimized" } */ |
| 3 |
|
| 4 |
int test_i0(int x) |
| 5 |
{ |
| 6 |
return x != 0 ? ~x : ~0; |
| 7 |
} |
| 8 |
|
| 9 |
int test_i1(int x) |
| 10 |
{ |
| 11 |
return x != 1 ? ~x : -2; |
| 12 |
} |
| 13 |
|
| 14 |
int test_im1(int x) |
| 15 |
{ |
| 16 |
return x != ~0 ? ~x : 0; |
| 17 |
} |
| 18 |
|
| 19 |
unsigned int test_u0(unsigned int x) |
| 20 |
{ |
| 21 |
return x != 0 ? ~x : ~0; |
| 22 |
} |
| 23 |
|
| 24 |
unsigned int test_u1(unsigned int x) |
| 25 |
{ |
| 26 |
return x != 1 ? ~x : ~1u; |
| 27 |
} |
| 28 |
|
| 29 |
unsigned int test_um1(unsigned int x) |
| 30 |
{ |
| 31 |
return x != ~0u ? ~x : 0; |
| 32 |
} |
| 33 |
|
| 34 |
signed char test_c0(signed char x) |
| 35 |
{ |
| 36 |
return x != 0 ? ~x : -1; |
| 37 |
} |
| 38 |
|
| 39 |
signed char test_c1(signed char x) |
| 40 |
{ |
| 41 |
return x != 1 ? ~x : -2; |
| 42 |
} |
| 43 |
|
| 44 |
signed char test_cm1(signed char x) |
| 45 |
{ |
| 46 |
return x != -1 ? ~x : 0; |
| 47 |
} |
| 48 |
|
| 49 |
signed char test_cm128(signed char x) |
| 50 |
{ |
| 51 |
return x != -128 ? ~x : 127; |
| 52 |
} |
| 53 |
|
| 54 |
signed char test_c127(signed char x) |
| 55 |
{ |
| 56 |
return x != 127 ? ~x : -128; |
| 57 |
} |
| 58 |
|
| 59 |
unsigned char test_uc0(unsigned char x) |
| 60 |
{ |
| 61 |
return x != 0 ? ~x : 255; |
| 62 |
} |
| 63 |
|
| 64 |
unsigned char test_uc1(unsigned char x) |
| 65 |
{ |
| 66 |
return x != 1 ? ~x : 254; |
| 67 |
} |
| 68 |
|
| 69 |
unsigned char test_uc127(unsigned char x) |
| 70 |
{ |
| 71 |
return x != 127 ? ~x : 128; |
| 72 |
} |
| 73 |
|
| 74 |
unsigned char test_uc128(unsigned char x) |
| 75 |
{ |
| 76 |
return x != 128 ? ~x : 127; |
| 77 |
} |
| 78 |
|
| 79 |
unsigned char test_ucm1(unsigned char x) |
| 80 |
{ |
| 81 |
return x != 255 ? ~x : 0; |
| 82 |
} |
| 83 |
|
| 84 |
/* { dg-final { scan-tree-dump-not "goto" "optimized" } } */ |