From patchwork Fri Jan 7 20:52:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 77910 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 66322B70EA for ; Sat, 8 Jan 2011 07:55:48 +1100 (EST) Received: from localhost ([127.0.0.1]:48198 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PbJLd-00011n-OF for incoming@patchwork.ozlabs.org; Fri, 07 Jan 2011 15:55:45 -0500 Received: from [140.186.70.92] (port=60566 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PbJIf-0008GB-IR for qemu-devel@nongnu.org; Fri, 07 Jan 2011 15:52:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PbJId-0007V5-Cm for qemu-devel@nongnu.org; Fri, 07 Jan 2011 15:52:41 -0500 Received: from afflict.kos.to ([92.243.29.197]:44846) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PbJId-0007Ud-7n for qemu-devel@nongnu.org; Fri, 07 Jan 2011 15:52:39 -0500 Received: by afflict.kos.to (Postfix, from userid 1000) id CCBDA26675; Fri, 7 Jan 2011 20:52:35 +0000 (UTC) From: Riku Voipio To: qemu-devel@nongnu.org Date: Fri, 7 Jan 2011 22:52:32 +0200 Message-Id: <2bed652fc596dee09f27dd7ab20528cf5eaf9203.1294433287.git.riku.voipio@nokia.com> X-Mailer: git-send-email 1.6.5 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: Peter Maydell , Riku Voipio Subject: [Qemu-devel] [PATCH 4/7] softfloat: Implement floatx80_is_any_nan() and float128_is_any_nan() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Peter Maydell Implement versions of float*_is_any_nan() for the floatx80 and float128 types. Acked-by: Aurelien Jarno Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- fpu/softfloat.h | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/fpu/softfloat.h b/fpu/softfloat.h index 15052cc..a6d0f16 100644 --- a/fpu/softfloat.h +++ b/fpu/softfloat.h @@ -489,6 +489,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 #ifdef FLOAT128 @@ -556,6 +561,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 */