Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/bool-13.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O1 -fdump-tree-optimized -fdump-tree-original -fdump-tree-forwprop1 -fdump-tree-forwprop2" } */
3 #define bool _Bool
4 int maxbool(bool ab, bool bb)
5 {
6 int a = ab;
7 int b = bb;
8 int c;
9 c = a > b ? a : b;
10 return c;
11 }
12 int minbool(bool ab, bool bb)
13 {
14 int a = ab;
15 int b = bb;
16 int c;
17 c = a < b ? a : b;
18 return c;
19 }
20 /* In Original, we should still have the min/max form as that is what is written. */
21 /* { dg-final { scan-tree-dump-times "MAX_EXPR" 1 "original" } } */
22 /* { dg-final { scan-tree-dump-times "MIN_EXPR" 1 "original" } } */
23 /* { dg-final { scan-tree-dump-times "if " 0 "original" } } */
24
25 /* Forwprop1 will convert it into &\| as we can detect that the arguments are one_zero. */
26 /* { dg-final { scan-tree-dump-times "MAX_EXPR" 0 "forwprop1" } } */
27 /* { dg-final { scan-tree-dump-times "MIN_EXPR" 0 "forwprop1" } } */
28 /* { dg-final { scan-tree-dump-times "if " 0 "forwprop1" } } */
29
30 /* By optimize there should be no min/max nor if */
31 /* { dg-final { scan-tree-dump-times "MAX_EXPR" 0 "optimized" } } */
32 /* { dg-final { scan-tree-dump-times "MIN_EXPR" 0 "optimized" } } */
33 /* { dg-final { scan-tree-dump-times "if " 0 "optimized" } } */