[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    Re: TARGET_NO_FANCY_MATH_387
From:       Bruce Evans <bde () zeta ! org ! au>
Date:       1996-05-31 17:32:57
[Download RAW message or body]

>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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic