aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr94234-2.c
blob: 1f4b194dd43c8ec0bf1783b2cab3c60fb61e1db1 (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
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-forwprop1" } */ 

int use_fn (int a);

int foo (int n)
{
  int b1 = 8 * (n + 1);
  int b2 = 8 * n;

  use_fn (b1 ^ b2);

  return b1 - b2;
}

unsigned goo (unsigned m_param, unsigned n_param)
{
  unsigned b1 = m_param * (n_param + 2);
  unsigned b2 = m_param * (n_param + 1);

  use_fn (b1 ^ b2);

  return b1 - b2;
}

unsigned hoo (unsigned k_param)
{
  unsigned b1 = k_param * 28;
  unsigned b2 = k_param * 15;
  unsigned b3 = k_param * 12;

  use_fn (b1 ^ b2 ^ b3);

  return (b1 - b2) - b3;
}

/* { dg-final { scan-tree-dump-times "return 8;" 1 "forwprop1" } } */
/* { dg-final { scan-tree-dump-times "return m_param" 1 "forwprop1" } } */
/* { dg-final { scan-tree-dump-not "return k_param" "forwprop1" } } */