[PATCH, spu] add libgcc functions __multi3, __udivmodti4, etc

Segher Boessenkool segher@kernel.crashing.org
Thu May 8 04:32:00 GMT 2008


> I changed the function as following:
>
> static
> unsigned int count_leading_zeros(UDItype x)
> {
>     int leading;
>     leading = W_TYPE_SIZE;
>     if (x > ((UDItype)1 << W_TYPE_SIZE))

 >=, not >

>      {
>        x = (UDItype)x >> W_TYPE_SIZE;

x is already type UDItype, no need for the cast.

>        leading = 0;
>      }
>     return si_clz(x) + leading;
> }

Btw, I think it's more efficient to take the clz of both halves
always, and work from that.  But you'll have to benchmark that,
don't take my word for it.


Segher



More information about the Gcc-patches mailing list