1 /* A test for strength reduction and induction variable elimination. */
3 /* { dg-do compile } */
4 /* { dg-options "-O1 -fdump-tree-optimized" } */
5 /* { dg-require-effective-target size32plus } */
7 /* Size of this structure should be sufficiently weird so that no memory
8 addressing mode applies. */
23 for (iter
= 0; iter
< 100; iter
++)
24 arr_base
[iter
].y
= foo ();
27 /* Access to arr_base[iter].y should be strength reduced. Depending on
28 whether we have an addressing mode of type [base + offset], one of the
29 following forms might get chosen:
31 -- induction variable with base &arr_base[0].y, the memory access of
33 -- induction variable with base 0, the memory access of form
34 *(iv + &arr_base[0].y) = ...
36 In any case, we should not have any multiplication. */
38 /* { dg-final { scan-tree-dump-times " \\* \[^\\n\\r\]*=" 0 "optimized" } } */
39 /* { dg-final { scan-tree-dump-times "\[^\\n\\r\]*= \\* " 0 "optimized" } } */
40 /* { dg-final { scan-tree-dump-times "MEM" 1 "optimized" } } */
42 /* And the original induction variable should be eliminated. */
44 /* { dg-final { scan-tree-dump-times "iter" 0 "optimized" } } */
46 /* { dg-final { cleanup-tree-dump "optimized" } } */