From nobody Wed Nov 5 14:25:40 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1534826746285436.984189976876; Mon, 20 Aug 2018 21:45:46 -0700 (PDT) Received: from localhost ([::1]:50704 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fryXy-0007ri-3y for importer@patchew.org; Tue, 21 Aug 2018 00:45:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56510) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fryMt-0004C0-S9 for qemu-devel@nongnu.org; Tue, 21 Aug 2018 00:34:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fryMp-0000Mu-12 for qemu-devel@nongnu.org; Tue, 21 Aug 2018 00:34:11 -0400 Received: from ozlabs.org ([203.11.71.1]:43451) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fryMk-0000FP-Us; Tue, 21 Aug 2018 00:34:05 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41vd9F0586z9sCX; Tue, 21 Aug 2018 14:33:51 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1534826033; bh=qQXE9mfBFMcdiGpmvn+88VcQWkxQvr905pQllx6aO2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=is6+Y61H3i0W3RRdjSh3dPHDCVXmpUGds63NIUIU5jCNaDV+IXaCbHf99Y4BPZIS9 2JCKyd+CjOacpWzrs8BkFBzf13perOIW6L5cDi8K9/VwmI75iHZ+WRl5WFWwsai+3E JUXuScsx7k+DauNEV9D9+kG6sWfJVE+3VJNXqKko= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 21 Aug 2018 14:33:22 +1000 Message-Id: <20180821043343.7514-6-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180821043343.7514-1-david@gibson.dropbear.id.au> References: <20180821043343.7514-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 05/26] target/ppc: Tidy helper_fmul X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, aik@ozlabs.ru, Richard Henderson , groug@kaod.org, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Richard Henderson Tidy the invalid exception checking so that we rely on softfloat for initial argument validation, and select the kind of invalid operand exception only when we know we must. Pass and return float64 values directly rather than bounce through the CPU_DoubleU union. Signed-off-by: Richard Henderson Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 25 +++++++++++-------------- target/ppc/helper.h | 2 +- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index c20b9ae672..b9ee46eb5f 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -635,27 +635,24 @@ uint64_t helper_fsub(CPUPPCState *env, uint64_t arg1,= uint64_t arg2) } =20 /* fmul - fmul. */ -uint64_t helper_fmul(CPUPPCState *env, uint64_t arg1, uint64_t arg2) +float64 helper_fmul(CPUPPCState *env, float64 arg1, float64 arg2) { - CPU_DoubleU farg1, farg2; - - farg1.ll =3D arg1; - farg2.ll =3D arg2; + float64 ret =3D float64_mul(arg1, arg2, &env->fp_status); + int status =3D get_float_exception_flags(&env->fp_status); =20 - if (unlikely((float64_is_infinity(farg1.d) && float64_is_zero(farg2.d)= ) || - (float64_is_zero(farg1.d) && float64_is_infinity(farg2.d)= ))) { - /* Multiplication of zero by infinity */ - farg1.ll =3D float_invalid_op_excp(env, POWERPC_EXCP_FP_VXIMZ, 1); - } else { - if (unlikely(float64_is_signaling_nan(farg1.d, &env->fp_status) || - float64_is_signaling_nan(farg2.d, &env->fp_status))) { + if (unlikely(status & float_flag_invalid)) { + if ((float64_is_infinity(arg1) && float64_is_zero(arg2)) || + (float64_is_zero(arg1) && float64_is_infinity(arg2))) { + /* Multiplication of zero by infinity */ + float_invalid_op_excp(env, POWERPC_EXCP_FP_VXIMZ, 1); + } else if (float64_is_signaling_nan(arg1, &env->fp_status) || + float64_is_signaling_nan(arg2, &env->fp_status)) { /* sNaN multiplication */ float_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN, 1); } - farg1.d =3D float64_mul(farg1.d, farg2.d, &env->fp_status); } =20 - return farg1.ll; + return ret; } =20 /* fdiv - fdiv. */ diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 1c453fa0f7..e4f7c55db9 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -87,7 +87,7 @@ DEF_HELPER_2(frim, i64, env, i64) =20 DEF_HELPER_3(fadd, i64, env, i64, i64) DEF_HELPER_3(fsub, i64, env, i64, i64) -DEF_HELPER_3(fmul, i64, env, i64, i64) +DEF_HELPER_3(fmul, f64, env, f64, f64) DEF_HELPER_3(fdiv, f64, env, f64, f64) DEF_HELPER_4(fmadd, i64, env, i64, i64, i64) DEF_HELPER_4(fmsub, i64, env, i64, i64, i64) --=20 2.17.1