Code optimization <LEA Instruction>

Jamie Lokier lkd en tantalophile.demon.co.uk
Dom Ene 30 10:48:27 CST 2000


Jeffrey B. Siegal wrote:
> > On Crusoe I guess the cost of redundant instructions is not so
> > significant once they've been through a translation pass, but for those
> > instruction streams getting interpreted, and for the speed of
> > translation itself, it still makes sense to keep the number of
> > instructions (and their size) to a minimum.
> 
> Which, interestingly, suggests that -Os (or something like it) is what you
> want.

Not necessarily.  The smallest instructions tend to be more complicated
and expand to more basic operations, so decoding cost _may_ be reduced,
but the next step in translation, and the area used in the cache, and
the execution time, may be longer.

> On the other hand, inlining, as a tradeoff of size for speed, might actually
> be bad (the out-of-line function can get translated once, but inline it needs
> to get translated at each call-site).

That's one of the wonders of dynamic profiling.  (Which, btw, you can
do at a bounded arbitrarily low cost if you're prepared to forget about
caches ;-)  You decide when to inline based on whether its worth it in
each situation.

-- Jamie

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo en vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



Más información sobre la lista de distribución Ayuda