critical floating point incompatibility

Bakul Shah bakul at bitblocks.com
Fri Dec 21 10:38:16 PST 2007


Peter Jeremy <peterjeremy at optushome.com.au> wrote:
> On Wed, Dec 19, 2007 at 09:40:34PM -0800, Carl Shapiro wrote:
> >The default setting of the x87 floating point control word on the i386
> >port is 0x127F.  Among other things, this value sets the precision
> >control to double precision.  The default setting of the x87 floating
> >point control word on the AMD64 is 0x37F.
> ...
> >It seems clear that the right thing to do is to set the floating point
> >environment to the i386 default for i386 binaries.  Is the current
> >behavior intended?
> 
> I believe this is an oversight.  See the thread beginning
> http://lists.freebsd.org/pipermail/freebsd-stable/2007-November/037947.html

>From reading Bruce's last message in that thread, seems to me
may be default for 64bit binaries should be the same as on
i386. Anyone wanting different behavior can always call
fpsetprec() etc.

I think the fix is to change __INITIAL_FPUCW__ in
/sys/amd64/include/fpu.h to 0x127F like on i386.

Also, while at it, comments above this constant in this file
and above __INITIAL_NPXCW__ in /sys/i386/include/npx.h needs
to reflect what was chosen and why.

Filing a PR would help ensure this doesn't get lost.


More information about the freebsd-hackers mailing list