This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: popcount support


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]