Re: [PATCH 2/2] x86/local: local_add/local_sub: Support large immediate values
From: Peter Zijlstra
Date: Mon Aug 03 2026 - 06:15:21 EST
On Mon, Aug 03, 2026 at 10:47:02AM +0100, David Laight wrote:
> Replace the "ir" constraint with "er" so that constants over 2^31
> get loaded into a register.
>
> Signed-off-by: David Laight <david.laight.linux@xxxxxxxxx>
> ---
> arch/x86/include/asm/local.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/include/asm/local.h b/arch/x86/include/asm/local.h
> index 4957018fef3e..68af7b74450a 100644
> --- a/arch/x86/include/asm/local.h
> +++ b/arch/x86/include/asm/local.h
> @@ -32,14 +32,14 @@ static inline void local_add(long i, local_t *l)
> {
> asm volatile(_ASM_ADD "%1,%0"
> : "+m" (l->a.counter)
> - : "ir" (i));
> + : "er" (i));
> }
>
> static inline void local_sub(long i, local_t *l)
> {
> asm volatile(_ASM_SUB "%1,%0"
> : "+m" (l->a.counter)
> - : "ir" (i));
> + : "er" (i));
> }
And the other two sites already have "er", how inconsistent :/
Acked-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>