Re: [PATCH] gcc-3.1 ffs problem, kernel 2.4.18

Richard Henderson (rth@twiddle.net)
Tue, 2 Apr 2002 14:59:55 -0800


On Tue, Apr 02, 2002 at 01:48:48PM +0200, Michal Moskal wrote:
> Could you please check if it compiles for you?

Ah, I see the bug. I was looking at ffz (which is correct),
not ffs (which isn't).

> __asm__("bsfl %1,%0\n\t"
> "jnz 1f\n\t"
> "movl $-1,%0\n"
> "1:" : "=r" (r) : "g" (x));

The problem is ^^^

That sez any of register, memory, or immediate is ok.
It should be "r" instead, just like in ffz.

That said, we should probably be using __builtin_ffs
instead. The compiler knows how to do bsfl plus the
adjustment. Plus, it knows how to evaluate it at
compile-time for constants.

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