------- 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