Re: [PATCH 14/20] x86/barrier: Use alternative_io() in 32-bit barrier functions
From: Josh Poimboeuf
Date: Mon Mar 17 2025 - 20:12:17 EST
On Mon, Mar 17, 2025 at 08:04:32PM +0000, David Laight wrote:
> Is the ARG() necessary just to handle the comma separated lists?
> If so is it only actually needed if there is more than one item?
No, but my preference is to require the use of the macro even for single
constraints as it helps visually separate the lists.
> Another option is to just require () and add the ARG in the expansion.
> So with:
> #define __asm_call(qual, alt, out, in, clobber) \
> asm("zzz", ARG out, ARG in, ARG clobber)
>
> __asm_call(qual, ALT(), \
> ([var] "+m" (__my_cpu_var(_var)), "+a" (old__.low), \
> "+d" (old__.high)), \
> ("b" (new__.low), "c" (new__.high), "S" (&(_var))), \
> ("memory"));
>
> would get expanded the same as the line below.
Interesting idea, though I still prefer the self-documenting ASM_OUTPUT
/ ASM_INPUT / ASM_CLOBBER macros which are self-documenting and make it
easier to read and visually distinguish the constraint lists.
--
Josh