This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: popcount support
- From: Jim Wilson <jim dot wilson at linaro dot org>
- To: Jim Wilson <jim dot wilson at linaro dot org>, gdb-patches at sourceware dot org
- Date: Mon, 13 Mar 2017 20:59:33 -0700
- Subject: Re: popcount support
- Authentication-results: sourceware.org; auth=none
- References: <CABXYE2W2z-n+d_QZvH6epMcS-zerQYaimz475DxSuXd4Ebtm4w@mail.gmail.com> <20170313044143.GV31094@vapier>
On Sun, Mar 12, 2017 at 9:41 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> 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)
>> ...
>
> gas/config/tc-ia64.c does the same thing, and bfd/elf32-arm.c.
> should we consolidate these in libiberty ?
I noticed the other popcount functions, but 3 didn't seem like a high
enough number to me to justify generalizing the function. Also note
that the one in the aarch64 sim isn't exactly the same as the others,
as the others take int input and mine takes char input. So the
aarch64 sim one is faster than the others, as it doesn't need
recursion or a loop.
Jim