From nobody Tue Nov 18 06:04:47 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 ARC-Seal: i=1; a=rsa-sha256; t=1607922629; cv=none; d=zohomail.com; s=zohoarc; b=EwMmRJ+5bcLzwqoMbTnljFx5POHLU9eLfJVjgxMuwzAd584/u9/t0oHkyrZ87G7ByA/Vr7oxGRPKVwBoESKUxNNMj4q/4gTeBGNuIlnbJALwD8gdeBzcCWc2YnIKxklerUa+Ro00cM0Gip3hy3eikamr+K1A56X7OQDH6tU8aP8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607922629; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Lwku6C+gECrY5kKMjNPPEjxOGuNi0oVJ09tE1i/RE6s=; b=jqszLX2oRJJtslGdsCJiSZGrD3IbPlBz0Zw9Ik9loa9OEKgl5a/pIl+GjdykOTpCuxhyEZ8EgdAqCJYxWX6Lns+l+1CGYzcbhnzFhix995MHMYxtDmPH2YvWFvLPItZD0jYo1ozWk5MWbLKOig916GH+HPHtwIlGwcI1E9bgezo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 160792262975288.71715354090031; Sun, 13 Dec 2020 21:10:29 -0800 (PST) Received: from localhost ([::1]:48538 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kog7w-0004oW-Fo for importer@patchew.org; Mon, 14 Dec 2020 00:10:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39310) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kofwR-0005DR-MX; Sun, 13 Dec 2020 23:58:35 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:56311) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kofwP-0004qr-Kp; Sun, 13 Dec 2020 23:58:35 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4CvTfr3XKVz9sVv; Mon, 14 Dec 2020 15:58:12 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1607921892; bh=rY0cehhbGfyoLbxLkx8x1EhLIWqMaGGMaSfgpnzwzh0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gmRakFLXLl0BxerfAC4h00DIeJ1lZCTc3oYs8PozWwWEYthJ/fVAEcBgMlsax3ISS qx5Zbn5IakeP55jk66y8YFE3CC/BYwEFmTYgRxNpGutSfM2jy9l/ewSdULZF6v63/m 6rtSu6meVorpBybjPu3RxmiPbwoKTnIdBFAvgvbM= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 11/30] ppc/translate: Turn the helper macros into functions Date: Mon, 14 Dec 2020 15:57:48 +1100 Message-Id: <20201214045807.41003-12-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201214045807.41003-1-david@gibson.dropbear.id.au> References: <20201214045807.41003-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2401:3900:2:1::2; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Giuseppe Musacchio , Richard Henderson , qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Giuseppe Musacchio Suggested-by: Richard Henderson Signed-off-by: Giuseppe Musacchio Reviewed-by: Richard Henderson Message-Id: <20201112230130.65262-3-thatlemon@gmail.com> Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 228 ++++++++++++++++++++++------------------ 1 file changed, 123 insertions(+), 105 deletions(-) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 6d3648f5b1..34f5bc1f3c 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -2467,113 +2467,131 @@ void helper_xscmpexpqp(CPUPPCState *env, uint32_t= opcode, do_float_check_status(env, GETPC()); } =20 -#define VSX_SCALAR_CMP(op, ordered) \ -void helper_##op(CPUPPCState *env, uint32_t opcode, \ - ppc_vsr_t *xa, ppc_vsr_t *xb) \ -{ \ - uint32_t cc =3D 0; = \ - bool vxsnan_flag =3D false, vxvc_flag =3D false; = \ - \ - helper_reset_fpstatus(env); \ - \ - 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 && ordered) { = \ - vxvc_flag =3D true; = \ - } \ - } else if (float64_is_quiet_nan(xa->VsrD(0), &env->fp_status) || \ - float64_is_quiet_nan(xb->VsrD(0), &env->fp_status)) { \ - if (ordered) { \ - vxvc_flag =3D true; = \ - } \ - } \ - if (vxsnan_flag) { \ - float_invalid_op_vxsnan(env, GETPC()); \ - } \ - if (vxvc_flag) { \ - float_invalid_op_vxvc(env, 0, GETPC()); \ - } \ - \ - switch (float64_compare(xa->VsrD(0), xb->VsrD(0), &env->fp_status)) {\ - case float_relation_less: \ - cc |=3D CRF_LT; = \ - break; \ - case float_relation_equal: \ - cc |=3D CRF_EQ; = \ - break; \ - case float_relation_greater: \ - cc |=3D CRF_GT; = \ - break; \ - case float_relation_unordered: \ - cc |=3D CRF_SO; = \ - break; \ - } \ - \ - env->fpscr &=3D ~FP_FPCC; = \ - env->fpscr |=3D cc << FPSCR_FPCC; = \ - env->crf[BF(opcode)] =3D cc; = \ - \ - do_float_check_status(env, GETPC()); \ -} - -VSX_SCALAR_CMP(xscmpodp, 1) -VSX_SCALAR_CMP(xscmpudp, 0) - -#define VSX_SCALAR_CMPQ(op, ordered) \ -void helper_##op(CPUPPCState *env, uint32_t opcode, \ - ppc_vsr_t *xa, ppc_vsr_t *xb) \ -{ \ - uint32_t cc =3D 0; \ - bool vxsnan_flag =3D false, vxvc_flag =3D false; = \ - \ - helper_reset_fpstatus(env); \ - \ - if (float128_is_signaling_nan(xa->f128, &env->fp_status) || \ - float128_is_signaling_nan(xb->f128, &env->fp_status)) { \ - vxsnan_flag =3D true; \ - cc =3D CRF_SO; \ - if (fpscr_ve =3D=3D 0 && ordered) { = \ - vxvc_flag =3D true; \ - } \ - } else if (float128_is_quiet_nan(xa->f128, &env->fp_status) || \ - float128_is_quiet_nan(xb->f128, &env->fp_status)) { \ - cc =3D CRF_SO; \ - if (ordered) { \ - vxvc_flag =3D true; \ - } \ - } \ - if (vxsnan_flag) { \ - float_invalid_op_vxsnan(env, GETPC()); \ - } \ - if (vxvc_flag) { \ - float_invalid_op_vxvc(env, 0, GETPC()); \ - } \ - \ - switch (float128_compare(xa->f128, xb->f128, &env->fp_status)) { \ - case float_relation_less: \ - cc |=3D CRF_LT; \ - break; \ - case float_relation_equal: \ - cc |=3D CRF_EQ; \ - break; \ - case float_relation_greater: \ - cc |=3D CRF_GT; \ - break; \ - case float_relation_unordered: \ - cc |=3D CRF_SO; \ - break; \ - } \ - \ - env->fpscr &=3D ~FP_FPCC; \ - env->fpscr |=3D cc << FPSCR_FPCC; \ - env->crf[BF(opcode)] =3D cc; \ - \ - do_float_check_status(env, GETPC()); \ +static inline void do_scalar_cmp(CPUPPCState *env, ppc_vsr_t *xa, ppc_vsr_= t *xb, + int crf_idx, bool ordered) +{ + uint32_t cc; + bool vxsnan_flag =3D false, vxvc_flag =3D false; + + helper_reset_fpstatus(env); + + 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 && ordered) { + vxvc_flag =3D true; + } + } else if (float64_is_quiet_nan(xa->VsrD(0), &env->fp_status) || + float64_is_quiet_nan(xb->VsrD(0), &env->fp_status)) { + if (ordered) { + vxvc_flag =3D true; + } + } + if (vxsnan_flag) { + float_invalid_op_vxsnan(env, GETPC()); + } + if (vxvc_flag) { + float_invalid_op_vxvc(env, 0, GETPC()); + } + + switch (float64_compare(xa->VsrD(0), xb->VsrD(0), &env->fp_status)) { + case float_relation_less: + cc =3D CRF_LT; + break; + case float_relation_equal: + cc =3D CRF_EQ; + break; + case float_relation_greater: + cc =3D CRF_GT; + break; + case float_relation_unordered: + cc =3D CRF_SO; + break; + default: + g_assert_not_reached(); + } + + env->fpscr &=3D ~FP_FPCC; + env->fpscr |=3D cc << FPSCR_FPCC; + env->crf[crf_idx] =3D cc; + + do_float_check_status(env, GETPC()); +} + +void helper_xscmpodp(CPUPPCState *env, uint32_t opcode, ppc_vsr_t *xa, + ppc_vsr_t *xb) +{ + do_scalar_cmp(env, xa, xb, BF(opcode), true); +} + +void helper_xscmpudp(CPUPPCState *env, uint32_t opcode, ppc_vsr_t *xa, + ppc_vsr_t *xb) +{ + do_scalar_cmp(env, xa, xb, BF(opcode), false); +} + +static inline void do_scalar_cmpq(CPUPPCState *env, ppc_vsr_t *xa, + ppc_vsr_t *xb, int crf_idx, bool ordered) +{ + uint32_t cc; + bool vxsnan_flag =3D false, vxvc_flag =3D false; + + helper_reset_fpstatus(env); + + if (float128_is_signaling_nan(xa->f128, &env->fp_status) || + float128_is_signaling_nan(xb->f128, &env->fp_status)) { + vxsnan_flag =3D true; + if (fpscr_ve =3D=3D 0 && ordered) { + vxvc_flag =3D true; + } + } else if (float128_is_quiet_nan(xa->f128, &env->fp_status) || + float128_is_quiet_nan(xb->f128, &env->fp_status)) { + if (ordered) { + vxvc_flag =3D true; + } + } + if (vxsnan_flag) { + float_invalid_op_vxsnan(env, GETPC()); + } + if (vxvc_flag) { + float_invalid_op_vxvc(env, 0, GETPC()); + } + + switch (float128_compare(xa->f128, xb->f128, &env->fp_status)) { + case float_relation_less: + cc =3D CRF_LT; + break; + case float_relation_equal: + cc =3D CRF_EQ; + break; + case float_relation_greater: + cc =3D CRF_GT; + break; + case float_relation_unordered: + cc =3D CRF_SO; + break; + default: + g_assert_not_reached(); + } + + env->fpscr &=3D ~FP_FPCC; + env->fpscr |=3D cc << FPSCR_FPCC; + env->crf[crf_idx] =3D cc; + + do_float_check_status(env, GETPC()); } =20 -VSX_SCALAR_CMPQ(xscmpoqp, 1) -VSX_SCALAR_CMPQ(xscmpuqp, 0) +void helper_xscmpoqp(CPUPPCState *env, uint32_t opcode, ppc_vsr_t *xa, + ppc_vsr_t *xb) +{ + do_scalar_cmpq(env, xa, xb, BF(opcode), true); +} + +void helper_xscmpuqp(CPUPPCState *env, uint32_t opcode, ppc_vsr_t *xa, + ppc_vsr_t *xb) +{ + do_scalar_cmpq(env, xa, xb, BF(opcode), false); +} =20 /* * VSX_MAX_MIN - VSX floating point maximum/minimum --=20 2.29.2