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

unsigned int f (unsigned int a0, unsigned int a1, unsigned int a2,
		unsigned int a3, unsigned int a4) 
{ 
  unsigned int b0, b1, b2, b3, b4, e; 
  /* this can be optimized to four additions... */ 
  b4 = a4 + a3 + a2 + a1 + a0; 
  b3 = a3 + a2 + a1 + a0; 
  b2 = a2 + a1 + a0; 
  b1 = a1 + a0; 
  /* This is actually 0 */
  e = b4 - b3 + b2 - b1 - a4 - a2;
  return e;
}

/* { dg-final { scan-tree-dump-times "return 0" 1 "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */