Debian Codegraph @

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

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
3
4 #define SHIFT ((8*__SIZEOF_INT__)-1)
5
6 int test_rshift_1(int x)
7 {
8 int t = x >> SHIFT;
9 return -t;
10 }
11
12 int test_rshift_2(int x)
13 {
14 unsigned int t = (unsigned int)x >> SHIFT;
15 return -t;
16 }
17
18 int test_rshift_3(int x)
19 {
20 int t = (unsigned int)x >> SHIFT;
21 return -t;
22 }
23
24 int test_rshift_4(int x)
25 {
26 unsigned int t = x >> SHIFT;
27 return -t;
28 }
29
30 double test_mul_1(double x)
31 {
32 double t = -5.0 * x;
33 return -t;
34 }
35
36 double test_mul_2(double x, double y)
37 {
38 double t1 = -x;
39 double t2 = t1 * y;
40 return -t2;
41 }
42
43 double test_rdiv_1(double x, double y)
44 {
45 double t1 = -x;
46 double t2 = t1 / y;
47 return -t2;
48 }
49
50 double test_rdiv_2(double x, double y)
51 {
52 double t1 = -y;
53 double t2 = x / t1;
54 return -t2;
55 }
56
57 /* { dg-final { scan-tree-dump-not " -" "optimized" } } */
58