svn commit: r213308 - in head/lib/libc: amd64/gen i386/gen

Bruce Evans brde at optusnet.com.au
Thu Sep 30 22:17:12 UTC 2010


On Thu, 30 Sep 2010, Dimitry Andric wrote:

> Log:
>  Retire the amd64 and i386 specific inline assembly versions of ldexp.c,
>  as they are slower than the generic version in C, at least on modern
>  hardware.  This leaves us with just five implementations.
>
>  Suggested by:	bde
>  Approved by:	rpaulo (mentor)

Thanks.

I suppose it has had enough testing.  I just tested it on a Celeron 366
(late 90's P2 arch).  The C version is faster there too:

libc asm ldexp:  1.98 seconds
libm asm scalbn: 1.91
libm C   scalbn: 1.84

While there, I noticed that the libm asm scalbn is still using RCSID(),
like many of the older libm asm functions.  This is not just a style
bug.  RCSID() and __RCSID() are compatibility cruft that should never
be used.  The RCSID() in i386/include/asm.h is especially bad.  It
bloats the text section with $FreeBSD$ strings using ".text; .asciz...".
__FBSDID() normally uses .ident which normally puts the strings in a
better place.

Are there only 5 implementations left? :-)  arm is the only arch that
still has one in libc.  amd64 are i386 the only arches that have asm
versions of scalbn in libm.  They are there for float and long double
precision too.  This is especially silly for float precision since the
integer versions are especially easy to make efficient for float
precision.  OTOH, long double precision is probably still faster in
asm.  There are also silly scalbln* interfaces (taking a long for the
exponent).  These are only implemented in C (as wrappers).

Bruce



Bruce


More information about the svn-src-head mailing list