Received: from [140.186.70.92] (port=44043 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PsVgE-0001u0-5V for qemu-devel@nongnu.org; Thu, 24 Feb 2011 02:32:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PsVgC-0002UW-Ve for qemu-devel@nongnu.org; Thu, 24 Feb 2011 02:32:06 -0500 Received: from hall.aurel32.net ([88.191.126.93]:39652) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PsVgC-0002UQ-Pl for qemu-devel@nongnu.org; Thu, 24 Feb 2011 02:32:04 -0500 Date: Thu, 24 Feb 2011 08:31:48 +0100 From: Aurelien Jarno Subject: Re: [Qemu-devel] Re: QEMU regression problems - Update FPU Message-ID: <20110224073148.GG6703@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: Gerhard Wiesinger Cc: Peter Maydell , Kevin O'Connor , seabios@seabios.org, qemu-devel@nongnu.org, Roy Tam On Thu, Feb 24, 2011 at 08:03:02AM +0100, Gerhard Wiesinger wrote: > On Wed, 23 Feb 2011, 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. > > Yes, QEMU not KVM. Regarding mode: I guess tcg mode because > softfloat doesn't compile on x64 (AMD) (How to find out which mode > is used, what other modes exist?). > > But can't we use the float64 type and use the normal i386 (or > higher) instructions and therefore we get: > 1.) less accurate but correct emulated results > 2.) Have the full speed > > Second solution would be to use a more accurate type like now but to > use rounding to e.g. float64 after each FPU operation. > > Maybe we can also use a define or config switch for accuracy vs. speed. > This is not something possible, x86 uses a 80-bit FPU, and floats are rounded to 64-bit when moved to memory. That's actually probably why you see a difference between TCG or native/KVM. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net