Re: [PATCH 10/24] alpha: select HAVE_ARCH_COMPILER_H

From: Magnus Lindholm

Date: Wed Sep 02 2026 - 05:22:16 EST


Hi Matt,

On Tue, Sep 1, 2026 at 5:51 PM Matt Turner <mattst88@xxxxxxxxx> wrote:
>
> Alpha already provides asm/compiler.h (wrapping uapi/asm/compiler.h)
> which defines architecture-specific compiler intrinsics like
> __kernel_cmpbge, __kernel_cttz, __kernel_ctlz, and __kernel_ctpop.
>
> Selecting HAVE_ARCH_COMPILER_H causes linux/compiler_types.h to include
> asm/compiler.h, making these definitions available consistently.


I tested this on an AlphaServer ES40. The kernel built and booted
successfully with CONFIG_HAVE_ARCH_COMPILER_H=y, and the in-tree
test_bitops module completed without errors.

While testing this patch, the FFS KUnit suite exposed a separate,
pre-existing issue in the EV67 Alpha fls64() implementation. The
zero-input tests failed with the contradictory diagnostic:

Expected fls64(input) == 0, but
fls64(input) == 0 (0x0)

The EV67 implementation passes zero to __kernel_ctlz(), which GCC maps
to __builtin_clzl(). The result of __builtin_clzl(0) is undefined, so
the compiler can optimize the comparison inconsistently with the value
returned by the Alpha ctlz instruction.

I verified the diagnosis by changing fls64() to handle zero explicitly:

return word ? 64 - __kernel_ctlz(word) : 0;

With that change, the FFS KUnit result improved from 8/9 to 9/9 tests
passing.

This appears unrelated to this patch, since asm/bitops.h already
included asm/compiler.h directly before HAVE_ARCH_COMPILER_H was
selected. I am mentioning it here since this patch led to the issue
being discovered.

Tested-by: Magnus Lindholm <linmag7@xxxxxxxxx>
Reviewed-by: Magnus Lindholm <linmag7@xxxxxxxxx>