From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59252) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YW6FK-0004fB-2c for qemu-devel@nongnu.org; Thu, 12 Mar 2015 12:46:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YW6FG-0002Ie-Ri for qemu-devel@nongnu.org; Thu, 12 Mar 2015 12:46:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60580) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YW6FG-0002Ia-JN for qemu-devel@nongnu.org; Thu, 12 Mar 2015 12:46:02 -0400 Message-ID: <5501C2C6.1060501@redhat.com> Date: Thu, 12 Mar 2015 10:45:58 -0600 From: Eric Blake MIME-Version: 1.0 References: <1424694237-22786-1-git-send-email-aik@ozlabs.ru> <877fv8sp97.fsf@blackfin.pond.sub.org> <54ED19E9.4050503@ozlabs.ru> <877fv6gth5.fsf@blackfin.pond.sub.org> <5501B0CC.3090500@twiddle.net> In-Reply-To: <5501B0CC.3090500@twiddle.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="B94bKDSMXFerQBQNsUedeP4qAVlNoPlaF" Subject: Re: [Qemu-devel] [PATCH v2] utils: Add pow2ceil() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson , Markus Armbruster , Alexey Kardashevskiy Cc: Peter Maydell , qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --B94bKDSMXFerQBQNsUedeP4qAVlNoPlaF Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 03/12/2015 09:29 AM, Richard Henderson wrote: > On 02/25/2015 02:45 AM, Markus Armbruster wrote: >> return 0x8000000000000000u >> (clz64(value - 1) - 1); >=20 > I realize this was weeks ago, but it would certainly be preferable to s= hift a > small constant left than a large constant right. >=20 > Most RISC machines can't form 0x8000000000000000ull without loading 1 a= nd then > left shifting to start with. So end the end you're better off with >=20 > return 1ull << (63 - clz64(value)); Since the value being shifted is a constant either way, can't gcc figure out the equivalence and generate the optimal code to begin with? If not, should it be opened as a gcc bug for potential optimization? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --B94bKDSMXFerQBQNsUedeP4qAVlNoPlaF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVAcLGAAoJEKeha0olJ0NqaPMIAKHcLPK6ti990huMyB9GNoY/ SmNFzdAQF6Sjmu+kmXGV+cLy4P4grEK/UQxEh6DSuY9SlYJOqMcuCkqDsmzMt41n ZrJfNZ5pMcXzF4CDu7YgqyebLddFfsZexSafHSyjGlfZ3AuJL1biF6v/CZDZGjll UNTiG3R13reu5WaF4kJmzTCu+AKaRHzW8EXs2JUysyli2+NKKARbgFTkcHOpqtlI DhO0jIZt0uLpBQkoCMbo+qJE9DqUnImlbaUOcdfLgHgiIccx2o/xTHirI/VaVkur 9uVQ1yAwdnrQTzpFOBjNkc/ZdIpbEO+6F1GGQnTZ5yONlQazHjLX/KtAvCdI1Hc= =7hFV -----END PGP SIGNATURE----- --B94bKDSMXFerQBQNsUedeP4qAVlNoPlaF--