Re: [PATCH v2] x86/hweight: Fix and improve __arch_hweight{32,64}() assembly

From: Ingo Molnar
Date: Wed Mar 12 2025 - 08:09:56 EST



* Uros Bizjak <ubizjak@xxxxxxxxx> wrote:

> a) Use ASM_CALL_CONSTRAINT to prevent inline asm that includes call
> instruction from being scheduled before the frame pointer gets set
> up by the containing function. This unconstrained scheduling might
> cause objtool to print a "call without frame pointer save/setup"
> warning. Current versions of compilers don't seem to trigger this
> condition, but without this constraint there's nothing to prevent
> the compiler from scheduling the insn in front of frame creation.
>
> b) Use asm_inline to instruct the compiler that the size of asm()
> is the minimum size of one instruction, ignoring how many instructions
> the compiler thinks it is. ALTERNATIVE macro that expands to several
> pseudo directives causes instruction length estimate to count
> more than 20 instructions.
>
> c) Use named operands in inline asm.

I think this should be a 3-patch series. While it all modifies the same
code, each change could introduce separate issues, so it's better to be
individually bisectable IMO ...

Thanks,

Ingo