Re: using gcc built-ins for bitops?

From: Jakub Jelinek
Date: Thu Jun 24 2004 - 07:07:14 EST


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.

Jakub
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/