From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45467) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkNYg-0005tK-14 for qemu-devel@nongnu.org; Wed, 14 Sep 2016 23:41:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bkNYd-0004l0-QM for qemu-devel@nongnu.org; Wed, 14 Sep 2016 23:41:53 -0400 Date: Thu, 15 Sep 2016 11:44:54 +1000 From: David Gibson Message-ID: <20160915014454.GL15077@voom.fritz.box> References: <1473662506-27441-1-git-send-email-nikunj@linux.vnet.ibm.com> <1473662506-27441-17-git-send-email-nikunj@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7JrJW0wW5qTeyr+Y" Content-Disposition: inline In-Reply-To: <1473662506-27441-17-git-send-email-nikunj@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH RESEND v2 16/17] target-ppc: improve stxvw4x implementation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nikunj A Dadhania Cc: qemu-ppc@nongnu.org, rth@twiddle.net, qemu-devel@nongnu.org, benh@kernel.crashing.org --7JrJW0wW5qTeyr+Y Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 12, 2016 at 12:11:45PM +0530, Nikunj A Dadhania wrote: > Manipulate data and store 8bytes instead of 4bytes. >=20 > Signed-off-by: Nikunj A Dadhania > --- > target-ppc/translate/vsx-impl.inc.c | 27 +++++++++++++-------------- > 1 file changed, 13 insertions(+), 14 deletions(-) >=20 > diff --git a/target-ppc/translate/vsx-impl.inc.c b/target-ppc/translate/v= sx-impl.inc.c > index caa6660..f2fc5f9 100644 > --- a/target-ppc/translate/vsx-impl.inc.c > +++ b/target-ppc/translate/vsx-impl.inc.c > @@ -205,7 +205,8 @@ static void gen_stxvd2x(DisasContext *ctx) > =20 > static void gen_stxvw4x(DisasContext *ctx) > { > - TCGv_i64 tmp; > + TCGv_i64 xsh =3D cpu_vsrh(xS(ctx->opcode)); > + TCGv_i64 xsl =3D cpu_vsrl(xS(ctx->opcode)); > TCGv EA; > if (unlikely(!ctx->vsx_enabled)) { > gen_exception(ctx, POWERPC_EXCP_VSXU); > @@ -214,21 +215,19 @@ static void gen_stxvw4x(DisasContext *ctx) > gen_set_access_type(ctx, ACCESS_INT); > EA =3D tcg_temp_new(); > gen_addr_reg_index(ctx, EA); > - tmp =3D tcg_temp_new_i64(); > - > - tcg_gen_shri_i64(tmp, cpu_vsrh(xS(ctx->opcode)), 32); > - gen_qemu_st32_i64(ctx, tmp, EA); > - tcg_gen_addi_tl(EA, EA, 4); > - gen_qemu_st32_i64(ctx, cpu_vsrh(xS(ctx->opcode)), EA); > - > - tcg_gen_shri_i64(tmp, cpu_vsrl(xS(ctx->opcode)), 32); > - tcg_gen_addi_tl(EA, EA, 4); > - gen_qemu_st32_i64(ctx, tmp, EA); > - tcg_gen_addi_tl(EA, EA, 4); > - gen_qemu_st32_i64(ctx, cpu_vsrl(xS(ctx->opcode)), EA); > =20 > + if (ctx->le_mode) { > + tcg_gen_qemu_st_i64(xsh, EA, ctx->mem_idx, MO_BEQ); This looks wrong again. The BE store will storethe two 32-bit halves in the right order, but nothing swaps the bytes within those halves back to LE. > + tcg_gen_addi_tl(EA, EA, 8); > + tcg_gen_qemu_st_i64(xsl, EA, ctx->mem_idx, MO_BEQ); > + } else { > + gen_helper_bswap32x2(xsh, xsh); > + tcg_gen_qemu_st_i64(xsh, EA, ctx->mem_idx, MO_LEQ); Whereas the LE store here will also get the bytes within each 32-bit word in the wrong order for a BE guest. (bswap32x2 possibly should be fixing that, but doesn't). > + tcg_gen_addi_tl(EA, EA, 8); > + gen_helper_bswap32x2(xsl, xsl); > + tcg_gen_qemu_st_i64(xsl, EA, ctx->mem_idx, MO_LEQ); > + } > tcg_temp_free(EA); > - tcg_temp_free_i64(tmp); > } > =20 > #define MV_VSRW(name, tcgop1, tcgop2, target, source) \ --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --7JrJW0wW5qTeyr+Y Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBAgAGBQJX2f0WAAoJEGw4ysog2bOST1kP/R6+JS9liDFWYhb2XALLhnNl BUt724FYpy/kVFo/DN1L3FKtorU60IAEhQuIEGqFOo/c+yirHX5uZtkXVMunuWan b7DCG/m63fgWKCSFgcO1RACCSNJSjlB5EEdMeJLsGVaswgq7UilCzb78jXhD1E0R EWC3DCl2EjD55nbY1QUJ4G3ZcLDUSrSsmfac0DmD0HaakIOFQtzJW1EMOGLNqsLX nP0jsCMXCIBexi/IKWEkglYHfujj3NxGQVQCC3cechsQOnAcNJ1pYmLr+FeSCiTh DeAOSjMyy8M4lPf21qgJiCW1QZAIxsgaSQqK8pcnqDvKZr9PZNwEYCEpv5GQhrp4 UPuh6ui3Cledakqp8iNBEwQ/fo47fFf+YKUDhHRiPuwhux2kUacVE28iKt7BkqDe hdgdtGUxGoOHVfOvTSlHoTjkKSKZD2fMFfr6fgw5jARTEh9AV2x6d+eM2MlYNfWV vTnv/TKZ0boU7LxKkJamfjOedkTsalfe/ra4UEKRRyeWr7A4MGf0dgVNfH1aUQl3 IXErKOzl06UIKKNk4WSbNkqM7bCQPD9StNvGpszHTvgzbpaZEQaJMcfogskfyAIa va1slJGAgvDImA9mo5MXxRK9VjaaAf41b5l3mw29RVZA9kzZIZrJZRWRCdbQnhqM qqYo1oXAiCDlyMDfa2Ki =oXQF -----END PGP SIGNATURE----- --7JrJW0wW5qTeyr+Y--