This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] use __builtin_ctzl in ggc-page
- From: Richard Earnshaw <rearnsha at gcc dot gnu dot org>
- To: Steven Bosscher <stevenb at suse dot de>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 17 Jan 2005 12:38:12 +0000
- Subject: Re: [patch] use __builtin_ctzl in ggc-page
- Organization: GNU
- References: <200501141932.42794.stevenb@suse.de>
On Fri, 2005-01-14 at 18:32, Steven Bosscher wrote:
> Hi,
>
> The page allocator looks for free objects by keeping bitmaps of
> taken slots in a bag. We look for a 0 bit with a loop right now,
> but we could use a builtin instead, like Nathan did recently for
> the revamped bitmap.c.
>
> Bootstrapped on x86_64-suse-linux-gnu, OK?
>
> Gr.
> Steven
>
> * ggc-page.c (ggc_alloc_stat): Use __builtin_ctzl instead of a
> loop to look for a free slot in a page entry.
I would expect this makes things worse for platforms that don't have the
builtin, since we now end up with a library call overhead on top of the
calculation cost.
I'm not convinced these micro-optimizations are such a good thing.
Apart from anything else, they clutter the code unnecessarily -- and a
really smart compiler ought to be able to work this one out!