| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O1 -fno-tree-reassoc -fdump-tree-optimized" } */ |
| 3 |
|
| 4 |
|
| 5 |
#define MAX(a,b) (a)>=(b) ? (a) : (b) |
| 6 |
|
| 7 |
#define MIN(a,b) (a)<=(b) ? (a) : (b) |
| 8 |
|
| 9 |
int test1(int a, int b) |
| 10 |
{ |
| 11 |
int d = MAX(a,b); |
| 12 |
return MAX(a,d); |
| 13 |
} |
| 14 |
int test2(int a, int b) |
| 15 |
{ |
| 16 |
int d = MIN(a,b); |
| 17 |
return MIN(a,d); |
| 18 |
} |
| 19 |
|
| 20 |
/* We should be optimize these two functions even without reassociation. */ |
| 21 |
/* { dg-final { scan-tree-dump-times "MAX_EXPR " 1 "optimized"} } */ |
| 22 |
/* { dg-final { scan-tree-dump-times "MIN_EXPR " 1 "optimized"} } */ |