Debian Codegraph @

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

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O1 -fdump-tree-optimized -fdump-tree-original -fdump-tree-phiopt1 -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 if (a > b)
10 c = a;
11 else
12 c = b;
13 return c;
14 }
15 int minbool(bool ab, bool bb)
16 {
17 int a = ab;
18 int b = bb;
19 int c;
20 if (a < b)
21 c = a;
22 else
23 c = b;
24 return c;
25 }
26 /* In Original, we should still have the if form as that is what is written. */
27 /* { dg-final { scan-tree-dump-times "MAX_EXPR" 0 "original" } } */
28 /* { dg-final { scan-tree-dump-times "MIN_EXPR" 0 "original" } } */
29 /* { dg-final { scan-tree-dump-times "if " 2 "original" } } */
30
31 /* PHI-OPT1 should have converted it into min/max */
32 /* { dg-final { scan-tree-dump-times "MAX_EXPR" 1 "phiopt1" } } */
33 /* { dg-final { scan-tree-dump-times "MIN_EXPR" 1 "phiopt1" } } */
34 /* { dg-final { scan-tree-dump-times "if " 0 "phiopt1" } } */
35
36 /* Forwprop2 (after ccp) will convert it into &\| */
37 /* { dg-final { scan-tree-dump-times "MAX_EXPR" 0 "forwprop2" } } */
38 /* { dg-final { scan-tree-dump-times "MIN_EXPR" 0 "forwprop2" } } */
39 /* { dg-final { scan-tree-dump-times "if " 0 "forwprop2" } } */
40
41 /* By optimize there should be no min/max nor if */
42 /* { dg-final { scan-tree-dump-times "MAX_EXPR" 0 "optimized" } } */
43 /* { dg-final { scan-tree-dump-times "MIN_EXPR" 0 "optimized" } } */
44 /* { dg-final { scan-tree-dump-times "if " 0 "optimized" } } */