PR testsuite/52641
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / slsr-8.c
blobe78e9c004bd20793b296c60ebbf6ed2f6a6f7685
1 /* Verify straight-line strength reduction for simple pointer subtraction. */
3 /* { dg-do compile } */
4 /* { dg-options "-O3 -fdump-tree-optimized" } */
6 int*
7 f (int s, int *c)
9 int a1, a2, a3, *x1, *x2, *x3;
11 a1 = 2 * s;
12 x1 = c - a1;
13 a2 = 4 * s;
14 x2 = c - a2;
15 a3 = 6 * s;
16 x3 = c - a3;
17 return x1 ? x2 : x3;
20 /* There are 4 ' * ' instances in the decls (since "int * iftmp.0;" is
21 added), 1 parm, 2 in the code. The second one in the code can be
22 a widening mult. */
23 /* { dg-final { scan-tree-dump-times " w?\\* " 7 "optimized" } } */
24 /* { dg-final { cleanup-tree-dump "optimized" } } */