OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [gcc.dg/] [tree-ssa/] [loop-4.c] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
/* A test for strength reduction and induction variable elimination.  */
2
 
3
/* { dg-do compile } */
4
/* { dg-options "-O1 -fdump-tree-vars" } */
5
 
6
/* Size of this structure should be sufficiently weird so that no memory
7
   addressing mode applies.  */
8
 
9
struct bla
10
{
11
  char x[187];
12
  int y;
13
  char z[253];
14
} arr_base[100];
15
 
16
int foo(void);
17
 
18
void xxx(void)
19
{
20
  int iter;
21
 
22
  for (iter = 0; iter < 100; iter++)
23
    arr_base[iter].y = foo ();
24
}
25
 
26
/* Access to arr_base[iter].y should be strength reduced.  Depending on
27
   whether we have an addressing mode of type [base + offset], one of the
28
   following forms might get chosen:
29
 
30
   -- induction variable with base &arr_base[0].y, the memory access of
31
      form *iv = ...
32
   -- induction variable with base 0, the memory access of form
33
      *(iv + &arr_base[0].y) = ...
34
 
35
   In any case, we should not have any multiplication.  */
36
 
37
/* { dg-final { scan-tree-dump-times " \\* \[^\\n\\r\]*=" 0 "vars" } } */
38
/* { dg-final { scan-tree-dump-times "\[^\\n\\r\]*= \\* " 0 "vars" } } */
39
/* { dg-final { scan-tree-dump-times "MEM" 1 "vars" } } */
40
 
41
/* And the original induction variable should be eliminated.  */
42
 
43
/* { dg-final { scan-tree-dump-times "iter" 0 "vars" } } */
44
 
45
/* { dg-final { cleanup-tree-dump "vars" } } */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.