inline 387 math functions

Jim McKim mckim at snuffy.lerc.nasa.gov
Tue Mar 5 05:22:59 AEST 1991


I adapted some of Glenn Geers' fpu math library to work with the gcc
inline facility.

A quick and dirty, unscientific test of some of the routines showed a
5..8% increase in speed over the corresponding fpu library ones.

I didn't adapt all the assembly source routines - many of them weren't
appropriate for this type of treatment.  Smaller routines with fast
math vs. function call overhead comprised most of the candidates.

The GNU C compiler has a way of letting developers supply additional
information to the compiler with inline assembly that enables the
compiler to treat the inline code as compiler generated code when
doing optimization (well - some at least).

The difficulty of loading and storing to most of the 387's registers
make instances of good optimization not so common.  Still, the
compiler doesn't have to assume the fpu gets clobbered over these
inline function calls.

I will be applying the same techniques to a 680x0 math library used
here (an easier to use model).

This code hasn't been well tested - caveats!

I put the source (pub/unix386.gnu/math_inline.h) here
(mildred.lerc.nasa.gov) for ftp if anybody else wants to fool around
with it.
--
----------------
Jim McKim  /  Internet: mckim at snuffy.lerc.nasa.gov		k-crash
Phone: +1 216 891 2982  /  Packet: kb8dcr at kb8dcr.ampr.org	is coming!
----------------



More information about the Comp.unix.sysv386 mailing list