From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 126310 invoked by alias); 14 Feb 2020 19:53:16 -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 126301 invoked by uid 89); 14 Feb 2020 19:53:15 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-5.3 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1982 X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 14 Feb 2020 19:53:14 +0000 Received: from [172.16.0.95] (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id D08E31E5F3; Fri, 14 Feb 2020 14:53:12 -0500 (EST) Subject: Re: [PATCH 1/5] gnulib: import count-one-bits module and use it To: Simon Marchi , gdb-patches@sourceware.org References: <20200213203035.30157-1-simon.marchi@efficios.com> From: Simon Marchi Message-ID: <1c71dabc-727d-0958-0358-47997e939852@simark.ca> Date: Fri, 14 Feb 2020 19:53:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200213203035.30157-1-simon.marchi@efficios.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2020-02/txt/msg00580.txt.bz2 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