OSDN Git Service

gcc/testsuite/
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / tree-ssa / loop-3.c
1 /* A test for strength reduction and induction variable elimination.
2    Target is restricted to x86 type architectures, so that we may
3    assume something about memory addressing modes.  */
4
5 /* { dg-do compile { target i?86-*-* x86_64-*-* } } */
6 /* { dg-skip-if "" { i?86-*-* x86_64-*-* } { "-fpic" "-fPIC" } { "" } } */
7 /* { dg-options "-O1 -fno-pic -fno-PIC -fdump-tree-optimized" } */
8
9 int arr_base[100];
10
11 int foo(int);
12
13 void xxx(void)
14 {
15   long iter;
16
17   for (iter = 0; iter < 100; iter++)
18     arr_base[iter] = foo (iter);
19 }
20
21 /* Access to arr_base[iter].y should not be strength reduced, since
22    we have a memory mode including multiplication by 4.  */
23
24 /* { dg-final { scan-tree-dump-times "MEM" 1 "optimized" } } */
25 /* { dg-final { scan-tree-dump-times "step:" 1 "optimized" } } */
26
27 /* And original induction variable should be preserved.  */
28
29 /* { dg-final { scan-tree-dump-times "int iter" 1 "optimized" } } */
30
31 /* { dg-final { cleanup-tree-dump "optimized" } } */