Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/pr109401.c

raw
1 /* PR tree-optimization/109878 */
2 /* { dg-do compile } */
3 /* { dg-options "-O1 -fdump-tree-optimized" } */
4
5 /* Returns max (a, b) */
6 int max(int a, int b) {
7 if (b > a)
8 return b;
9 else
10 return a;
11 }
12
13 /* Returns min (a, b) */
14 int min(int a, int b) {
15 if (b < a)
16 return b;
17 else
18 return a;
19 }
20
21 /* All the functions here shouldn't evalute min or max of a and b
22 * These functions should return a op b */
23 int f(int a, int b)
24 {
25 return max (a, b) + min (a, b);
26 }
27
28 int f1(int a, int b)
29 {
30 return max (a, b) * min (a, b);
31 }
32
33 int f2(int a, int b)
34 {
35 return max (a, b) | min (a, b);
36 }
37
38 int f3(int a, int b)
39 {
40 return max (a, b) & min (a, b);
41 }
42
43 int f5(int a, int b)
44 {
45 return min (a, b) ^ max (a, b);
46 }
47
48 int f6(int a, int b)
49 {
50 return min (a, b) == max (a, b);
51 }
52
53 int f7(int a, int b)
54 {
55 return min (a, b) != max (a, b);
56 }
57
58 /* Function min should have MIN_EXPR */
59 /* Function max should have MAX_EXPR */
60 /* { dg-final { scan-tree-dump-times "MIN_EXPR" 1 "optimized" } } */
61 /* { dg-final { scan-tree-dump-times "MAX_EXPR" 1 "optimized" } } */