aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/cmpeq-1.c
blob: 1d5b960b663da4723bfc31e6b896eaa974a45eb1 (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
33
34
35
36
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized-raw" } */
/* PR tree-optimization/109959 */

unsigned fu(unsigned a)
{
        _Bool t = a <= 1;
        return t & a;
}

_Bool fb(unsigned a)
{
        _Bool t = a <= 1;
        return t & a;
}

_Bool fb1(unsigned a)
{
        _Bool t = a <= 1;
        _Bool t1 = a;
        return t & t1;
}

signed fui(unsigned a)
{
        _Bool t = a <= 1;
        int ai = a;
        return t & ai;
}

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