From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52104) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQSgI-0001RD-AB for qemu-devel@nongnu.org; Fri, 22 Jul 2016 01:07:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQSgG-0006nl-3N for qemu-devel@nongnu.org; Fri, 22 Jul 2016 01:07:25 -0400 Date: Fri, 22 Jul 2016 14:57:49 +1000 From: David Gibson Message-ID: <20160722045749.GP15941@voom.fritz.box> References: <1468861517-2508-1-git-send-email-nikunj@linux.vnet.ibm.com> <1468861517-2508-10-git-send-email-nikunj@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="jh06fhy6YTawvwPV" Content-Disposition: inline In-Reply-To: <1468861517-2508-10-git-send-email-nikunj@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [RFC v1 09/13] target-ppc: add cmpeqb instruction List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nikunj A Dadhania Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, aneesh.kumar@linux.vnet.ibm.com, benh@kernel.crashing.org, Swapnil Bokade , Sandipan Das --jh06fhy6YTawvwPV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 18, 2016 at 10:35:13PM +0530, Nikunj A Dadhania wrote: > From: Swapnil Bokade >=20 > Search a byte in the stream of 8bytes provided in the register >=20 > Signed-off-by: Sandipan Das > [ Modified the logic to use lesser temporaries ] > Signed-off-by: Nikunj A Dadhania rth's reference may obsolete the suggestions below. > --- > target-ppc/translate.c | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) >=20 > diff --git a/target-ppc/translate.c b/target-ppc/translate.c > index a57f7dd..8f7ff49 100644 > --- a/target-ppc/translate.c > +++ b/target-ppc/translate.c > @@ -856,6 +856,32 @@ static void gen_cmprb(DisasContext *ctx) > tcg_temp_free(src2hi); > } > =20 > +/* cmpeqb */ > +static void gen_cmpeqb(DisasContext *ctx) > +{ > + TCGLabel *l1 =3D gen_new_label(); > + TCGLabel *l2 =3D gen_new_label(); > + TCGv src1 =3D tcg_temp_local_new(); > + TCGv t0 =3D tcg_temp_local_new(); > + TCGv arg1 =3D cpu_gpr[rB(ctx->opcode)]; > + int i; > + > + tcg_gen_andi_tl(src1, cpu_gpr[rA(ctx->opcode)], 0xFF); > + for (i =3D 0; i < 64; i +=3D 8) { > + tcg_gen_shri_tl(t0, arg1, i); > + tcg_gen_andi_tl(t0, t0, 0xFF); Shifting direct from the original arg each time seems awkward when you can just shift a working reg by 8 bits each loop. I suspect that could save you a temporary. > + tcg_gen_brcond_tl(TCG_COND_EQ, src1, t0, l1); > + } > + tcg_gen_movi_i32(cpu_crf[crfD(ctx->opcode)], 0); > + tcg_gen_br(l2); > + gen_set_label(l1); > + /* Set match bit, i.e. CRF_GT */ > + tcg_gen_movi_i32(cpu_crf[crfD(ctx->opcode)], 1 << CRF_GT); > + gen_set_label(l2); You should only need one branch at most, either by initializing the CRF first, or by moving a variable to it. > + tcg_temp_free(src1); > + tcg_temp_free(t0); > +} > + > /* isel (PowerPC 2.03 specification) */ > static void gen_isel(DisasContext *ctx) > { > @@ -10040,6 +10066,7 @@ GEN_HANDLER(cmp, 0x1F, 0x00, 0x00, 0x00400000, PP= C_INTEGER), > GEN_HANDLER(cmpi, 0x0B, 0xFF, 0xFF, 0x00400000, PPC_INTEGER), > GEN_HANDLER(cmpl, 0x1F, 0x00, 0x01, 0x00400000, PPC_INTEGER), > GEN_HANDLER(cmpli, 0x0A, 0xFF, 0xFF, 0x00400000, PPC_INTEGER), > +GEN_HANDLER_E(cmpeqb, 0x1F, 0x00, 0x07, 0x00600000, PPC_NONE, PPC2_ISA30= 0), > GEN_HANDLER_E(cmpb, 0x1F, 0x1C, 0x0F, 0x00000001, PPC_NONE, PPC2_ISA205), > GEN_HANDLER_E(cmprb, 0x1F, 0x00, 0x06, 0x00400001, PPC_NONE, PPC2_ISA300= ), > GEN_HANDLER(isel, 0x1F, 0x0F, 0xFF, 0x00000001, PPC_ISEL), --=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 --jh06fhy6YTawvwPV Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXkafNAAoJEGw4ysog2bOSIEAP+gOf/EQ6gmly1sLIh1rEQiNJ sLlsfORMm/yX5YOR3RHjOLUrlJlrZy75NSZjRmRkgwINXU90oaP5ZJUtT9bYPHR2 Kme4O3vgX7fY+05Y6UQnUPdMMMMiMVFi0pvW1r2u3/FF4VK70Kcz/fd3vptzWdcP 9if2KMZSEx0yaEdG6P+2WHb9Cp2Nu/moy3ogkXdYhUBcTJEpvP4Y/YD0cQbBosrX 3AL8RqzYEplvjH25wdgaDStXk2SIr4ht6nc1QIEYjZsSI4J2WVWlXo7itPLjyicX HNA79cc6FlEv3EwM42u79yJoTs0EqHcYtMruwl+UYs6Xfc/LJGDhQtGJuCAiZGKo zNV+yqSL/UlnGoR8MMoIuozr3mW/bN4vPS73ykQD6n2tCpU2DPJ6e/ttfg5/PhUi /4wOArR45ztMTVCG/ycM51yoCgPURAcC3eqiH9SZD2qvHdfEh4O/cUccjtd9Xqtb apJWq+dVV1YWRlIBYYu3h/NmDFlUQ0T0JRa/p+fp0C+rcp5BbtsjRPmo66Tk5851 Ix5rY6jXCPJBF5pMu7qWXG23eaVOcZrJlNFuPTQJycS0GtMTGWtCPwL/PoOOz0YI J+KSZLioDCIkosuaBxNEsKNgFjLw6bLsSK2h7DzcRk3x5fmyO/37TJQOr+1ZO7F4 P2yCubsEiVQ/ol2HvowB =WT+W -----END PGP SIGNATURE----- --jh06fhy6YTawvwPV--