From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=37878 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pd6r9-0007ld-I6 for qemu-devel@nongnu.org; Wed, 12 Jan 2011 14:59:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pd6r6-0001GD-Mi for qemu-devel@nongnu.org; Wed, 12 Jan 2011 14:59:41 -0500 Received: from hall.aurel32.net ([88.191.126.93]:40959) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pd6r6-0001Fs-IF for qemu-devel@nongnu.org; Wed, 12 Jan 2011 14:59:40 -0500 From: Aurelien Jarno Date: Wed, 12 Jan 2011 20:59:39 +0100 Message-Id: <1294862379-31353-1-git-send-email-aurelien@aurel32.net> Subject: [Qemu-devel] [PATCH] softfloat: fix floatx80_is_{quiet, signaling}_nan() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Aurelien Jarno floatx80_is_{quiet,signaling}_nan() functions are incorrectly detecting the type of NaN, depending on SNAN_BIT_IS_ONE, one of the two is returning the correct value, and the other true for any kind of NaN. This patch fixes that by applying the same kind of comparison as for other float formats, but taking into account the explicit bit. Cc: Peter Maydell Signed-off-by: Aurelien Jarno --- fpu/softfloat-specialize.h | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h index f293f24..50e56b4 100644 --- a/fpu/softfloat-specialize.h +++ b/fpu/softfloat-specialize.h @@ -482,7 +482,8 @@ int floatx80_is_quiet_nan( floatx80 a ) && (bits64) ( aLow<<1 ) && ( a.low == aLow ); #else - return ( ( a.high & 0x7FFF ) == 0x7FFF ) && (bits64) ( a.low<<1 ); + return ( ( a.high & 0x7FFF ) == 0x7FFF ) + && (LIT64( 0x8000000000000000 ) >= ((bits64) ( a.low<<1 ))); #endif } @@ -494,7 +495,8 @@ int floatx80_is_quiet_nan( floatx80 a ) int floatx80_is_signaling_nan( floatx80 a ) { #if SNAN_BIT_IS_ONE - return ( ( a.high & 0x7FFF ) == 0x7FFF ) && (bits64) ( a.low<<1 ); + return ( ( a.high & 0x7FFF ) == 0x7FFF ) + && (LIT64( 0x8000000000000000 ) >= ((bits64) ( a.low<<1 ))); #else bits64 aLow; -- 1.7.2.3