This is the mail archive of the
mailing list for the GCC project.
Re: PTR-PLUS merge into the mainline
On 7/5/07, Roman Zippel <firstname.lastname@example.org> wrote:
On Thu, 5 Jul 2007, Richard Guenther wrote:
> For me both canonicalizations generate
> movl 8(%ecx,%edx,4), %eax
> addl 4(%ecx,%edx,4), %eax
Hmm, there seem to be other problems in this area as well.
Either add a "p[i + 3]" to it to fool combine or try this:
Combine is not going to help here anyways since rtl forwprop does the
address selection now :).
Anyways you need to do both:
void foo(int *p, unsigned int i)
p[i + 1] = g();
p[i + 2] = g();
p[i + 3] = g();
With that we get:
movl %eax, 4(%esi,%ebx,4)
sall $2, %ebx
movl %eax, 8(%ebx,%esi)
movl %eax, 12(%ebx,%esi)
Which is worse. Now if we had returned i*sizeof(int), it would not be
worse at all because the shift would still be required.