aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/cmpeq-2.c
blob: c727b9e7143d5fe7d9e846d759e8543406a0485d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized-raw" } */
/* PR tree-optimization/109959 */

unsigned f(unsigned a)
{
  if (a <= 1)
    return a;
  return 0;
}

unsigned f0(unsigned a)
{
  if (a > 1)
    return 0;
  return a;
}

_Bool fb(unsigned a)
{
  if (a > 1)
    return 0;
  return a == 1;
}

/* These all should be optimized to `a == 1` */
/* { dg-final { scan-tree-dump-times "eq_expr," 3 "optimized"} } */
/* { dg-final { scan-tree-dump-not "le_expr," "optimized"} } */
/* { dg-final { scan-tree-dump-not "bit_and," "optimized"} } */
/* { dg-final { scan-tree-dump-not "gimple_phi " "optimized"} } */