From patchwork Thu Dec 16 11:51:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 75743 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]) by ozlabs.org (Postfix) with ESMTP id C4EFEB6ED0 for ; Thu, 16 Dec 2010 23:05:14 +1100 (EST) Received: from localhost ([127.0.0.1]:45927 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PTCSO-0004TY-4g for incoming@patchwork.ozlabs.org; Thu, 16 Dec 2010 06:57:12 -0500 Received: from [140.186.70.92] (port=38412 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PTCQt-00040c-Er for qemu-devel@nongnu.org; Thu, 16 Dec 2010 06:55:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PTCMq-0000M8-0f for qemu-devel@nongnu.org; Thu, 16 Dec 2010 06:51:29 -0500 Received: from mnementh.archaic.org.uk ([81.2.115.146]:58074) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PTCMp-0000Jr-Q0 for qemu-devel@nongnu.org; Thu, 16 Dec 2010 06:51:27 -0500 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.69) (envelope-from ) id 1PTCMg-0006pI-K7; Thu, 16 Dec 2010 11:51:18 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 16 Dec 2010 11:51:18 +0000 Message-Id: <1292500278-26215-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1292500278-26215-1-git-send-email-peter.maydell@linaro.org> References: <1292500278-26215-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: Nathan Froyd Subject: [Qemu-devel] [PATCH 2/2] ARM: Implement correct NaN propagation rules 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 the correct NaN propagation rules for ARM targets by providing an appropriate pickNaN function. Signed-off-by: Peter Maydell --- fpu/softfloat-specialize.h | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h index 3015480..fd1b114 100644 --- a/fpu/softfloat-specialize.h +++ b/fpu/softfloat-specialize.h @@ -149,6 +149,28 @@ static float32 commonNaNToFloat32( commonNaNT a ) | tie-break rule. *----------------------------------------------------------------------------*/ +#if defined(TARGET_ARM) +static int pickNaN(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN, + flag aIsLargerSignificand) +{ + /* ARM mandated NaN propagation rules: take the first of: + * 1. A if it is signaling + * 2. B if it is signaling + * 3. A (quiet) + * 4. B (quiet) + * A signaling NaN is always quietened before returning it. + */ + if (aIsSNaN) { + return 0; + } else if (bIsSNaN) { + return 1; + } else if (aIsQNaN) { + return 0; + } else { + return 1; + } +} +#else static int pickNaN(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN, flag aIsLargerSignificand) { @@ -178,6 +200,7 @@ static int pickNaN(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN, return 1; } } +#endif /*---------------------------------------------------------------------------- | Takes two single-precision floating-point values `a' and `b', one of which