[PATCH 1/5] gnulib: import count-one-bits module and use it

Simon Marchi simark@simark.ca
Fri Feb 14 19:53:00 GMT 2020


On 2020-02-13 3:30 p.m., Simon Marchi wrote:
> In a following patch, I need a function that counts the number of set
> bits in a word.  There is  __builtin_popcount that is supported by gcc
> and clang, but there is also a gnulib module that wraps it and provides
> a fallback for other compilers, so we might as well use that.
> 
> I also noticed that there is a bitcount function in arch/arm.c, so as a
> first step, this patch replaces the uses of that function with gnulib's
> function.
> 
> The gnulib module actually provides multiple functions, with various
> parameter length (unsigned int, unsigned long int, unsigned long long
> int), I chose the one that made sense for each call site based on the
> argument type.
> 
> gnulib/ChangeLog:
> 
> 	* update-gnulib.sh (IMPORTED_GNULIB_MODULES): Import
> 	count-one-bits module.
> 	* configure: Re-generate.
> 	* aclocal.m4: Re-generate.
> 	* Makefile.in: Re-generate.
> 	* import/count-one-bits.c: New file.
> 	* import/count-one-bits.h: New file.
> 	* import/Makefile.am: Re-generate.
> 	* import/Makefile.in: Re-generate.
> 	* import/m4/gnulib-cache.m4: Re-generate.
> 	* import/m4/gnulib-comp.m4: Re-generate.
> 	* import/m4/count-one-bits.m4: New file.
> 
> gdb/ChangeLog:
> 
> 	* arm-tdep.c: Include count-one-bits.h.
> 	(cleanup_block_store_pc): Use count_one_bits.
> 	(cleanup_block_load_pc): Use count_one_bits.
> 	(arm_copy_block_xfer): Use count_one_bits.
> 	(thumb2_copy_block_xfer): Use count_one_bits.
> 	(thumb_copy_pop_pc_16bit): Use count_one_bits.
> 	* arch/arm-get-next-pcs.c: Include count-one-bits.h.
> 	(thumb_get_next_pcs_raw): Use count_one_bits.
> 	(arm_get_next_pcs_raw): Use count_one_bits_l.
> 	* arch/arm.c (bitcount): Remove.
> 	* arch/arm.h (bitcount): Remove.

Sorry, I had forgotten that I had sent this patch separately from this series:

  https://sourceware.org/ml/gdb-patches/2020-02/msg00410.html

And it is now merged, so you can ignore patch 1/5.

Simon



More information about the Gdb-patches mailing list