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


Zack Weinberg <zack@rabi.columbia.edu> said:
> On Fri, 1 Jan 1999 04:24:36 +0100, 043633786-0001@t-online.de wrote:
> >On Thu, Dec 31, 1998 at 11:03:25PM -0400, Horst von Brand wrote:
> >> f(char *p, int *ip)
> >> { 
> >>    while(*p++)
> >>      (*ip)++;
> >> }
> >
> >Do you want this to become something like
> >
> >	movl (%ecx),%esi (well, take anything for %esi)
> >.L5:
> >	incl %esi
> >	movb (%edx),%al
> >	incl %edx
> >	testb %al,%al
> >	jne .L5
> >	movl %esi,(%ecx)
> >
> >?

> That's the right general idea.

And for a similar case (a global whose address I put into a local int *ip)
it does something like the above, after somebody poined out that the
acceses through parameter ip could cause side effects. Sorry, my machine +
testcase are at home.
-- 
Dr. Horst H. von Brand                       mailto:vonbrand@inf.utfsm.cl
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513


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