OSDN Git Service

2007-07-06 Daniel Berlin <dberlin@dberlin.org>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / tree-ssa / loop-2.c
1 /* A test for strength reduction and induction variable elimination.  */
2
3 /* { dg-do compile } */
4 /* { dg-options "-O1 -fdump-tree-optimized" } */
5 /* { dg-require-effective-target size32plus } */
6
7 /* Size of this structure should be sufficiently weird so that no memory
8    addressing mode applies.  */
9
10 struct bla
11 {
12   char x[187];
13   int y;
14   char z[253];
15 } arr_base[100];
16
17 void xxx(void)
18 {
19   int iter;
20
21   for (iter = 0; iter < 100; iter++)
22     arr_base[iter].y = 17 * iter;
23 }
24
25 /* Access to arr_base[iter].y should be strength reduced, i.e., there should
26    be no multiplication.  */
27
28 /* { dg-final { scan-tree-dump-times " \\* \[^\\n\\r\]*=" 0 "optimized" } } */
29 /* { dg-final { scan-tree-dump-times "\[^\\n\\r\]*= \\* " 0 "optimized" } } */
30 /* { dg-final { scan-tree-dump-times "MEM" 1 "optimized" } } */
31
32 /* 17 * iter should be strength reduced.  */
33
34 /* { dg-final { scan-tree-dump-times " \\* 17" 0 "optimized" } } */
35 /* { dg-final { scan-tree-dump-times " \\+ 17" 1 "optimized" } } */
36
37 /* The induction variable comparison with 99 should be eliminated
38    and replaced by comparison of one of the newly created ivs.  */
39
40 /* { dg-final { scan-tree-dump-times "iter" 0 "optimized" } } */
41 /* { dg-final { scan-tree-dump-times "99" 0 "optimized" } } */
42 /* { dg-final { scan-tree-dump-times "100" 0 "optimized" } } */
43
44 /* { dg-final { cleanup-tree-dump "optimized" } } */