summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/andor-5.c
blob: 15097272a1d3614e8d694cd74d47ce30f8d7a223 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */

int f(int y, int x)
{
  int a = x | y;
  return a & x;
}
int f1(int y, int x)
{
  int a = y | x;
  return a & x;
}
int f2(int y, int x)
{
  int a = x | y;
  return x & a;
}
int f3(int y, int x)
{
  int a = x | y;
  return x & a;
}
int f4(int y, int x)
{
  int a = x & y;
  return a | x;
}
int f5(int y, int x)
{
  int a = y & x;
  return a | x;
}
int f6(int y, int x)
{
  int a = x & y;
  return x | a;
}
int f7(int y, int x)
{
  int a = x & y;
  return x | a;
}
/* These all should be optimized to just return x; */


/* { dg-final { scan-tree-dump-times "\\\|" 0 "optimized" } } */
/* { dg-final { scan-tree-dump-times "\&" 0 "optimized" } } */
/* { dg-final { scan-tree-dump-times "return x_..D.;" 8 "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */