From patchwork Thu Feb 10 11:29:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 82601 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 0545EB70E3 for ; Thu, 10 Feb 2011 23:06:32 +1100 (EST) Received: from localhost ([127.0.0.1]:56249 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PnUuz-00034a-Jj for incoming@patchwork.ozlabs.org; Thu, 10 Feb 2011 06:42:37 -0500 Received: from [140.186.70.92] (port=33410 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PnUtd-0002o2-J2 for qemu-devel@nongnu.org; Thu, 10 Feb 2011 06:41:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PnUtM-0001Oq-Pk for qemu-devel@nongnu.org; Thu, 10 Feb 2011 06:40:57 -0500 Received: from mnementh.archaic.org.uk ([81.2.115.146]:15472) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PnUtM-0001O1-Gg for qemu-devel@nongnu.org; Thu, 10 Feb 2011 06:40:56 -0500 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.69) (envelope-from ) id 1PnUhp-0002p0-I3; Thu, 10 Feb 2011 11:29:01 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 10 Feb 2011 11:29:00 +0000 Message-Id: <1297337341-10815-6-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1297337341-10815-1-git-send-email-peter.maydell@linaro.org> References: <1297337341-10815-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 v3 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 d29c42b..e427747 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(make_float16(a), ieee, s); + float32 r = float16_to_float32(make_float16(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 float16_val(float32_to_float16(a, ieee, s)); + float16 r = float32_to_float16(a, ieee, s); + if (ieee) { + r = float16_maybe_silence_nan(r); + } + return float16_val(r); } float32 HELPER(recps_f32)(float32 a, float32 b, CPUState *env)