From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35359) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzcFF-0008HF-Jf for qemu-devel@nongnu.org; Thu, 27 Oct 2016 00:24:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bzcFB-0007Ac-Jj for qemu-devel@nongnu.org; Thu, 27 Oct 2016 00:24:49 -0400 Received: from ozlabs.org ([103.22.144.67]:49311) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bzcFB-000763-5p for qemu-devel@nongnu.org; Thu, 27 Oct 2016 00:24:45 -0400 Date: Thu, 27 Oct 2016 13:09:02 +1100 From: David Gibson Message-ID: <20161027020902.GA6291@umbus.fritz.box> References: <1476803431-7208-1-git-send-email-rth@twiddle.net> <1476803431-7208-18-git-send-email-rth@twiddle.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="a8Wt8u1KmwUX3Y2C" Content-Disposition: inline In-Reply-To: <1476803431-7208-18-git-send-email-rth@twiddle.net> Subject: Re: [Qemu-devel] [PATCH v2 17/18] target-ppc: Use the new deposit and extract ops List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: qemu-devel@nongnu.org --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 18, 2016 at 08:10:30AM -0700, Richard Henderson wrote: > Use the new primitives for RDWINM and RLDICL. >=20 > Signed-off-by: Richard Henderson Reviewed-by: David Gibson > --- > target-ppc/translate.c | 35 +++++++++++++++++++---------------- > 1 file changed, 19 insertions(+), 16 deletions(-) >=20 > diff --git a/target-ppc/translate.c b/target-ppc/translate.c > index bfc1301..7b12303 100644 > --- a/target-ppc/translate.c > +++ b/target-ppc/translate.c > @@ -1970,16 +1970,16 @@ static void gen_rlwinm(DisasContext *ctx) > { > TCGv t_ra =3D cpu_gpr[rA(ctx->opcode)]; > TCGv t_rs =3D cpu_gpr[rS(ctx->opcode)]; > - uint32_t sh =3D SH(ctx->opcode); > - uint32_t mb =3D MB(ctx->opcode); > - uint32_t me =3D ME(ctx->opcode); > - > - if (mb =3D=3D 0 && me =3D=3D (31 - sh)) { > - tcg_gen_shli_tl(t_ra, t_rs, sh); > - tcg_gen_ext32u_tl(t_ra, t_ra); > - } else if (sh !=3D 0 && me =3D=3D 31 && sh =3D=3D (32 - mb)) { > - tcg_gen_ext32u_tl(t_ra, t_rs); > - tcg_gen_shri_tl(t_ra, t_ra, mb); > + int sh =3D SH(ctx->opcode); > + int mb =3D MB(ctx->opcode); > + int me =3D ME(ctx->opcode); > + int len =3D me - mb + 1; > + int rsh =3D (32 - sh) & 31; > + > + if (sh !=3D 0 && len > 0 && me =3D=3D (31 - sh)) { > + tcg_gen_deposit_z_tl(t_ra, t_rs, sh, len); > + } else if (me =3D=3D 31 && rsh + len <=3D 32) { > + tcg_gen_extract_tl(t_ra, t_rs, rsh, len); > } else { > target_ulong mask; > #if defined(TARGET_PPC64) > @@ -1987,8 +1987,9 @@ static void gen_rlwinm(DisasContext *ctx) > me +=3D 32; > #endif > mask =3D MASK(mb, me); > - > - if (mask <=3D 0xffffffffu) { > + if (sh =3D=3D 0) { > + tcg_gen_andi_tl(t_ra, t_rs, mask); > + } else if (mask <=3D 0xffffffffu) { > TCGv_i32 t0 =3D tcg_temp_new_i32(); > tcg_gen_trunc_tl_i32(t0, t_rs); > tcg_gen_rotli_i32(t0, t0, sh); > @@ -2091,11 +2092,13 @@ static void gen_rldinm(DisasContext *ctx, int mb,= int me, int sh) > { > TCGv t_ra =3D cpu_gpr[rA(ctx->opcode)]; > TCGv t_rs =3D cpu_gpr[rS(ctx->opcode)]; > + int len =3D me - mb + 1; > + int rsh =3D (64 - sh) & 63; > =20 > - if (sh !=3D 0 && mb =3D=3D 0 && me =3D=3D (63 - sh)) { > - tcg_gen_shli_tl(t_ra, t_rs, sh); > - } else if (sh !=3D 0 && me =3D=3D 63 && sh =3D=3D (64 - mb)) { > - tcg_gen_shri_tl(t_ra, t_rs, mb); > + if (sh !=3D 0 && len > 0 && me =3D=3D (63 - sh)) { > + tcg_gen_deposit_z_tl(t_ra, t_rs, sh, len); > + } else if (me =3D=3D 63 && rsh + len <=3D 64) { > + tcg_gen_extract_tl(t_ra, t_rs, rsh, len); > } else { > tcg_gen_rotli_tl(t_ra, t_rs, sh); > tcg_gen_andi_tl(t_ra, t_ra, MASK(mb, me)); --=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 --a8Wt8u1KmwUX3Y2C Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYEWG7AAoJEGw4ysog2bOSrYAP/1pu+NMKjTcrtH/r0O8hMOzo VTA8wsavOWnI6BhdZ3k7JRy4ZiGVUBO2ShUzo3exzBa6TReV8mdQpdbPK0z+in5a wUh96fAfxgtmXCQ6cqeaJkxYyPiwgvfVx+dE9wcn6mc/wnMOQ4cbmw0x0e3JHN6u WHzrmH4of8ixyFg6U2dds26aRH+svJYLrrAcUZs0ZLW7MmLFWIEF/3qs7H4jEQuE YUQabr4z68QELBvlAArDY4nAHtHr1lVUdvcSc6CnzBuwzWe+usVDY3bV+VHJ6JCh o1kZk8YukgAp6SlKZbCY/d5KDkol8z/9TRwQWCjATzJvVOkyVrjDPcjY45hUtzuw J646Mh/HZJYEsnzH5kS1DgD/PvjkanM2B6dOE0TlsyfvYidcqw+eErJH9v7nGQ3S ZcyLs+wJY3K1GCcimkDolZ1rFGqtQPpdr/EupD/i1AqdKL5rHItcFGWINyZRL5Xj QVhOk3B5XKamLjxEpF+YGpIuRcg/GnAvTMSz/V/73ulKRky0TrWSMyRfM9goeJ9Y Lmdt3au+EIF8pXNMd+2+kWyo+hsk0sNI638WMxH/lbN34ayDIEsPz9Je7OkQ66h8 +e6BPAIVD7B+8IvhTStyatoNdkSnLyTu48AfdLCoo/eqiQObXoSlwhKJAo6b8Rvj BFoGphMsHaIhqtv0E566 =lcJN -----END PGP SIGNATURE----- --a8Wt8u1KmwUX3Y2C--