From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IZo82-00077O-6N for qemu-devel@nongnu.org; Mon, 24 Sep 2007 09:37:38 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IZo7z-00075K-Iv for qemu-devel@nongnu.org; Mon, 24 Sep 2007 09:37:37 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IZo7z-000758-Cc for qemu-devel@nongnu.org; Mon, 24 Sep 2007 09:37:35 -0400 Received: from nan.false.org ([208.75.86.248]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IZo7y-00052b-PM for qemu-devel@nongnu.org; Mon, 24 Sep 2007 09:37:34 -0400 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 485F7982AD for ; Mon, 24 Sep 2007 13:37:30 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 259C698153 for ; Mon, 24 Sep 2007 13:37:30 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.67) (envelope-from ) id 1IZo7t-0003XF-1T for qemu-devel@nongnu.org; Mon, 24 Sep 2007 09:37:29 -0400 Date: Mon, 24 Sep 2007 09:37:29 -0400 From: Daniel Jacobowitz Message-ID: <20070924133729.GA13307@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] Another MIPS quiet NaN fix Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Glibc's test-float failed on my qemu testing. I tracked it down to these routines: if you count the bits carefully, you'll see that 0x7FC00000 sets the quiet NaN bit (on most hardware - signalling NaN in the MIPS case); so does a.high >> 41, which copies it from the original NaN. I think this routine should not force a quiet or signalling NaN, but just preserve the input NaN's signalling-ness. With the patch below, everything passes. cvt.d.s still produces an ugly pattern different from the one real hardware produces when converting a single-precision NaN to double; but now it's a quiet NaN if the input was a quiet NaN so exp10(NaN) no longer raises Invalid. -- Daniel Jacobowitz CodeSourcery --- fpu/softfloat-specialize.h (revision 182529) +++ fpu/softfloat-specialize.h (local) @@ -120,9 +120,7 @@ static commonNaNT float32ToCommonNaN( fl static float32 commonNaNToFloat32( commonNaNT a ) { - - return ( ( (bits32) a.sign )<<31 ) | 0x7FC00000 | ( a.high>>41 ); - + return ( ( (bits32) a.sign )<<31 ) | 0x7F800000 | ( a.high>>41 ); } /*---------------------------------------------------------------------------- @@ -233,7 +231,7 @@ static float64 commonNaNToFloat64( commo return ( ( (bits64) a.sign )<<63 ) - | LIT64( 0x7FF8000000000000 ) + | LIT64( 0x7FF0000000000000 ) | ( a.high>>12 ); }