This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/24669] Loop index variable has offset of 1
- From: "uros at kss-loka dot si" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Nov 2005 12:19:20 -0000
- Subject: [Bug tree-optimization/24669] Loop index variable has offset of 1
- References: <bug-24669-1649@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from uros at kss-loka dot si 2005-11-04 12:19 -------
Following patch to ix86_address_cost:
--- i386.c (revision 106482)
+++ i386.c (working copy)
@@ -5396,8 +5396,12 @@
if (parts.index && GET_CODE (parts.index) == SUBREG)
parts.index = SUBREG_REG (parts.index);
+ /* Penalize displacements a bit. */
+ if (parts.disp && parts.disp != const0_rtx)
+ cost++;
+
/* More complex memory references are better. */
- if (parts.disp && parts.disp != const0_rtx)
+ if (parts.scale)
cost--;
if (parts.seg != SEG_DEFAULT)
cost--;
generates:
pushl %ebx
movl 8(%esp), %ebx
movl 12(%esp), %ecx
xorl %edx, %edx
.L2:
movl (%ebx,%edx,4), %eax
movl %eax, (%ecx,%edx,4)
addl $1, %edx
cmpl $4, %edx
jne .L2
popl %ebx
ret
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24669