From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60350) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cDjrx-0005J9-Uz for qemu-devel@nongnu.org; Sun, 04 Dec 2016 22:23:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cDjrw-0008M7-Ka for qemu-devel@nongnu.org; Sun, 04 Dec 2016 22:23:09 -0500 Date: Mon, 5 Dec 2016 12:56:39 +1100 From: David Gibson Message-ID: <20161205015639.GB12426@umbus.fritz.box> References: <1480741206-32737-1-git-send-email-joserz@linux.vnet.ibm.com> <1480741206-32737-3-git-send-email-joserz@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="+pHx0qQiF2pBVqBT" Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH 2/7] target-ppc: Implement unsigned quadword left/right shift and unit tests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: Jose Ricardo Ziviani , qemu-ppc@nongnu.org, bharata@linux.vnet.ibm.com, qemu-devel@nongnu.org, nikunj@linux.vnet.ibm.com --+pHx0qQiF2pBVqBT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Dec 03, 2016 at 05:37:27PM -0800, Richard Henderson wrote: > On 12/02/2016 09:00 PM, Jose Ricardo Ziviani wrote: > > +++ b/include/qemu/host-utils.h > > @@ -29,6 +29,33 @@ > > #include "qemu/bswap.h" > >=20 > > #ifdef CONFIG_INT128 > > +static inline void urshift(uint64_t *plow, uint64_t *phigh, uint32_t s= hift) > > +{ > > + __uint128_t val =3D ((__uint128_t)*phigh << 64) | *plow; > > + val >>=3D (shift & 127); > > + *phigh =3D val >> 64; > > + *plow =3D val & 0xffffffffffffffff; > > +} > > + > > +static inline void ulshift(uint64_t *plow, uint64_t *phigh, > > + uint32_t shift, bool *overflow) > > +{ > > + __uint128_t val =3D ((__uint128_t)*phigh << 64) | *plow; > > + > > + if (shift =3D=3D 0) { > > + return; > > + } > > + > > + if (shift > 127 || (val >> (128 - (shift & 127))) !=3D 0) { > > + *overflow =3D true; > > + } > > + > > + val <<=3D (shift & 127); > > + > > + *phigh =3D val >> 64; > > + *plow =3D val & 0xffffffffffffffff; > > +} > > + >=20 > This belongs in qemu/int128.h, not here. And certainly not predicated on > CONFIG_INT128. Is there actually any advantage to the __uint128_t based versions over the 64-bit versions? --=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 --+pHx0qQiF2pBVqBT Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYRMlUAAoJEGw4ysog2bOSzP0P/RDTpQnhywtKKuU0Mqro9N4I iTUsZBEasE4XLFw62b8ZnJ/R6SUSkNhRprWkoR9kDJLTEvcMyq3r3z3qztQpCQtI usDscX1xPJSFgIjvmp5feyehkL5hpnIdJXjS1bmJvVEbd+9SivZ0FWWW/ftTD9e9 81CAb4l6ZGemh/nyPM810L8WlOEnj9dsB9jgE6bamo3UPkOtxlnK5KGYxs5/jZUP YbklgM2oAKEQ+75E8uXwybJXgvjadwHEiQw5CzzW6fpSwPckBGbCLfsZfErbvXY5 FgK6S158rzUffrSQvq6F138YgBASM0EPBAyX5wIf8m5iIivtOPsYqG0EvHa6flXO v6wEjssdKu6yQzzJh11/MwdMy5/NR+0ZYCJwBjD4H3F/qHTmX+/lh0rVQ6T//j1o JwD83A90WFFG1v2ZUOiFTc47iwKLaWCjOUx3WrobUDAnqA4NcgoqUntQrlBsPk4P 65RHXc3e4ranW2ZdQ8XpthRJzDwuPj9C83cTP4UkMlNLV1YqhZdx5Gn2/0tqfDGd cztE0IEAj1gAWCD6JfCJCSIupaQFj/ZgRxH8NY0bW3CzoVnLT4bqkVb8EDGSjURi 08lmSEeoo5v8fL0Mb4kxdVFRcsFYzKZSoRezh0SWoDrrdznw/PNeiBUTFblS7EZE GAO1a9ctHwS9e64t4yxy =04AL -----END PGP SIGNATURE----- --+pHx0qQiF2pBVqBT--