]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/tree-ssa/slsr-8.c
Fix profile update in tree_transform_and_unroll_loop
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / slsr-8.c
1 /* Verify straight-line strength reduction for simple pointer subtraction. */
2
3 /* { dg-do compile } */
4 /* { dg-options "-O3 -fdump-tree-optimized" } */
5
6 int*
7 f (int s, int *c, int *d)
8 {
9 int a1, a2, a3, *x1, *x2, *x3;
10
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 == d ? x2 : x3;
18 }
19
20 /* Note that since some branch prediction heuristics changed, the
21 calculations of x2 and x3 are pushed downward into the legs
22 of the conditional, changing the code presented to SLSR.
23 However, this proves to be a useful test for introducing an
24 initializer with a cast, so we'll keep it as is. */
25
26 /* There are 5 ' * ' instances in the decls (since "int * iftmp.0;" is
27 added), 2 parms, 3 in the code, and the return value. The second one
28 in the code may be a widening multiply (for example, on AArch64). */
29 /* { dg-final { scan-tree-dump-times " w?\\* " 10 "optimized" } } */