| 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 |
/* These functions should return a op b */ |
| 22 |
int f8(int a, int b) |
| 23 |
{ |
| 24 |
return min (max (a, b), min (a, b)); |
| 25 |
} |
| 26 |
|
| 27 |
int f9(int a, int b) |
| 28 |
{ |
| 29 |
return max (min (a, b), max (a, b)); |
| 30 |
} |
| 31 |
|
| 32 |
/* Function min and f8 should have MIN_EXPR */ |
| 33 |
/* Function max and f9 should have MAX_EXPR */ |
| 34 |
/* { dg-final { scan-tree-dump-times "MIN_EXPR" 2 "optimized" } } */ |
| 35 |
/* { dg-final { scan-tree-dump-times "MAX_EXPR" 2 "optimized" } } */ |