Improving gcc for gmp

Kevin Ryde user42 at zip.com.au
Fri Mar 19 22:59:39 CET 2004


Torbjorn Granlund <tg at swox.com> writes:
>
> I'd like to see extensions of gcc to support __builtin_ constructs for
> at least umul_ppmm (or rather umul_high)

That'd be nice.  For the CISCs it'd want to be smart enough for CSE or
whatever to combine nearby low and high half muls into the relevant
one insn though.

> and count_leading_zeros.

That looks like it's on the way in the form of __builtin_clz.

Unfortunately it looks like it's going to be a libgcc call if there's
no native form, whereas we generally want it inlined.  On that basis
the plan will be to use the builtin only in selected configurations,
ie. when it comes out good.

There has been __builtin_ffs doing trailing zeros for some time, but
it gives 0 if x==0, which is extra code, so I'd never done anything
about using it.  The new __builtin_ctz will be what we want.


More information about the gmp-devel mailing list