PR middle-end/27945
[official-gcc.git] / gcc / testsuite / gcc.dg / pr15784-1.c
blob77e398e1da8687779992301fced5f890bdad4649
1 /* { dg-do compile } */
2 /* { dg-options "-fstrict-overflow -fdump-tree-gimple" } */
3 /* Test for folding abs(x) where appropriate. */
4 #define abs(x) x > 0 ? x : -x
5 extern double fabs (double);
7 int a (int x) {
8 return (abs(x)) >= 0;
11 int b (int x) {
12 return (abs(x)) == 0;
15 int c (int x) {
16 return (abs(x)) != 0;
19 int d (int x) {
20 return 0 != (abs(x));
23 int e (int x) {
24 return 0 == (abs(x));
27 int f (int x) {
28 return 0 <= (abs(x));
31 int g (int x) {
32 return 0 > (abs(x));
35 int h (float x) {
36 return 0.0 > fabs(x);
39 int i (float x) {
40 return fabs(x) == -0.0;
42 /* { dg-final { scan-tree-dump-times "ABS_EXPR" 0 "gimple" } } */
43 /* { dg-final { cleanup-tree-dump "gimple" } } */