aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/slsr-8.c
blob: e78e9c004bd20793b296c60ebbf6ed2f6a6f7685 (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
/* Verify straight-line strength reduction for simple pointer subtraction.  */

/* { dg-do compile } */
/* { dg-options "-O3 -fdump-tree-optimized" } */

int*
f (int s, int *c)
{
  int a1, a2, a3, *x1, *x2, *x3;

  a1 = 2 * s;
  x1 = c - a1;
  a2 = 4 * s;
  x2 = c - a2;
  a3 = 6 * s;
  x3 = c - a3;
  return x1 ? x2 : x3;
}

/* There are 4 ' * ' instances in the decls (since "int * iftmp.0;" is
   added), 1 parm, 2 in the code.  The second one in the code can be
   a widening mult.  */
/* { dg-final { scan-tree-dump-times " w?\\* " 7 "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */