libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / fold-condneg-1.c
blobc4edd7487e889f7e8168e30470a3e04ab13bd8a3
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
4 int test_i0(int x)
6 return x != 0 ? -x : 0;
9 int test_i1(int x)
11 return x != 1 ? -x : -1;
14 int test_im1(int x)
16 return x != -1 ? -x : 1;
19 unsigned int test_u0(unsigned int x)
21 return x != 0 ? -x : 0;
24 unsigned int test_u1(unsigned int x)
26 return x != 1 ? -x : ~0u;
29 unsigned int test_um1(unsigned int x)
31 return x != ~0u ? -x : 1;
34 unsigned char test_uc0(unsigned char x)
36 return x != 0 ? -x : 0;
39 unsigned char test_uc1(unsigned char x)
41 return x != 1 ? -x : 255;
44 unsigned char test_uc127(unsigned char x)
46 return x != 127 ? -x : 129;
49 unsigned char test_uc128(unsigned char x)
51 return x != 128 ? -x : 128;
54 unsigned char test_uc255(unsigned char x)
56 return x != 255 ? -x : 1;
59 /* { dg-final { scan-tree-dump-not "goto" "optimized" } } */