Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Jun 1996 14:27:12 -0700 (PDT)
From:      Jake Hamby <jehamby@lightside.com>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        bde@zeta.org.au, freebsd-hackers@FreeBSD.org, mrm@MARMOT.Mole.ORG, mrm@MARMOT.Mole.ORG
Subject:   Re: TARGET_NO_FANCY_MATH_387
Message-ID:  <Pine.AUX.3.91.960602142259.20289C-100000@covina.lightside.com>
In-Reply-To: <199605311732.DAA13967@godzilla.zeta.org.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 1 Jun 1996, Bruce Evans wrote:

> Making a new libm with HAVE_FPU set in /etc/make.conf should be sufficient.
> This isn't the default since it has the same problems as -mfancy-math-i387.
> 
> User times for 1e6 fsqrt(2.0)'s on a P133:
> 
> 	default libm (shared):		11.65 seconds
> 	HAVE_FPU libm (shared):		 1.18
> 	HAVE_FPU libm (static):		 1.11
> 	-mfancy-math-387:		 0.68
> 	home made inline fsqrt:		 0.64	# (1)
> 	-mfancy-math-387 -ffast-math:	 0.07	# (2)
> 
> (1) Another reason for gcc not to inline things is that it's easy to write
>     your own inline functions.
> (2) fsqrt(2.0) is recognized as a loop invariant and only calculated once.
>     The time is just for counting to 1e6.

Those performance gains are substantial!  Although I don't do anything
math-intensive with FreeBSD, I still wish I had known about HAVE_FPU
earlier.  This _really_ needs to be a FAQ or even mentioned during
sysinstall.  Therefore, I suggest we build two different versions of libm,
and have sysinstall link to the correct one depending on whether the user
has a math coprocessor or not (we could ask, or possibly probe the system
for this information).  Eventually, we can do a similar thing with
Pentium-optimized versions of this and libc (bcopy, bzero, etc).  
Comments?

---Jake




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.AUX.3.91.960602142259.20289C-100000>