From patchwork Thu Jan 6 18:34:43 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 77795 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 04292B7138 for ; Fri, 7 Jan 2011 06:34:23 +1100 (EST) Received: from localhost ([127.0.0.1]:46691 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PavTZ-0003cd-Bj for incoming@patchwork.ozlabs.org; Thu, 06 Jan 2011 14:26:21 -0500 Received: from [140.186.70.92] (port=58531 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pauwx-0005TD-9K for qemu-devel@nongnu.org; Thu, 06 Jan 2011 13:52:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pauwp-0000ev-6K for qemu-devel@nongnu.org; Thu, 06 Jan 2011 13:52:32 -0500 Received: from mnementh.archaic.org.uk ([81.2.115.146]:24250) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pauwo-0000ea-WF for qemu-devel@nongnu.org; Thu, 06 Jan 2011 13:52:31 -0500 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.69) (envelope-from ) id 1Paufc-0005ID-6s; Thu, 06 Jan 2011 18:34:44 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 6 Jan 2011 18:34:43 +0000 Message-Id: <1294338884-20322-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1294338884-20322-1-git-send-email-peter.maydell@linaro.org> References: <1294338884-20322-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: Riku Voipio Subject: [Qemu-devel] [PATCH 1/2] 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 Implement versions of float*_is_any_nan() for the floatx80 and float128 types. Signed-off-by: Peter Maydell Acked-by: Aurelien Jarno --- 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 #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 */