From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 118956 invoked by alias); 13 Mar 2017 04:41:47 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 112198 invoked by uid 89); 13 Mar 2017 04:41:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: smtp.gentoo.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 13 Mar 2017 04:41:45 +0000 Received: from vapier (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with SMTP id 5C31833BEFC; Mon, 13 Mar 2017 04:41:44 +0000 (UTC) Date: Mon, 13 Mar 2017 04:41:00 -0000 From: Mike Frysinger To: Jim Wilson Cc: gdb-patches@sourceware.org Subject: popcount support Message-ID: <20170313044143.GV31094@vapier> Mail-Followup-To: Jim Wilson , gdb-patches@sourceware.org References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="tqN4RWvJTb9VNux/" Content-Disposition: inline In-Reply-To: X-IsSubscribed: yes X-SW-Source: 2017-03/txt/msg00185.txt.bz2 --tqN4RWvJTb9VNux/ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-length: 660 On 25 Feb 2017 19:53, Jim Wilson wrote: > +/* Return the number of bits set in the input value. */ > +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) > +# define popcount __builtin_popcount > +#else > +static int > +popcount (unsigned char x) > +{ > + static const unsigned char popcnt[16] = > + { > + 0, 1, 1, 2, > + 1, 2, 2, 3, > + 1, 2, 2, 3, > + 2, 3, 3, 4 > + }; > + > + /* Only counts the low 8 bits of the input as that is all we need. */ > + return popcnt[x % 16] + popcnt[x / 16]; > +} > +#endif gas/config/tc-ia64.c does the same thing, and bfd/elf32-arm.c. should we consolidate these in libiberty ? -mike --tqN4RWvJTb9VNux/ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-length: 833 -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAljGIwcACgkQQWM7n+g3 9YELUQ/+NWGo/W0DIPm3bt31wZM6UTs5FSF4vsASKBFuOg/xMKvGkNoVrioa1Qrp XuweaWrlLCr3F3t/0xNqgNI+EiYGtcOwxuLp8MpOdLE8fQfdpAIR/R29UpHnKJHr q5Gj0pxvIl1u2nYpA6xYBIvCAkNmnMEBaAvaUtH10sO7xNUeFoBobutvudmQqswM k/KgPu7cjwdWJn829mSgLApoY3+6DBW6/leF6YlyBGdDWoDiJQovReIvXc7fPJYt DfIi8Rda60cqwI0sRa1tqM+bnaDYFVtDOQreRgA1jRealaFb8S1CC7PY1HQA5dKO a1ZnCB5VlCMxZn4LGQ1Wk2vM5eMB/C4UJmjBJ/af3fiZotoq/Cbs9phEsIJ1NZ3l UFA/MgIA9T4QbnZj8hmx0+YAyzC6Y635d2kpwqjteR5Zgqo/TtztfNikqpyl3qYS 6n1nEHumNkWtjVKcN3gk/XrHWD5NaFHS4Dk9OSoSt+bweAjdSGC/9vkIp7h0Hwsj 1vra/sU8mqj2cSkY3+tcCnohP2yF36yim7YJz3o4ML8TpMjz5jlgC31qytbw8zxD YXST6NrFY8gsxT7wzOhkSVxFcS02usV2+MO7yNtkDfOhuIITsYnaCgaRGB1eW00C RFa5HjWEYpwKKa5dHEgXD/rCEm3dgiZHGd8FOAc5I1Jjyn1c/8g= =lf1o -----END PGP SIGNATURE----- --tqN4RWvJTb9VNux/--