1 /* x2 and x3 will be strength-reduced based on the same statement
2 but with different variables as the stride. Note that they will
3 be strength-reduced by introducing an initializer 4*s which is
4 cheaper than 5*s; similar for 4*c and 5*c. */
5
6 /* { dg-do compile } */
7 /* { dg-options "-O3 -fdump-tree-optimized" } */
8
9 int
f(int s,int c)10 f (int s, int c)
11 {
12 int a2, a3, x1, x2, x3, x;
13
14 x1 = c + s;
15 a2 = 5 * s;
16 x2 = c + a2;
17 a3 = 5 * c;
18 x3 = s + a3;
19 x = x1 + x2 + x3;
20 return x;
21 }
22
23 /* { dg-final { scan-tree-dump-times " \\* 4" 2 "optimized" } } */
24 /* { dg-final { scan-tree-dump-times " \\* 5" 0 "optimized" } } */
25