aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/minmax-23.c
blob: 0b7e51bb97ee607d3e74c3259794e23b4ec0122b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* { dg-do compile } */
/* { dg-options "-O1 -fno-tree-reassoc -fdump-tree-optimized" } */


#define MAX(a,b) (a)>=(b) ? (a) : (b)

#define MIN(a,b) (a)<=(b) ? (a) : (b)

int test1(int a, int b)
{
  int d = MAX(a,b);
  return MAX(a,d);
}
int test2(int a, int b)
{
  int d = MIN(a,b);
  return MIN(a,d);
}

/* We should be optimize these two functions even without reassociation. */
/* { dg-final { scan-tree-dump-times "MAX_EXPR " 1 "optimized"} } */
/* { dg-final { scan-tree-dump-times "MIN_EXPR " 1 "optimized"} } */