From nobody Tue Feb 10 02:00:46 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645830691543460.9723742189407; Fri, 25 Feb 2022 15:11:31 -0800 (PST) Received: from localhost ([::1]:50810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nNjkI-0000pq-1J for importer@patchew.org; Fri, 25 Feb 2022 18:11:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35688) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNhxY-0000XY-Iz; Fri, 25 Feb 2022 16:17:05 -0500 Received: from [187.72.171.209] (port=58124 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nNhxX-0004qx-3R; Fri, 25 Feb 2022 16:17:04 -0500 Received: from p9ibm ([10.10.71.235]) by outlook.eldorado.org.br over TLS secured channel with Microsoft SMTPSVC(8.5.9600.16384); Fri, 25 Feb 2022 18:09:59 -0300 Received: from eldorado.org.br (unknown [10.10.70.45]) by p9ibm (Postfix) with ESMTP id C12578001D1; Fri, 25 Feb 2022 18:09:58 -0300 (-03) From: matheus.ferst@eldorado.org.br To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Subject: [PATCH v5 40/49] target/ppc: Refactor VSX_SCALAR_CMP_DP Date: Fri, 25 Feb 2022 18:09:27 -0300 Message-Id: <20220225210936.1749575-41-matheus.ferst@eldorado.org.br> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220225210936.1749575-1-matheus.ferst@eldorado.org.br> References: <20220225210936.1749575-1-matheus.ferst@eldorado.org.br> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 25 Feb 2022 21:09:59.0139 (UTC) FILETIME=[0BEE6330:01D82A8C] X-Host-Lookup-Failed: Reverse DNS lookup failed for 187.72.171.209 (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=187.72.171.209; envelope-from=matheus.ferst@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, PDS_HP_HELO_NORDNS=0.659, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: danielhb413@gmail.com, richard.henderson@linaro.org, groug@kaod.org, =?UTF-8?q?V=C3=ADctor=20Colombo?= , clg@kaod.org, Matheus Ferst , david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1645830693486100001 From: V=C3=ADctor Colombo Refactor VSX_SCALAR_CMP_DP, changing its name to VSX_SCALAR_CMP and prepare the helper to be used for quadword comparisons. Suggested-by: Richard Henderson Signed-off-by: V=C3=ADctor Colombo Signed-off-by: Matheus Ferst Reviewed-by: Richard Henderson --- changes for v5: - Improve refactor as suggested by Richard Henderson --- target/ppc/fpu_helper.c | 66 +++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 36 deletions(-) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 9b034d1fe4..bbd54b2d9c 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -2265,54 +2265,48 @@ VSX_MADDQ(XSNMSUBQP, NMSUB_FLGS, 0) VSX_MADDQ(XSNMSUBQPO, NMSUB_FLGS, 0) =20 /* - * VSX_SCALAR_CMP_DP - VSX scalar floating point compare double precision + * VSX_SCALAR_CMP - VSX scalar floating point compare * op - instruction mnemonic + * tp - type * cmp - comparison operation - * exp - expected result of comparison + * fld - vsr_t field * svxvc - set VXVC bit */ -#define VSX_SCALAR_CMP_DP(op, cmp, exp, svxvc) = \ -void helper_##op(CPUPPCState *env, ppc_vsr_t *xt, = \ - ppc_vsr_t *xa, ppc_vsr_t *xb) = \ +#define VSX_SCALAR_CMP(op, tp, cmp, fld, svxvc) = \ + void helper_##op(CPUPPCState *env, ppc_vsr_t *xt, = \ + ppc_vsr_t *xa, ppc_vsr_t *xb) = \ { = \ - ppc_vsr_t t =3D *xt; = \ - bool vxsnan_flag =3D false, vxvc_flag =3D false, vex_flag =3D false; = \ + int flags; = \ + bool r, vxvc; = \ = \ - if (float64_is_signaling_nan(xa->VsrD(0), &env->fp_status) || = \ - float64_is_signaling_nan(xb->VsrD(0), &env->fp_status)) { = \ - vxsnan_flag =3D true; = \ - if (fpscr_ve =3D=3D 0 && svxvc) { = \ - vxvc_flag =3D true; = \ + helper_reset_fpstatus(env); = \ + = \ + if (svxvc) { = \ + r =3D tp##_##cmp(xb->fld, xa->fld, &env->fp_status); = \ + } else { = \ + r =3D tp##_##cmp##_quiet(xb->fld, xa->fld, &env->fp_status); = \ + } = \ + = \ + flags =3D get_float_exception_flags(&env->fp_status); = \ + if (unlikely(flags & float_flag_invalid)) { = \ + vxvc =3D svxvc; = \ + if (flags & float_flag_invalid_snan) { = \ + float_invalid_op_vxsnan(env, GETPC()); = \ + vxvc &=3D fpscr_ve =3D=3D 0; = \ } = \ - } else if (svxvc) { = \ - vxvc_flag =3D float64_is_quiet_nan(xa->VsrD(0), &env->fp_status) |= | \ - float64_is_quiet_nan(xb->VsrD(0), &env->fp_status); = \ - } = \ - if (vxsnan_flag) { = \ - float_invalid_op_vxsnan(env, GETPC()); = \ - } = \ - if (vxvc_flag) { = \ - float_invalid_op_vxvc(env, 0, GETPC()); = \ - } = \ - vex_flag =3D fpscr_ve && (vxvc_flag || vxsnan_flag); = \ - = \ - if (!vex_flag) { = \ - if (float64_##cmp(xb->VsrD(0), xa->VsrD(0), = \ - &env->fp_status) =3D=3D exp) { = \ - t.VsrD(0) =3D -1; = \ - t.VsrD(1) =3D 0; = \ - } else { = \ - t.VsrD(0) =3D 0; = \ - t.VsrD(1) =3D 0; = \ + if (vxvc) { = \ + float_invalid_op_vxvc(env, 0, GETPC()); = \ } = \ } = \ - *xt =3D t; = \ + = \ + memset(xt, 0, sizeof(*xt)); = \ + memset(&xt->fld, -r, sizeof(xt->fld)); = \ do_float_check_status(env, GETPC()); = \ } =20 -VSX_SCALAR_CMP_DP(xscmpeqdp, eq, 1, 0) -VSX_SCALAR_CMP_DP(xscmpgedp, le, 1, 1) -VSX_SCALAR_CMP_DP(xscmpgtdp, lt, 1, 1) +VSX_SCALAR_CMP(xscmpeqdp, float64, eq, VsrD(0), 0) +VSX_SCALAR_CMP(xscmpgedp, float64, le, VsrD(0), 1) +VSX_SCALAR_CMP(xscmpgtdp, float64, lt, VsrD(0), 1) =20 void helper_xscmpexpdp(CPUPPCState *env, uint32_t opcode, ppc_vsr_t *xa, ppc_vsr_t *xb) --=20 2.25.1