summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/fold-xorand-1.c
blob: 8d4265417c9ed9c7ae0f6ee8c4d76e852150f215 (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
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-original" } */

int test1(int a, int b)
{
  return (a & b) ^ a;
}

int test2(int c, int d)
{
  return (c & d) ^ d;
}

int test3(int e, int f)
{
  return e ^ (e & f);
}

int test4(int g, int h)
{
  return g ^ (h & g);
}

/* { dg-final { scan-tree-dump-times "~b \& a" 1 "original" } } */
/* { dg-final { scan-tree-dump-times "~c \& d" 1 "original" } } */
/* { dg-final { scan-tree-dump-times "~f \& e" 1 "original" } } */
/* { dg-final { scan-tree-dump-times "~h \& g" 1 "original" } } */
/* { dg-final { cleanup-tree-dump "original" } } */