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