From nobody Thu Nov 6 20:38:30 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.zoho.com; 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487746478060948.6837856300765; Tue, 21 Feb 2017 22:54:38 -0800 (PST) Received: from localhost ([::1]:50226 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgQou-0005mD-Jv for importer@patchew.org; Wed, 22 Feb 2017 01:54:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37767) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgQV5-000316-N0 for qemu-devel@nongnu.org; Wed, 22 Feb 2017 01:34:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgQV3-0007zY-E2 for qemu-devel@nongnu.org; Wed, 22 Feb 2017 01:34:07 -0500 Received: from ozlabs.org ([103.22.144.67]:34831) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgQV2-0007wm-K7; Wed, 22 Feb 2017 01:34:05 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vSndJ53jQz9s9Y; Wed, 22 Feb 2017 17:33:54 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1487745236; bh=/ah8/2z5Zr8D1EuRm1WRbr3BBkVzM3n/FVSnSKa0ziM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LxEH4+/koO2WOQcPi74jifi5CJR37GHgdaI2bnLtpkqzWgHxpZXcQQpYr0+loSx12 D0u0NHe1HULDhUljP4QTJ/QGPQQCWDwg6o2ps7LOp8hsFWXlBWcWbrbJYbPEPve4IT qnLFG+J0ic1pgUIDaJzP73jiXFGpjYGXIGKq2NWU= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 22 Feb 2017 17:33:15 +1100 Message-Id: <20170222063348.32176-11-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170222063348.32176-1-david@gibson.dropbear.id.au> References: <20170222063348.32176-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 10/43] target-ppc: Add xsmaxjdp and xsminjdp instructions 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, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, qemu-ppc@nongnu.org, Bharata B Rao , imammedo@redhat.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bharata B Rao xsmaxjdp: VSX Scalar Maximum Type-J Double-Precision xsminjdp: VSX Scalar Minimum Type-J Double-Precision Signed-off-by: Bharata B Rao Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 55 +++++++++++++++++++++++++++++++++= ++++ target/ppc/helper.h | 2 ++ target/ppc/translate/vsx-impl.inc.c | 2 ++ target/ppc/translate/vsx-ops.inc.c | 2 ++ 4 files changed, 61 insertions(+) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 9d2688e..1b6cd3b 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -2717,6 +2717,61 @@ void helper_##name(CPUPPCState *env, uint32_t opcode= ) \ VSX_MAX_MINC(xsmaxcdp, 1); VSX_MAX_MINC(xsmincdp, 0); =20 +#define VSX_MAX_MINJ(name, max) = \ +void helper_##name(CPUPPCState *env, uint32_t opcode) = \ +{ = \ + ppc_vsr_t xt, xa, xb; = \ + bool vxsnan_flag =3D false, vex_flag =3D false; = \ + = \ + getVSR(rA(opcode) + 32, &xa, env); = \ + getVSR(rB(opcode) + 32, &xb, env); = \ + getVSR(rD(opcode) + 32, &xt, env); = \ + = \ + if (unlikely(float64_is_any_nan(xa.VsrD(0)))) { = \ + if (float64_is_signaling_nan(xa.VsrD(0), &env->fp_status)) { = \ + vxsnan_flag =3D true; = \ + } = \ + xt.VsrD(0) =3D xa.VsrD(0); = \ + } else if (unlikely(float64_is_any_nan(xb.VsrD(0)))) { = \ + if (float64_is_signaling_nan(xb.VsrD(0), &env->fp_status)) { = \ + vxsnan_flag =3D true; = \ + } = \ + xt.VsrD(0) =3D xb.VsrD(0); = \ + } else if (float64_is_zero(xa.VsrD(0)) && float64_is_zero(xb.VsrD(0)))= { \ + if (max) { = \ + if (!float64_is_neg(xa.VsrD(0)) || !float64_is_neg(xb.VsrD(0))= ) { \ + xt.VsrD(0) =3D 0ULL; = \ + } else { = \ + xt.VsrD(0) =3D 0x8000000000000000ULL; = \ + } = \ + } else { = \ + if (float64_is_neg(xa.VsrD(0)) || float64_is_neg(xb.VsrD(0))) = { \ + xt.VsrD(0) =3D 0x8000000000000000ULL; = \ + } else { = \ + xt.VsrD(0) =3D 0ULL; = \ + } = \ + } = \ + } else if ((max && = \ + !float64_lt(xa.VsrD(0), xb.VsrD(0), &env->fp_status)) || = \ + (!max && = \ + float64_lt(xa.VsrD(0), xb.VsrD(0), &env->fp_status))) { = \ + xt.VsrD(0) =3D xa.VsrD(0); = \ + } else { = \ + xt.VsrD(0) =3D xb.VsrD(0); = \ + } = \ + = \ + vex_flag =3D fpscr_ve & vxsnan_flag; = \ + if (vxsnan_flag) { = \ + float_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN, 0); = \ + } = \ + if (!vex_flag) { = \ + putVSR(rD(opcode) + 32, &xt, env); = \ + } = \ +} = \ + +VSX_MAX_MINJ(xsmaxjdp, 1); +VSX_MAX_MINJ(xsminjdp, 0); + /* VSX_CMP - VSX floating point compare * op - instruction mnemonic * nels - number of elements (1, 2 or 4) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index fe3267e..cc81709 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -433,6 +433,8 @@ DEF_HELPER_2(xsmaxdp, void, env, i32) DEF_HELPER_2(xsmindp, void, env, i32) DEF_HELPER_2(xsmaxcdp, void, env, i32) DEF_HELPER_2(xsmincdp, void, env, i32) +DEF_HELPER_2(xsmaxjdp, void, env, i32) +DEF_HELPER_2(xsminjdp, void, env, i32) DEF_HELPER_2(xscvdphp, void, env, i32) DEF_HELPER_2(xscvdpqp, void, env, i32) DEF_HELPER_2(xscvdpsp, void, env, i32) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 3251dca..8de8cd0 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -810,6 +810,8 @@ GEN_VSX_HELPER_2(xsmaxdp, 0x00, 0x14, 0, PPC2_VSX) GEN_VSX_HELPER_2(xsmindp, 0x00, 0x15, 0, PPC2_VSX) GEN_VSX_HELPER_2(xsmaxcdp, 0x00, 0x10, 0, PPC2_ISA300) GEN_VSX_HELPER_2(xsmincdp, 0x00, 0x11, 0, PPC2_ISA300) +GEN_VSX_HELPER_2(xsmaxjdp, 0x00, 0x12, 0, PPC2_ISA300) +GEN_VSX_HELPER_2(xsminjdp, 0x00, 0x12, 0, PPC2_ISA300) GEN_VSX_HELPER_2(xscvdphp, 0x16, 0x15, 0x11, PPC2_ISA300) GEN_VSX_HELPER_2(xscvdpsp, 0x12, 0x10, 0, PPC2_VSX) GEN_VSX_HELPER_2(xscvdpqp, 0x04, 0x1A, 0x16, PPC2_ISA300) diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 16a135f..c1b71ad 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -202,6 +202,8 @@ GEN_XX3FORM(xsmaxdp, 0x00, 0x14, PPC2_VSX), GEN_XX3FORM(xsmindp, 0x00, 0x15, PPC2_VSX), GEN_XX3FORM(xsmaxcdp, 0x00, 0x10, PPC2_ISA300), GEN_XX3FORM(xsmincdp, 0x00, 0x11, PPC2_ISA300), +GEN_XX3FORM(xsmaxjdp, 0x00, 0x12, PPC2_ISA300), +GEN_XX3FORM(xsminjdp, 0x00, 0x13, PPC2_ISA300), GEN_XX2FORM_EO(xscvdphp, 0x16, 0x15, 0x11, PPC2_ISA300), GEN_XX2FORM(xscvdpsp, 0x12, 0x10, PPC2_VSX), GEN_XX2FORM(xscvdpspn, 0x16, 0x10, PPC2_VSX207), --=20 2.9.3