From owner-freebsd-hackers@FreeBSD.ORG Fri Dec 21 18:38:16 2007 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05AF716A417 for ; Fri, 21 Dec 2007 18:38:16 +0000 (UTC) (envelope-from bakul@bitblocks.com) Received: from mail.bitblocks.com (mail.bitblocks.com [64.142.15.60]) by mx1.freebsd.org (Postfix) with ESMTP id CB94213C442 for ; Fri, 21 Dec 2007 18:38:15 +0000 (UTC) (envelope-from bakul@bitblocks.com) Received: from bitblocks.com (localhost.bitblocks.com [127.0.0.1]) by mail.bitblocks.com (Postfix) with ESMTP id 0B6F25B42; Fri, 21 Dec 2007 10:11:24 -0800 (PST) To: Peter Jeremy In-reply-to: Your message of "Thu, 20 Dec 2007 20:39:50 +1100." <20071220093950.GA79196@server.vk2pj.dyndns.org> Date: Fri, 21 Dec 2007 10:11:24 -0800 From: Bakul Shah Message-Id: <20071221181125.0B6F25B42@mail.bitblocks.com> Cc: freebsd-hackers@freebsd.org, Carl Shapiro Subject: Re: critical floating point incompatibility X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2007 18:38:16 -0000 Peter Jeremy 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.