From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=45146 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PsK1S-0000oo-Vk for qemu-devel@nongnu.org; Wed, 23 Feb 2011 14:05:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PsK1R-0001UE-M4 for qemu-devel@nongnu.org; Wed, 23 Feb 2011 14:05:15 -0500 Received: from hall.aurel32.net ([88.191.126.93]:44158) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PsK1R-0001T9-GN for qemu-devel@nongnu.org; Wed, 23 Feb 2011 14:05:13 -0500 Date: Wed, 23 Feb 2011 20:04:56 +0100 From: Aurelien Jarno Subject: Re: [Qemu-devel] Re: QEMU regression problems - Update FPU Message-ID: <20110223190456.GD6703@hall.aurel32.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: Aurelien Jarno List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laurent Desnogues Cc: Peter Maydell , Roy Tam , seabios@seabios.org, qemu-devel@nongnu.org, Kevin O'Connor , Gerhard Wiesinger On Wed, Feb 23, 2011 at 10:45:25AM +0100, Laurent Desnogues wrote: > On Wed, Feb 23, 2011 at 9:16 AM, Peter Maydell wrote: > > On 18 February 2011 07:12, Gerhard Wiesinger wrote: > >> Issue 1.) with FPU still present > >> I tracked down the problematic code and it is a rounding error from double > >> precision to 64bit floats: Any ideas how to fix such an issue in general? > >> > >> QEMU result in ST0: 0.42925860786976457 (wrong emulated) > >> KVM result in ST0:  0.42925860786975449 (correct) > > > > This is an error when running QEMU in TCG mode, right? > > At the moment x86 is the odd-one-out in that it doesn't > > use CONFIG_SOFTFLOAT for its FPU emulation, so somebody > > has made an explicit choice of preferring speed over > > accuracy, and I am unsurprised that there are rounding > > errors as a result. > > Even if you were using SoftFloat, you'd probably still get wrong > results given that this test seems to test trigonometric instructions > which aren't implemented in SoftFloat, but are relying on libm. > Actually that's the reason why i386 doesn't use softfloat, as all the trigonometric use libm, and the bridge between softfloat and libm is not working correctly (plenty of type abuse). The solution is probably to implement them in softfloat, but it's not something trivial. exp2 and log2 are already in softfloat for float32 type, the same way could be use for other trigonometric functions. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net