[PATCH] Improve integer division on IA-64

Richard Henderson rth@redhat.com
Thu Dec 22 22:36:00 GMT 2005


On Mon, Dec 19, 2005 at 05:19:09PM -0700, Roger Sayle wrote:
> In the patch below, __divdi3 and __divsi3 are tweaked to make optimal
> use of these pipeline stalls, by providing special-case fast paths for
> many operations.  The main fast path is to handle division by powers
> of two using shift operations.  Additionally, we also check whether
> both operands are the same, and if so return one; and also if the
> numerator is not negative and less than the divisior, return zero.

How did you determine that x/x=1 and x/y=0 are common cases?

Sometime last year I played with division routines on Alpha,
and used an LD_PRELOAD library to force the entire system to
log every division operation for a couple of days.

Unfortunately, I no longer have the raw data, but I remember
that x [%/] 10 and x % pow2 were the only special cases worth
looking at.  The former, x/10, made up like a third of all
division operations.

> If someone could confirm/double check that registers r16 and r17
> are call saved on all of GCC's IA-64 targets...

Those are fine.


r~



More information about the Gcc-patches mailing list