Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Jun 1996 03:32:57 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        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:  <199605311732.DAA13967@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>And your last sentence says why it's not a Good Idea to change the
>default behavior. Also agreed, and I withdraw the suggestion. Too
>bad, though.  And I expect that just adding the same (no, similar,
>not the same, no GPL, no LGPL, I'm sorry) non-optimized software
>sqrt, sin, cos that are in the normal libm to the emulator would
>be not so good. Or maybe it would be good? Then changing the default
>might be a Good Idea. I'll restate the suggestion.

It would be reasonable, but not easy.  The software sqrt etc. want to
use ordinary FPU instructions, and the emulator only supports them for
user programs (nested traps to support kernel mode would be both hard
to implement and slow).

>Otherwise I guess it's a manual edit of the definitions and a make world.
>Or make the make world have a way to set the definitions in conjunction
>with the bsd.h file deep in gcc's bowels. Nahh, too kludgy.

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.

>Now for the cheap-shot, flame-bait, no-good comment: the reason that this
>came to my attention at all was to figure why a program ran so much faster
>on ... Linux. Ayeeee.

The non-FPU library has certainly been the default for too long.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199605311732.DAA13967>