float library

Kai Ruottu kai.ruottu@luukku.com
Fri May 24 03:33:00 GMT 2002

dnt ly wrote:
>       I have test float library in ARM gcc, but it is very slow, will
> anyone tell me how to improve it or how to overwrite the gcc's default
> float library with a new one.

 Let's hope you mean the 'basic soft float routines' coming with GCC, not
the 'float library' ('libm.a') coming with 'newlib' or 'glibc'... Sometimes
people don't exactly mean what they write ;-)

 The 'ieeelib.c' donated to GNU by Swedish SWOX Ab (or something) perhaps
in 1999 could be quicker. The donators claimed it to be 5 times quicker on
m68k than the default soft-float routines in GCC.  I tested it with the
Hitachi H8/300[HS] and got the IAR's float-test program running two times
quicker with H8/300H and H8S in the equipped simulator (in Insight/GDB).
However the commercial IAR-H8/300-routines produced using assembly still
were 5 times quicker (with their compiler) if the IAR docs were right...

 Before it worked with H8/300, the 'ieeelib.c' package needed some fixes,
so I would expect ARM needing too... Anyway this could be one possible
route to start with a new quicker soft-float implementation.

 The used float package is defined in the 'gcc/config/<cpu_target>/t-*'
target-makefile fragments, for instance 'gcc/config/arm/t-elf' or something
for 'arm-elf'. The default is the 'fp-bit.c/dp-bit.c'-pair for floats/doubles.
Substituting the definitions for 'fp-bit.c' and 'dp-bit.c' with something else,
the package will be changed. For instance in the 'gcc/config/h8300/t-h8300'

------------------------- clip ---------------------------------------
LIB2FUNCS_EXTRA = sfieeelib.c

# Compile SFmode routines
sfieeelib.c: $(srcdir)/config/h8300/ieeelib.c
	echo '#define COMPUTE_TYPE unsigned long'	>sfieeelib.c
	echo '#define COMPUTE_STYPE signed long'	>>sfieeelib.c
	echo '#define COMPUTE_TYPE_BITS 32'		>>sfieeelib.c
	echo '#define MANTISSA_NWORDS 1'		>>sfieeelib.c
	echo '#define MANTISSA_BITS 24'			>>sfieeelib.c
	echo '#define EXP_BITS 8'			>>sfieeelib.c
	echo '#define SFmode'				>>sfieeelib.c
	echo '#define MSB_IMPLICIT true'		>>sfieeelib.c
	echo '#define FLOAT_WORDS_BIG_ENDIAN'		>>sfieeelib.c
	echo '#define COUNT_LEADING_ZEROS_NEED_CLZ_TAB'	>>sfieeelib.c
	cat $(srcdir)/config/h8300/ieeelib.c 		>>sfieeelib.c
------------------------- clip ---------------------------------------

 I can email the 'ieeelib.c' separately to you, but it should be available
with the 'announce' information etc. somewhere in the 'gcc-patches' archives
from 1999. I couldn't find the 'howto-instructions' for it just now, somehow
I have succeeded to archive them too well. I will try to find it again...

Cheers, Kai

Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com

More information about the crossgcc mailing list