This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Change gcc.dg/tree-ssa/loop-4.c outcome


Hello,

the loop-4.c test checks whether a strength reduction is performed;
concretely whether

for (i = 0;; i++)
  a[i] = ...;

is transformed to

for (p = &a[0];; p += sizeof (a[0]))
  *p = ...;

The problem is that on some architectures it is equally profitable
to use

for (p = 0;; p += sizeof (a[0]))
  *(&a[0] + p) = ...;

instead.  This patch updates the outcome of the test to reflect this
(thus making the test pass on x86_64 and ia64).

Zdenek

Index: testsuite/gcc.dg/tree-ssa/loop-4.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/tree-ssa/loop-4.c,v
retrieving revision 1.2
diff -c -3 -p -r1.2 loop-4.c
*** testsuite/gcc.dg/tree-ssa/loop-4.c	25 Sep 2004 20:53:44 -0000	1.2
--- testsuite/gcc.dg/tree-ssa/loop-4.c	9 Jan 2005 08:42:31 -0000
*************** void xxx(void)
*** 23,31 ****
      arr_base[iter].y = foo ();
  }
  
! /* Access to arr_base[iter].y should be strength reduced.  */
  
! /* { dg-final { scan-tree-dump-times "arr_base\[^\\n\\r\]*=" 0 "vars" } } */
  
  /* And the original induction variable should be eliminated.  */
  
--- 23,40 ----
      arr_base[iter].y = foo ();
  }
  
! /* Access to arr_base[iter].y should be strength reduced.  Depending on
!    whether we have an addressing mode of type [base + offset], one of the
!    following forms might get chosen:
  
!    -- induction variable with base &arr_base[0].y, the memory access of
!       form *iv = ...
!    -- induction variable with base 0, the memory access of form
!       *(iv + &arr_base[0].y) = ...
! 
!    In any case, we should not have 'arr_base.[^0].* ='  */
! 
! /* { dg-final { scan-tree-dump-times "arr_base.\[^0\]\[^\\n\\r\]*=" 0 "vars" } } */
  
  /* And the original induction variable should be eliminated.  */
  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]