Re: using gcc built-ins for bitops?

From: Arjan van de Ven
Date: Thu Jun 24 2004 - 07:36:56 EST


On Thu, Jun 24, 2004 at 08:05:34AM -0400, Jakub Jelinek wrote:
> On Thu, Jun 24, 2004 at 01:31:51PM +0200, Arjan van de Ven wrote:
> > On Thu, Jun 24, 2004 at 02:00:22AM -0700, Andrew Morton wrote:
> > > For the implementation it would be nice to have the old-style
> > > implementations in one header and the new-style ones in a separate header.
> > > That would create a bit of an all-or-nothing situation, but that should be
> > > OK?
> >
> > In addition I stuck those in asm-generic since they no longer are
> > architecture specific....
>
> This is not going to work.
> Say on x86_64, __builtin_ctzl (~word) ends up __ctzdi2 (~word) call in GCC
> 3.4.x, which is not defined in the kernel (in 3.5 it will be bsfq).
> On a bunch of arches which don't have an instruction for ffz operation
> it will always result in a library call.

It's actually fine; the architecture first needs to include this file and
there it can use the proper ifdefs; the functions themselves don't matter,
only when they can be used, and the arch still controls that.

Attachment: pgp00000.pgp
Description: PGP signature