From patchwork Wed Feb 9 13:48:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 82459 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 DA916B70E3 for ; Thu, 10 Feb 2011 00:51:36 +1100 (EST) Received: from localhost ([127.0.0.1]:43319 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PnASB-0002Ah-Vu for incoming@patchwork.ozlabs.org; Wed, 09 Feb 2011 08:51:32 -0500 Received: from [140.186.70.92] (port=58349 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PnAPB-0000tu-6T for qemu-devel@nongnu.org; Wed, 09 Feb 2011 08:48:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PnAP9-0004ev-Ql for qemu-devel@nongnu.org; Wed, 09 Feb 2011 08:48:25 -0500 Received: from mnementh.archaic.org.uk ([81.2.115.146]:51013) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PnAP9-0004b4-IY for qemu-devel@nongnu.org; Wed, 09 Feb 2011 08:48:23 -0500 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.69) (envelope-from ) id 1PnAOy-0001Jc-RO; Wed, 09 Feb 2011 13:48:12 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Wed, 9 Feb 2011 13:48:11 +0000 Message-Id: <1297259292-5025-6-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1297259292-5025-1-git-send-email-peter.maydell@linaro.org> References: <1297259292-5025-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 81.2.115.146 Cc: Christophe Lyon , patches@linaro.org Subject: [Qemu-devel] [PATCH 5/6] target-arm: Silence NaNs resulting from half-precision conversions 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 Silence the NaNs that may result from half-precision conversion, as we do for the other conversions. Signed-off-by: Peter Maydell --- target-arm/helper.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/target-arm/helper.c b/target-arm/helper.c index d46defc..503278c 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -2627,14 +2627,22 @@ float32 HELPER(vfp_fcvt_f16_to_f32)(uint32_t a, CPUState *env) { float_status *s = &env->vfp.fp_status; int ieee = (env->vfp.xregs[ARM_VFP_FPSCR] & (1 << 26)) == 0; - return float16_to_float32(a, ieee, s); + float32 r = float16_to_float32(a, ieee, s); + if (ieee) { + return float32_maybe_silence_nan(r); + } + return r; } uint32_t HELPER(vfp_fcvt_f32_to_f16)(float32 a, CPUState *env) { float_status *s = &env->vfp.fp_status; int ieee = (env->vfp.xregs[ARM_VFP_FPSCR] & (1 << 26)) == 0; - return float32_to_float16(a, ieee, s); + float16 r = float32_to_float16(a, ieee, s); + if (ieee) { + return float16_maybe_silence_nan(r); + } + return r; } float32 HELPER(recps_f32)(float32 a, float32 b, CPUState *env)