1 /* Verify straight-line strength reduction for multiply candidates
2 with variable stride and control flow. */
3
4 /* { dg-do compile } */
5 /* { dg-options "-O3 -fdump-tree-optimized" } */
6
7 int
f(int n,int x,int stride)8 f (int n, int x, int stride)
9 {
10 int a, x1, x2, x3;
11
12 a = x * stride;
13 x1 = x + 3;
14 a += x1 * stride;
15
16 if (n > 64)
17 {
18 x2 = x1 + 3;
19 a += x2 * stride;
20 x3 = x2 + 3;
21 a += x3 * stride;
22 }
23
24 return a;
25 }
26
27 /* { dg-final { scan-tree-dump-times " \\* stride" 1 "optimized" } } */
28 /* { dg-final { scan-tree-dump-times " \\* 3" 1 "optimized" } } */
29