On Thu, Jan 17, 2008 at 05:48:10PM +0300, Sergei Poselenov wrote:
> Hello Andrew,
> 
> Andrew Haley wrote:
> >Sergei Poselenov writes:
> > > Hello Andrew,
> > > 
> > > > Now, I sympathize that in your particular case you have a code size
> > > > regression.  This happens: when we do optimization in gcc, some code
> > > > bases will lose out.  All that we can promise is that we try not to
> > > > make it worse for most users.
> > > > 
> > > > What we can do is compare your code that has got much worse, and try
> > > > to figure out why.
> > > > 
> > > 
> > > Would the generated asm listings be enough? Or should I send
> > > the preprocessed sources as well?
> >
> >Both.
> >
> >Rather than sending stuff, best to stick it on a web site if you can.
> >
> 
> Here it is:
> Preprocessed and assembler code generated by the GCC 4.2.2 ppc-linux
> cross-compiler:
> http://www.emcraft.com/codesize/gcc-4.2.2/interrupts.i
> http://www.emcraft.com/codesize/gcc-4.2.2/interrupts.s
> 
> The same code built with gcc-4.0.0 cross-compiler:
> http://www.emcraft.com/codesize/gcc-4.0.0/interrupts.i
> http://www.emcraft.com/codesize/gcc-4.0.0/interrupts.s
> 

The functions do not appear in the same order in both files, it's a
bit surprising! Anyway look for example at irq_install_handler:

- gcc-4.0 saves all registers using stmw r24,xx(r1) and restores them
with lmw r24,xx(r1) however this means that r29 is overwritten in 
the epilogue.

- gcc-4.2.2 saves and restores registers individually which
means that it takes 12 more instructions. There go 48 bytes.

This is especially visible in the epilogue (in the prologue
the saves are interspersed with other instructions).

In this case -ffixed-r29 hurts, but gcc4.2.2 looks more correct.

        Regards,
        Gabriel

Reply via email to