From patchwork Mon Jan 3 14:34:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 77280 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 AD569B70CD for ; Tue, 4 Jan 2011 01:46:03 +1100 (EST) Received: from localhost ([127.0.0.1]:38465 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PZlfc-0000ba-Cj for incoming@patchwork.ozlabs.org; Mon, 03 Jan 2011 09:46:00 -0500 Received: from [140.186.70.92] (port=55315 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PZlUo-00031k-Ec for qemu-devel@nongnu.org; Mon, 03 Jan 2011 09:34:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PZlUm-0002Rh-Nj for qemu-devel@nongnu.org; Mon, 03 Jan 2011 09:34:50 -0500 Received: from hall.aurel32.net ([88.191.126.93]:45108) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PZlUm-0002Rd-J5 for qemu-devel@nongnu.org; Mon, 03 Jan 2011 09:34:48 -0500 Received: from [2001:470:d4ed:0:5e26:aff:fe2b:6f5b] (helo=volta.aurel32.net) by hall.aurel32.net with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1PZlUl-0000Jb-Ly; Mon, 03 Jan 2011 15:34:47 +0100 Received: from aurel32 by volta.aurel32.net with local (Exim 4.72) (envelope-from ) id 1PZlUh-0007wD-FH; Mon, 03 Jan 2011 15:34:43 +0100 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Mon, 3 Jan 2011 15:34:33 +0100 Message-Id: <1294065273-30274-7-git-send-email-aurelien@aurel32.net> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1294065273-30274-1-git-send-email-aurelien@aurel32.net> References: <1294065273-30274-1-git-send-email-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: Alexander Graf , Aurelien Jarno Subject: [Qemu-devel] [PATCH 6/6] target-ppc: 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. Also fix the #ifdef tests for default NaN definition, the correct name is TARGET_PPC instead of TARGET_POWERPC. Cc: Alexander Graf Signed-off-by: Aurelien Jarno Reviewed-by: Nathan Froyd --- fpu/softfloat-specialize.h | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-) diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h index 150500b..0f6dbd0 100644 --- a/fpu/softfloat-specialize.h +++ b/fpu/softfloat-specialize.h @@ -61,7 +61,7 @@ typedef struct { *----------------------------------------------------------------------------*/ #if defined(TARGET_SPARC) #define float32_default_nan make_float32(0x7FFFFFFF) -#elif defined(TARGET_POWERPC) || defined(TARGET_ARM) || defined(TARGET_ALPHA) +#elif defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_ALPHA) #define float32_default_nan make_float32(0x7FC00000) #elif SNAN_BIT_IS_ONE #define float32_default_nan make_float32(0x7FBFFFFF) @@ -214,6 +214,21 @@ static int pickNaN(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN, return 1; } } +#elif defined(TARGET_PPC) +static int pickNaN(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN, + flag aIsLargerSignificand) +{ + /* PowerPC propagation rules: + * 1. A if it sNaN or qNaN + * 2. B if it sNaN or qNaN + * A signaling NaN is always quietened before returning it. + */ + if (aIsSNaN || aIsQNaN) { + return 0; + } else { + return 1; + } +} #else static int pickNaN(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN, flag aIsLargerSignificand) @@ -292,7 +307,7 @@ static float32 propagateFloat32NaN( float32 a, float32 b STATUS_PARAM) *----------------------------------------------------------------------------*/ #if defined(TARGET_SPARC) #define float64_default_nan make_float64(LIT64( 0x7FFFFFFFFFFFFFFF )) -#elif defined(TARGET_POWERPC) || defined(TARGET_ARM) || defined(TARGET_ALPHA) +#elif defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_ALPHA) #define float64_default_nan make_float64(LIT64( 0x7FF8000000000000 )) #elif SNAN_BIT_IS_ONE #define float64_default_nan make_float64(LIT64( 0x7FF7FFFFFFFFFFFF ))