libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr116024.c
blob6efa0c2f916fa053b48f897f9c806e086e3541b8
1 /* PR tree-optimization/116024 */
2 /* { dg-do compile } */
3 /* { dg-options "-O1 -fdump-tree-forwprop1-details" } */
5 #include <stdint.h>
6 #include <limits.h>
8 uint32_t f(void);
10 int32_t i1(void)
12 int32_t l = 10 - (int32_t)f();
13 return l <= 9; // f() > 0
16 int32_t i1a(void)
18 int32_t l = 20 - (int32_t)f();
19 return l <= INT32_MIN; // return 0
22 int32_t i1b(void)
24 int32_t l = 30 - (int32_t)f();
25 return l <= INT32_MIN + 31; // f() == INT32_MAX
28 int32_t i1c(void)
30 int32_t l = INT32_MAX - 40 - (int32_t)f();
31 return l <= -38; // f() > INT32_MAX - 3
34 int32_t i1d(void)
36 int32_t l = INT32_MAX - 50 - (int32_t)f();
37 return l <= INT32_MAX - 1; // f() != -50
40 int32_t i1e(void)
42 int32_t l = INT32_MAX - 60 - (int32_t)f();
43 return l != INT32_MAX - 90; // f() != 30
46 int32_t i1f(void)
48 int32_t l = INT32_MIN + 70 - (int32_t)f();
49 return l <= INT32_MAX - 2; // return 0
52 int32_t i1g(void)
54 int32_t l = INT32_MAX/2 + 30 - (int32_t)f();
55 return l <= INT32_MIN/2 - 30; // return 1
59 /* { dg-final { scan-tree-dump-times "Removing dead stmt:.*?- _" 5 "forwprop1" } } */
60 /* { dg-final { scan-tree-dump-times "return 0" 2 "forwprop1" } } */
61 /* { dg-final { scan-tree-dump-times "return 1" 1 "forwprop1" } } */
62 /* { dg-final { scan-tree-dump-times "gimple_simplified to.* > 0" 1 "forwprop1" } } */
63 /* { dg-final { scan-tree-dump-times "gimple_simplified to.* == 2147483647" 1 "forwprop1" } } */
64 /* { dg-final { scan-tree-dump-times "gimple_simplified to.* > 2147483644" 1 "forwprop1" } } */
65 /* { dg-final { scan-tree-dump-times "gimple_simplified to.* != 4294967246" 1 "forwprop1" } } */
66 /* { dg-final { scan-tree-dump-times "gimple_simplified to.* != 30" 1 "forwprop1" } } */