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

Trevor_Smigiel@PlayStation.Sony.Com Trevor_Smigiel@PlayStation.Sony.Com
Sat May 24 08:59:00 GMT 2008


Sa,

Your implementations of multi3 and udivmodti4 appear to be copied and
modified from libgcc2.c.  Can't we just build libgcc2.c to create TI
versions of its functions instead of creating copies of the code on SPU?

On the other hand, those implementations are too big and slow for SPU
anyway.  I would much rather have smaller and faster implementations.

Can you test the attached implementations of udivmodti4 and multi3 for
correctness?   If you verify they are correct, you can check them in
with your patch.  (Or I can check my parts in myself.)

This udivmodti4 is about 20% faster and 10x smaller.
This multi3 is about 500% faster and 1.5x smaller.

(The DI versions could be rewritten in a similar way, but the wins would
not be as big in those cases.)

Trevor


* Sa Liu <SALIU@de.ibm.com> [2008-05-20 07:10]:
> > Trevor_Smigiel@PlayStation.Sony.Com 
> > 05/08/2008 08:52 PM
> > 
> > To
> > 
> > Sa Liu/Germany/IBM@IBMDE
> > 
> > cc
> > 
> > Segher Boessenkool <segher@kernel.crashing.org>, 
> > Andrew_Pinski@PlayStation.Sony.Com, gcc-patches@gcc.gnu.org
> > 
> > Subject
> > 
> > Re: [PATCH, spu] add libgcc functions __multi3, __udivmodti4, etc
> > 
> > Use the si_from_*() and si_to_*() intrinsics.
> > 
> > static
> > unsigned int count_leading_zeros (UDItype x)
> > {
> >   qword c = si_clz (si_from_ullong (x));
> >   unsigned int h = si_to_uint (c);
> >   unsigned int l = si_to_uint (si_shlqbyi (c, 4));
> >   return (h == 32) ? 32 + l : h;
> > }
> 
> Thanks! I've changed the patch with this code. How about the rest of the 
> patch?
> 
> Sa
-------------- next part --------------
A non-text attachment was scrubbed...
Name: multi3b.c
Type: text/x-csrc
Size: 4046 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080524/304604a7/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: divmodti4b.c
Type: text/x-csrc
Size: 3273 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080524/304604a7/attachment-0001.bin>


More information about the Gcc-patches mailing list