Received: from eggs.gnu.org ([2001:4830:134:3::10]:53772) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bup4y-00037t-1b for qemu-devel@nongnu.org; Thu, 13 Oct 2016 19:06:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bup4t-0001kT-0R for qemu-devel@nongnu.org; Thu, 13 Oct 2016 19:06:22 -0400 Date: Fri, 14 Oct 2016 09:31:01 +1100 From: David Gibson Message-ID: <20161013223101.GQ18039@umbus.fritz.box> References: <1476248933-25562-1-git-send-email-nikunj@linux.vnet.ibm.com> <1476248933-25562-4-git-send-email-nikunj@linux.vnet.ibm.com> <20161013002145.GE18039@umbus.fritz.box> <3cd35fe1-e646-8830-7f57-dcd75b173dca@twiddle.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="uRjmd8ppyyws0Tml" Content-Disposition: inline In-Reply-To: <3cd35fe1-e646-8830-7f57-dcd75b173dca@twiddle.net> Subject: Re: [Qemu-devel] [PATCH v1 3/3] target-ppc: implement xxbr[qdwh] instruction List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: Nikunj A Dadhania , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, benh@kernel.crashing.org --uRjmd8ppyyws0Tml Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Oct 13, 2016 at 01:14:35PM -0500, Richard Henderson wrote: > On 10/12/2016 07:21 PM, David Gibson wrote: > > > +static void gen_bswap32x4(TCGv_i64 outh, TCGv_i64 outl, > > > + TCGv_i64 inh, TCGv_i64 inl) > > > +{ > > > + TCGv_i64 hi =3D tcg_temp_new_i64(); > > > + TCGv_i64 lo =3D tcg_temp_new_i64(); > > > + > > > + tcg_gen_bswap64_i64(hi, inh); > > > + tcg_gen_bswap64_i64(lo, inl); > > > + tcg_gen_shri_i64(outh, hi, 32); > > > + tcg_gen_deposit_i64(outh, outh, hi, 32, 32); > > > + tcg_gen_shri_i64(outl, lo, 32); > > > + tcg_gen_deposit_i64(outl, outl, lo, 32, 32); > > > + > > > + tcg_temp_free_i64(hi); > > > + tcg_temp_free_i64(lo); > > > +} > >=20 > > Is there actually any advantage to having this 128-bit operation > > working on two 64-bit "register"s, as opposed to having a bswap32x2 > > that operates on a single 64-bit register amd calling it twice? >=20 > For this one, no particular advantage. >=20 > > > + gen_bswap16x8(xth, xtl, xbh, xbl); > >=20 > > Likewise for the 16x8 version, I guess, although that would mean > > changing the existing users. >=20 > For this one, we have to build a 64-bit constant, 0x00ff00ff00ff00ff. On > some hosts that's up to 6 insns. Being about to reuse that for both swaps > is useful. Ah, good point. > > > + tcg_gen_bswap64_i64(t0, xbl); > > > + tcg_gen_bswap64_i64(xtl, xbh); > > > + tcg_gen_bswap64_i64(xth, t0); > >=20 > > This looks wrong. You swap xbl as you move it to t0, then swap it > > again as you put it back into xth. So it looks like you'll translate > > 0011223344556677 8899AABBCCDDEEFF > > to > > 8899AABBCCDDEEFF 7766554433221100 > > whereas it should become > > FFEEDDCCBBAA9977 7766554433221100 >=20 > Indeed, the third line should be a move, not a swap. >=20 >=20 > r~ >=20 --=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 --uRjmd8ppyyws0Tml Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYAAslAAoJEGw4ysog2bOSKcgP/jHccO80AFHjjvaVxALShCq7 ZGY2pEdtYg1jECGCZuybvmPVzX7uBbH/109SahfBRvHX7pezyzwJ9614jB5iJckm 4h6cltS2X3EjfsC512i8CIvYFeEPbpa6IKUxGAs3+epReAEWZu+0iC4j0LIxNoTh bFJF2tp1aieJwzsp7myxP9BScvDMbAiyn84qcyJf1AYkTHi6ld45nQ9zogNAmOOq GXFYQdxxkiBEFvrqz6rhk2sotFalByYQmgHz5LRqeHppqTJYI6MEvg05TzOLGfDi 4Pzc6udvdPlo4ZPWumHIQsBTci3qOLzYBD3SvQeY8PhBVETgCyyOimLz+lYwLCaF aD0vA5UWdWQM6mBLf4iVbyBJ8s7d/Mk3YeXR2WdFztySYbIAnNEjNZTX40gDcq75 uYem+xL+FGO9jzrPFan9rbe7hfpUJSSdjsUQHK4giut6HXJivEGUhH1J5Y+ssCkK vufWF5/fm685GcKUVpqlLOmXT/2REwCqVlNLMA3zLRXg8Z1OUoM8SzWV+5PXtjLM dOSpIaoZilY6m4yXRGwip8feCN2IVvxqTlNK7PFcCGq3ZApNcLkBPDQfAc2dHwbJ zvTt4l4IOQgJHT/hgkRBbuE2gOC5J3BzHTV9/4vW3EyDYtFykhwIMs/Xa/tD4r1X OTaSvNq1XRDJ6Fka6blt =aPJQ -----END PGP SIGNATURE----- --uRjmd8ppyyws0Tml--