Received: from [140.186.70.92] (port=55268 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PZlUj-0002yF-Sa for qemu-devel@nongnu.org; Mon, 03 Jan 2011 09:34:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PZlUi-0002QU-N7 for qemu-devel@nongnu.org; Mon, 03 Jan 2011 09:34:45 -0500 Received: from hall.aurel32.net ([88.191.126.93]:45104) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PZlUi-0002QO-HL for qemu-devel@nongnu.org; Mon, 03 Jan 2011 09:34:44 -0500 From: Aurelien Jarno Date: Mon, 3 Jan 2011 15:34:29 +0100 Message-Id: <1294065273-30274-3-git-send-email-aurelien@aurel32.net> In-Reply-To: <1294065273-30274-1-git-send-email-aurelien@aurel32.net> References: <1294065273-30274-1-git-send-email-aurelien@aurel32.net> Subject: [Qemu-devel] [PATCH 2/6] softfloat: fix float{32, 64}_maybe_silence_nan() for MIPS List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Aurelien Jarno On targets that define sNaN with the sNaN bit as one, simply clearing this bit may correspond to an infinite value. Convert it to a default NaN if SNAN_BIT_IS_ONE, as it corresponds to the MIPS implementation, the only emulated CPU with SNAN_BIT_IS_ONE. When other CPU of this type are added, this might be updated to include more cases. Signed-off-by: Aurelien Jarno --- fpu/softfloat-specialize.h | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h index f23bd6a..31481e7 100644 --- a/fpu/softfloat-specialize.h +++ b/fpu/softfloat-specialize.h @@ -107,13 +107,13 @@ int float32_is_signaling_nan( float32 a_ ) float32 float32_maybe_silence_nan( float32 a_ ) { if (float32_is_signaling_nan(a_)) { - bits32 a = float32_val(a_); #if SNAN_BIT_IS_ONE - a &= ~(1 << 22); + return float32_default_nan; #else + bits32 a = float32_val(a_); a |= (1 << 22); -#endif return make_float32(a); +#endif } return a_; } @@ -321,13 +321,13 @@ int float64_is_signaling_nan( float64 a_ ) float64 float64_maybe_silence_nan( float64 a_ ) { if (float64_is_signaling_nan(a_)) { - bits64 a = float64_val(a_); #if SNAN_BIT_IS_ONE - a &= ~LIT64( 0x0008000000000000 ); + return float64_default_nan; #else + bits64 a = float64_val(a_); a |= LIT64( 0x0008000000000000 ); -#endif return make_float64(a); +#endif } return a_; } -- 1.7.2.3