From owner-freebsd-hackers@FreeBSD.ORG Thu Dec 20 06:09:22 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 9222116A41B for ; Thu, 20 Dec 2007 06:09:22 +0000 (UTC) (envelope-from carl.shapiro@gmail.com) Received: from hs-out-2122.google.com (hs-out-0708.google.com [64.233.178.246]) by mx1.freebsd.org (Postfix) with ESMTP id 4517313C447 for ; Thu, 20 Dec 2007 06:09:22 +0000 (UTC) (envelope-from carl.shapiro@gmail.com) Received: by hs-out-2122.google.com with SMTP id j58so162498hsj.11 for ; Wed, 19 Dec 2007 22:09:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=iEa+Va3tg1zQzqwo1mV12iYl7RZ2dJCX6J/xOIllzmM=; b=p7Qfnn8PfHo2uBxiha08DzvF1Jl1fI/4H6dvCoRZgF+zGeH1lHyEF3tIFD2TmJn1kasXNVs/98UovngnKxOEuMXK418Zs73QJesZmMFVgVBnVZ2p7uWApRfH8DI7oPyZFh2Q/vYE/jj8YxELHNmj/fcivJTCLGQ9wa63oSuVnI8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=Iab1yPEr8HYzdvs958iHXOBznP7f/TTUT2Okek1GpP/3P7KW+I3LZdjmgdYJ3y2xWSwDgL7xRI4dI8RzmtlIJsniFJv464tdB+Cp5nM9sT4aM/efSNUuaJcI4PqlBQZ8/bzsGV/g/SMpXo75WZP+leqVuwV0KtFpg9ggnfp16Ls= Received: by 10.150.196.5 with SMTP id t5mr4002271ybf.109.1198129234640; Wed, 19 Dec 2007 21:40:34 -0800 (PST) Received: by 10.150.200.6 with HTTP; Wed, 19 Dec 2007 21:40:34 -0800 (PST) Message-ID: <4dcb5abd0712192140w29fd39fh53b09fdd4d20e880@mail.gmail.com> Date: Wed, 19 Dec 2007 21:40:34 -0800 From: "Carl Shapiro" To: freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: 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: Thu, 20 Dec 2007 06:09:22 -0000 Developers, There is a critical incompatibility between the floating point environment of the 32-bit compatibility environment of AMD64 systems and a genuine i386 system. 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. This value sets the precision control to double-extended precision. Since the AMD64 port uses SSE2 instructions for single and double precision arithmetic (thereby reserving the x87 for double-extended precision) this is a reasonable setting. Unfortunately, when a 32-bit binary is run under compatibility on an AMD64 system, the floating point control word is 0x37F, not 0x127F. 32-bit binaries do not expect the floating point environment to be in this state. The net effect is that all but the most trivial programs using x87 floating point arithmetic instructions will produce different values when run on a native i386 system than when run under compatibility on a 64-bit system! 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? Carl