libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / fold-negate-1.c
blob00ec8b4c0b97caac3cb72b126fc56b39fde92c55
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
4 #define SHIFT ((8*__SIZEOF_INT__)-1)
6 int test_rshift_1(int x)
8 int t = x >> SHIFT;
9 return -t;
12 int test_rshift_2(int x)
14 unsigned int t = (unsigned int)x >> SHIFT;
15 return -t;
18 int test_rshift_3(int x)
20 int t = (unsigned int)x >> SHIFT;
21 return -t;
24 int test_rshift_4(int x)
26 unsigned int t = x >> SHIFT;
27 return -t;
30 double test_mul_1(double x)
32 double t = -5.0 * x;
33 return -t;
36 double test_mul_2(double x, double y)
38 double t1 = -x;
39 double t2 = t1 * y;
40 return -t2;
43 double test_rdiv_1(double x, double y)
45 double t1 = -x;
46 double t2 = t1 / y;
47 return -t2;
50 double test_rdiv_2(double x, double y)
52 double t1 = -y;
53 double t2 = x / t1;
54 return -t2;
57 /* { dg-final { scan-tree-dump-not " -" "optimized" } } */