ppc-linux gcc configury patch

Geoff Keating geoffk@ozemail.com.au
Wed Jun 30 23:15:00 GMT 1999


> Date: Fri, 4 Jun 1999 13:08:58 -0700
> From: Richard Henderson <rth@cygnus.com>
> Cc: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>,
>         egcs-patches@egcs.cygnus.com, geoffk@ozemail.com.au
> 
> On Fri, Jun 04, 1999 at 12:49:47PM -0600, Cort Dougan wrote:
> > I'm not willing to take a performance hit so AIX can add linux/ppc binary
> > support.  Aren't branches of that size rare, though?
> 
> Yes and no.
> 
> We attempt to map the libraries such that calls into them get to
> use `b', or more usually `ba', instead of `addis+addi+mtctr+bctr'.

It's the other way around.  Libraries are mapped so that calls to them
use 'b', or failing that 'ba', or failing that the sequence is
actually `li+b+addis+lwz+mtctr+bctr' in the usual case, for reasons
far too ugly to explain here (well, unless someone's interested)
having to do with thread-safety.  I count something like 6 extra
cycles for the third sequence compared to just 'b'.

The reason for preferring 'b' over 'ba' is that it's the more common
opcode, and therefore more likely to be fast, and because if the main
program can call libraries using 'b' then libraries can call the main
program using 'b' too.

> Thing is, I'm not sure how much we're losing because of the change.
> We have moved the base of the program up, but that has left more
> room in the bottom 26 bits for shared libraries, and so for calls
> into them to use `ba'.  I think the only place we lose is calls back
> into the main application, which is really very rare.
>
> It would be trivial to add a line to __elf_machine_fixup_plt to 
> collect some statistics on what's happening with real applications.



-- 
Geoffrey Keating <geoffk@ozemail.com.au>



More information about the Gcc-patches mailing list