1 /* { dg-do compile } */
2 /* { dg-options "-O1 -fdump-tree-optimized" } */
3 /* { dg-additional-options "-mbranch-cost=2" { target branch_cost } } */
4
f(int a,int b,int c)5 int f(int a, int b, int c)
6 {
7 if (a == 0 && b > c)
8 return 0;
9 return a;
10 }
11
g(int a,int b,int c)12 int g(int a, int b, int c)
13 {
14 if (a == 42 && b > c)
15 return 42;
16 return a;
17 }
18
h(int a,int b,int c,int d)19 int h(int a, int b, int c, int d)
20 {
21 if (a == d && b > c)
22 return d;
23 return a;
24 }
25
26 /* { dg-final { scan-tree-dump-times "if" 0 "optimized" { target { ! logical_op_short_circuit } } } } */
27 /* { dg-final { scan-tree-dump-times "if" 2 "optimized" { target logical_op_short_circuit } } } */
28