Received: from [140.186.70.92] (port=35824 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PbEEu-0006Xx-5t for qemu-devel@nongnu.org; Fri, 07 Jan 2011 10:28:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PbEEn-0008Pc-Ro for qemu-devel@nongnu.org; Fri, 07 Jan 2011 10:28:23 -0500 Received: from hall.aurel32.net ([88.191.126.93]:52802) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PbEEn-0008PV-Ke for qemu-devel@nongnu.org; Fri, 07 Jan 2011 10:28:21 -0500 Date: Fri, 7 Jan 2011 16:28:19 +0100 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH 1/2] softfloat: Implement floatx80_is_any_nan() and float128_is_any_nan() Message-ID: <20110107152819.GK21099@hall.aurel32.net> References: <1294338884-20322-1-git-send-email-peter.maydell@linaro.org> <1294338884-20322-2-git-send-email-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <1294338884-20322-2-git-send-email-peter.maydell@linaro.org> Sender: Aurelien Jarno List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Riku Voipio , qemu-devel@nongnu.org On Thu, Jan 06, 2011 at 06:34:43PM +0000, Peter Maydell wrote: > Implement versions of float*_is_any_nan() for the floatx80 and > float128 types. > > Signed-off-by: Peter Maydell > --- > fpu/softfloat.h | 11 +++++++++++ > 1 files changed, 11 insertions(+), 0 deletions(-) > > diff --git a/fpu/softfloat.h b/fpu/softfloat.h > index f2104c6..ac81845 100644 > --- a/fpu/softfloat.h > +++ b/fpu/softfloat.h > @@ -469,6 +469,11 @@ INLINE int floatx80_is_zero(floatx80 a) > return (a.high & 0x7fff) == 0 && a.low == 0; > } > > +INLINE int floatx80_is_any_nan(floatx80 a) > +{ > + return ((a.high & 0x7fff) == 0x7fff) && (a.low<<1); > +} > + > #endif While this looks correct, this seems to say that our definition of floatx80_is_quiet_nan() (for SNAN_BIT_IS_ZERO) is wrong as it is exactly the same. > #ifdef FLOAT128 > @@ -536,6 +541,12 @@ INLINE int float128_is_zero(float128 a) > return (a.high & 0x7fffffffffffffffLL) == 0 && a.low == 0; > } > > +INLINE int float128_is_any_nan(float128 a) > +{ > + return ((a.high >> 48) & 0x7fff) == 0x7fff && > + ((a.low != 0) || ((a.high & 0xffffffffffffLL) != 0)); > +} > + > #endif > > #else /* CONFIG_SOFTFLOAT */ > -- > 1.6.3.3 > Acked-by: Aurelien Jarno -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net