Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Aug 2007 17:20:08 GMT
From:      Bruce Evans <brde@optusnet.com.au>
To:        freebsd-amd64@FreeBSD.org
Subject:   Re: amd64/115581: [patch] -mfancy-math-387 has no effect
Message-ID:  <200708211720.l7LHK8F9008565@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR amd64/115581; it has been noted by GNATS.

From: Bruce Evans <brde@optusnet.com.au>
To: Simun Mikecin <numisemis@yahoo.com>
Cc: bug-followup@freebsd.org, brde@optusnet.com.au
Subject: Re: amd64/115581: [patch] -mfancy-math-387 has no effect
Date: Tue, 21 Aug 2007 22:47:15 +1000 (EST)

 On Tue, 21 Aug 2007, Simun Mikecin wrote:
 
 > On Fri, 17 Aug 2007, Bruce Evans wrote:
 >> It should not be used, especially on amd64 systems since basic FP
 >> instructions are relatively fast compared with the fancy instructions
 >> (except for sqrt). The 64-bit amd64 libm intentionally never uses the
 >> fancy instructions (except for sqrt), partly because they are not much
 >> faster and partly because they are much less accurate. The fancy
 >> instructions are not used for float precision (unless you pessimize
 >> things using -mfancy-math-387) since they are about 3 times slower
 >> than the library versions on small args.
 >
 > This PR is about -mfancy-math-387 usage when compiling 32-bit compatibility 
 > libraries that are gone be used on FreeBSD/amd64.
 > As far as I can see FreeBSD's libm on i386 uses those fancy instructions (for 
 > example /usr/src.current/lib/msun/i387/s_sin.S), so the same libm will be 
 > used for running 32-bit apps on FreeBSD/amd64.
 
 Well, that's in asm so it is not affected by compiler flags.  Compiler
 flags can cause the library to be not used at all in some cases where
 the library is better.
 
 > Is your statement about fancy instructions been 3 times slower also valid for 
 > FreeBSD/i386 and 32-bit apps running on FreeBSD/amd64?
 
 In some cases -- not for most cases, but for float precision trig
 functions on small args, except possibly on very old CPUs.  The i387
 library intentionally doesn't use many hardware transcendental instructions
 in float precision since they are slower and/or very inaccurate.  This
 includes all trig instructions.
 
 Bruce



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