Debian Codegraph @

gcc/testsuite/gcc.dg/fold-condneg-1.c

raw
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 : -1;
12 }
13
14 int test_im1(int x)
15 {
16 return x != -1 ? -x : 1;
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 : ~0u;
27 }
28
29 unsigned int test_um1(unsigned int x)
30 {
31 return x != ~0u ? -x : 1;
32 }
33
34 unsigned char test_uc0(unsigned char x)
35 {
36 return x != 0 ? -x : 0;
37 }
38
39 unsigned char test_uc1(unsigned char x)
40 {
41 return x != 1 ? -x : 255;
42 }
43
44 unsigned char test_uc127(unsigned char x)
45 {
46 return x != 127 ? -x : 129;
47 }
48
49 unsigned char test_uc128(unsigned char x)
50 {
51 return x != 128 ? -x : 128;
52 }
53
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" } } */