Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!caen!ox.com!emv From: mckim@snuffy.lerc.nasa.gov (Jim McKim) Newsgroups: comp.archives Subject: [sysv386] inline 387 math functions Message-ID: <1991Mar6.012345.14594@ox.com> Date: 6 Mar 91 01:23:45 GMT References: <1991Mar4.192259.6531@eagle.lerc.nasa.gov> Sender: emv@ox.com (Edward Vielmetti) Reply-To: mckim@snuffy.lerc.nasa.gov (Jim McKim) Followup-To: comp.unix.sysv386 Organization: NASA/Lewis Research Center, Cleveland Lines: 39 Approved: emv@ox.com (Edward Vielmetti) X-Original-Newsgroups: comp.unix.sysv386 Archive-name: gnu/gcc/387-gcc-math-inline/1991-03-04 Archive: mildred.lerc.nasa.gov:/pub/unix386.gnu/math_inline.h [139.88.30.61] Original-posting-by: mckim@snuffy.lerc.nasa.gov (Jim McKim) Original-subject: inline 387 math functions Reposted-by: emv@ox.com (Edward Vielmetti) 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@snuffy.lerc.nasa.gov k-crash Phone: +1 216 891 2982 / Packet: kb8dcr@kb8dcr.ampr.org is coming! ----------------