aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/bitcmp-1.c
blob: f3d515bb2d65828892a57621424e67b3a2febf4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
/* PR tree-optimization/101590 */

int f_and_le(unsigned len) {
  const unsigned N = 4;
  unsigned newlen = len & -N;
  return newlen <= len; // return 1
}
int f_or_ge(unsigned len) {
  const unsigned N = 4;
  unsigned newlen = len | -N;
  return newlen >= len; // return 1
}

/* { dg-final { scan-tree-dump-not " <= " "optimized" } } */
/* { dg-final { scan-tree-dump-not " >= " "optimized" } } */
/* { dg-final { scan-tree-dump-not " & "  "optimized" } } */
/* { dg-final { scan-tree-dump-not " \\\| " "optimized" } } */
/* { dg-final { scan-tree-dump-times "return 1;" 2 "optimized" } } */