1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
3
test_i0(int x)4 int test_i0(int x)
5 {
6 return x != 0 ? -x : 0;
7 }
8
test_i1(int x)9 int test_i1(int x)
10 {
11 return x != 1 ? -x : -1;
12 }
13
test_im1(int x)14 int test_im1(int x)
15 {
16 return x != -1 ? -x : 1;
17 }
18
test_u0(unsigned int x)19 unsigned int test_u0(unsigned int x)
20 {
21 return x != 0 ? -x : 0;
22 }
23
test_u1(unsigned int x)24 unsigned int test_u1(unsigned int x)
25 {
26 return x != 1 ? -x : ~0u;
27 }
28
test_um1(unsigned int x)29 unsigned int test_um1(unsigned int x)
30 {
31 return x != ~0u ? -x : 1;
32 }
33
test_uc0(unsigned char x)34 unsigned char test_uc0(unsigned char x)
35 {
36 return x != 0 ? -x : 0;
37 }
38
test_uc1(unsigned char x)39 unsigned char test_uc1(unsigned char x)
40 {
41 return x != 1 ? -x : 255;
42 }
43
test_uc127(unsigned char x)44 unsigned char test_uc127(unsigned char x)
45 {
46 return x != 127 ? -x : 129;
47 }
48
test_uc128(unsigned char x)49 unsigned char test_uc128(unsigned char x)
50 {
51 return x != 128 ? -x : 128;
52 }
53
test_uc255(unsigned char x)54 unsigned char test_uc255(unsigned char x)
55 {
56 return x != 255 ? -x : 1;
57 }
58
59 /* { dg-final { scan-tree-dump-not "goto" "optimized" } } */
60