Re: using gcc built-ins for bitops?

From: Arjan van de Ven
Date: Thu Jun 24 2004 - 04:18:53 EST


On Thu, Jun 24, 2004 at 02:00:22AM -0700, Andrew Morton wrote:
> Arjan van de Ven <arjanv@xxxxxxxxxx> wrote:
> >
> > gcc 3.4 gained support for several typical bitops as builtin directives.
> > Using these over inline asm has a few advantages:
> > * gcc can optimize constants into these better
> > * gcc can reorder and schedule the code better
> > * gcc can allocate registers etc better for the code
> >
> > The question is if we consider it desirable to go down this road or not. In
> > order to help that discussion I've attached a patch below that switches the
> > i386 ffz() function to the gcc builtin version, conditional on gcc having
> > support for this. Before I go down the road of converting more functions
> > and/or architectures.... is this worth doing?
>
> I guess it depends on the resulting code size and quality. Some extra
> conversions would be needed for that.

for ffz() the exact same assembly instructions are generated in the cases I looked at
(kernel/signal.c); eg no extra code at all.


Attachment: pgp00000.pgp
Description: PGP signature