This is the mail archive of the gcc@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]

Re: missed optimization, would be very helpful


On Thu, Dec 31, 1998 at 03:32:06PM -0500, Zack Weinberg wrote:
> In a loop of the form

void foo(int *int_ptr, int x, int y)
{
  while (x < y) (*int_ptr)++, x++;
}

> This is egcs-1.1.1; it might've been fixed more recently but I can't test
> that since the Dec 24 CVS is unreliable on my system.

It has been, thanks to Mark Mitchell.  We now get this:

        ldl $2,0($16)
        .align 4
$L5:
        addq $2,1,$3
        addl $17,1,$17
        bis $3,$3,$2
        cmplt $17,$18,$1
        bne $1,$L5
        stl $3,0($16)

Which, now that I look at it, isn't quite ideal, but the bits that
normally fix up this kind of thing -- cse or cprop -- run before
this gets created.

Still, it's a lot better than a load/store pair in the loop.


r~


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