summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/fold-even-1.c
blob: 94711ab1499e0606d464a90b2ef9f5de21e54729 (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-original" } */
int test1(int a)
{
  return !(a & 1);
}

int test2(int b)
{
  return (b & 1) == 0;
}

int test3(int c)
{
  return (c & 1) ^ 1;
}

int test4(int d)
{
  return (d ^ 1) & 1;
}

int test5(int e)
{
  return ~e & 1;
}

/* { dg-final { scan-tree-dump-times "\\(a \& 1\\) == 0" 1 "original" } } */
/* { dg-final { scan-tree-dump-times "\\(b \& 1\\) == 0" 1 "original" } } */
/* { dg-final { scan-tree-dump-times "\\(c \& 1\\) == 0" 1 "original" } } */
/* { dg-final { scan-tree-dump-times "\\(d \& 1\\) == 0" 1 "original" } } */
/* { dg-final { scan-tree-dump-times "\\(e \& 1\\) == 0" 1 "original" } } */