From nobody Sat Jul 12 15:10:28 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 1486015508182116.50531248145285; Wed, 1 Feb 2017 22:05:08 -0800 (PST) Received: from localhost ([::1]:54476 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAW2-0005hV-1L for importer@patchew.org; Thu, 02 Feb 2017 01:05:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51768) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jw-0007VB-24 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jr-0003sU-BM for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:24 -0500 Received: from ozlabs.org ([103.22.144.67]:39965) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jq-0003oe-S4; Thu, 02 Feb 2017 00:15:19 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqS28Hzz9s86; Thu, 2 Feb 2017 16:14:58 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012500; bh=0b1hM6O7nm2YzJX6OKmOuyo9+QVJydMg1nK1+evzzAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UI52rtPLm16cfavsR+FAxwrRdoF2u4f1Ok8J414QIsmeFu9KDYc31zg21yKejchX6 1CtW7OzROw3oO1l1EsZMZS6/1sBI4mLGp8ANa0fbM4XEGHEZYW62cLNE8B4M9m2YRl eEkfW9OAqnJB9Xteujtq2EoW7Z3N/fdeXrxzGQTQ= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:45 +1100 Message-Id: <20170202051445.5735-48-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-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 047/107] target-ppc: Add xxinsertw instruction 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, aik@ozlabs.ru, qemu-ppc@nongnu.org, 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: Nikunj A Dadhania xxinsertw: VSX Vector Insert Word Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/helper.h | 1 + target/ppc/int_helper.c | 25 +++++++++++++++++++++++++ target/ppc/translate/vsx-impl.inc.c | 5 +++-- target/ppc/translate/vsx-ops.inc.c | 1 + 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index ead799c..a4504eb 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -536,6 +536,7 @@ DEF_HELPER_2(xvrspiz, void, env, i32) DEF_HELPER_2(xxperm, void, env, i32) DEF_HELPER_2(xxpermr, void, env, i32) DEF_HELPER_4(xxextractuw, void, env, tl, tl, i32) +DEF_HELPER_4(xxinsertw, void, env, tl, tl, i32) =20 DEF_HELPER_2(efscfsi, i32, env, i32) DEF_HELPER_2(efscfui, i32, env, i32) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 07832ba..81f134b 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -2027,6 +2027,31 @@ void helper_xxextractuw(CPUPPCState *env, target_ulo= ng xtn, putVSR(xtn, &xt, env); } =20 +void helper_xxinsertw(CPUPPCState *env, target_ulong xtn, + target_ulong xbn, uint32_t index) +{ + ppc_vsr_t xt, xb; + size_t es =3D sizeof(uint32_t); + int ins_index, i =3D 0; + + getVSR(xbn, &xb, env); + getVSR(xtn, &xt, env); + +#if defined(HOST_WORDS_BIGENDIAN) + ins_index =3D index; + for (i =3D 0; i < es && ins_index < 16; i++, ins_index++) { + xt.u8[ins_index] =3D xb.u8[8 - es + i]; + } +#else + ins_index =3D 15 - index; + for (i =3D es - 1; i >=3D 0 && ins_index >=3D 0; i--, ins_index--) { + xt.u8[ins_index] =3D xb.u8[8 + i]; + } +#endif + + putVSR(xtn, &xt, env); +} + #define VEXT_SIGNED(name, element, mask, cast, recast) \ void helper_##name(ppc_avr_t *r, ppc_avr_t *b) \ { \ diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 7977f24..c9ba0f5 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -1180,7 +1180,7 @@ static void gen_xxsldwi(DisasContext *ctx) tcg_temp_free_i64(xtl); } =20 -#define VSX_EXTRACT(name) \ +#define VSX_EXTRACT_INSERT(name) \ static void gen_##name(DisasContext *ctx) \ { \ TCGv xt, xb; \ @@ -1208,7 +1208,8 @@ static void gen_##name(DisasContext *ctx) = \ tcg_temp_free_i32(t0); \ } =20 -VSX_EXTRACT(xxextractuw) +VSX_EXTRACT_INSERT(xxextractuw) +VSX_EXTRACT_INSERT(xxinsertw) =20 #undef GEN_XX2FORM #undef GEN_XX3FORM diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 473d925..096d358 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -285,6 +285,7 @@ GEN_XX2FORM(xxspltw, 0x08, 0x0A, PPC2_VSX), GEN_XX1FORM(xxspltib, 0x08, 0x0B, PPC2_ISA300), GEN_XX3FORM_DM(xxsldwi, 0x08, 0x00), GEN_XX2FORM_EXT(xxextractuw, 0x0A, 0x0A, PPC2_ISA300), +GEN_XX2FORM_EXT(xxinsertw, 0x0A, 0x0B, PPC2_ISA300), =20 #define GEN_XXSEL_ROW(opc3) \ GEN_HANDLER2_E(xxsel, "xxsel", 0x3C, 0x18, opc3, 0, PPC_NONE, PPC2_VSX), \ --=20 2.9.3