Received: from [140.186.70.92] (port=55285 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PZlUk-0002yx-Nr for qemu-devel@nongnu.org; Mon, 03 Jan 2011 09:34:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PZlUj-0002Qi-AC for qemu-devel@nongnu.org; Mon, 03 Jan 2011 09:34:46 -0500 Received: from hall.aurel32.net ([88.191.126.93]:45105) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PZlUj-0002Qc-4J for qemu-devel@nongnu.org; Mon, 03 Jan 2011 09:34:45 -0500 From: Aurelien Jarno Date: Mon, 3 Jan 2011 15:34:30 +0100 Message-Id: <1294065273-30274-4-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 3/6] softfloat: add float{x80, 128}_maybe_silence_nan() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Aurelien Jarno Add float{x80,128}_maybe_silence_nan() functions, they will be need by propagateFloat{x80,128}NaN(). Signed-off-by: Aurelien Jarno --- fpu/softfloat-specialize.h | 38 ++++++++++++++++++++++++++++++++++++++ fpu/softfloat.h | 2 ++ 2 files changed, 40 insertions(+), 0 deletions(-) diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h index 31481e7..49e3cc2 100644 --- a/fpu/softfloat-specialize.h +++ b/fpu/softfloat-specialize.h @@ -470,6 +470,25 @@ int floatx80_is_signaling_nan( floatx80 a ) } /*---------------------------------------------------------------------------- +| Returns a quiet NaN if the extended double-precision floating point value +| `a' is a signaling NaN; otherwise returns `a'. +*----------------------------------------------------------------------------*/ + +floatx80 floatx80_maybe_silence_nan( floatx80 a ) +{ + if (floatx80_is_signaling_nan(a)) { +#if SNAN_BIT_IS_ONE + a.low = floatx80_default_nan_low; + a.high = floatx80_default_nan_high; +#else + a.low |= LIT64( 0xC000000000000000 ); + return a; +#endif + } + return a; +} + +/*---------------------------------------------------------------------------- | Returns the result of converting the extended double-precision floating- | point NaN `a' to the canonical NaN format. If `a' is a signaling NaN, the | invalid exception is raised. @@ -601,6 +620,25 @@ int float128_is_signaling_nan( float128 a ) } /*---------------------------------------------------------------------------- +| Returns a quiet NaN if the quadruple-precision floating point value `a' is +| a signaling NaN; otherwise returns `a'. +*----------------------------------------------------------------------------*/ + +float128 float128_maybe_silence_nan( float128 a ) +{ + if (float128_is_signaling_nan(a)) { +#if SNAN_BIT_IS_ONE + a.low = float128_default_nan_low; + a.high = float128_default_nan_high; +#else + a.high |= LIT64( 0x0000800000000000 ); + return a; +#endif + } + return a; +} + +/*---------------------------------------------------------------------------- | Returns the result of converting the quadruple-precision floating-point NaN | `a' to the canonical NaN format. If `a' is a signaling NaN, the invalid | exception is raised. diff --git a/fpu/softfloat.h b/fpu/softfloat.h index 1f37877..f2104c6 100644 --- a/fpu/softfloat.h +++ b/fpu/softfloat.h @@ -439,6 +439,7 @@ int floatx80_le_quiet( floatx80, floatx80 STATUS_PARAM ); int floatx80_lt_quiet( floatx80, floatx80 STATUS_PARAM ); int floatx80_is_quiet_nan( floatx80 ); int floatx80_is_signaling_nan( floatx80 ); +floatx80 floatx80_maybe_silence_nan( floatx80 ); floatx80 floatx80_scalbn( floatx80, int STATUS_PARAM ); INLINE floatx80 floatx80_abs(floatx80 a) @@ -505,6 +506,7 @@ int float128_compare( float128, float128 STATUS_PARAM ); int float128_compare_quiet( float128, float128 STATUS_PARAM ); int float128_is_quiet_nan( float128 ); int float128_is_signaling_nan( float128 ); +float128 float128_maybe_silence_nan( float128 ); float128 float128_scalbn( float128, int STATUS_PARAM ); INLINE float128 float128_abs(float128 a) -- 1.7.2.3