aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/cond-1.c
blob: 478a818b20652b5fc8f4e2ee63d6ef0ca3821e7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* { dg-do compile } */
/* { dg-options "-O -fdump-tree-optimized-raw" } */

int sub(int a, int b, int c, int d) {
  int e = (a == 0);
  int f = !e;
  c = b;
  d = b - a ;
  return ((-e & c) | (-f & d));
}

/* In the end we end up with `(a == 0) ? (b - a) : b`
   which then can be optimized to just `(b - a)`. */

/* { dg-final { scan-tree-dump-not "cond_expr," "optimized" } } */
/* { dg-final { scan-tree-dump-not "eq_expr," "optimized" } } */
/* { dg-final { scan-tree-dump-times "minus_expr," 1 "optimized" } } */