Re: [PATCH 2/2] x86/irqflags: Use ASM_OUTPUT_RM in native_save_fl()

From: H. Peter Anvin

Date: Sun Dec 21 2025 - 23:26:56 EST


On December 21, 2025 5:38:24 PM PST, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>On Sun, 21 Dec 2025 at 15:44, H. Peter Anvin <hpa@xxxxxxxxx> wrote:
>>
>> Sigh.
>>
>> It's just disappointing to see this kind of stuff.
>
>I actually find all these builtins existing in the first place more
>disappointing.
>
>Inline asm is the *generic* answer, and the one that works for pretty
>much any situation. It's required in the general case, and it's the
>thing that works with older compilers.
>
>Having a builtin for things like this - without any appreciable
>improvement in code - is just pointless and stupid.
>
>Now, generic cross-architecture builtins are one thing: then you can
>use them "portably". So having a builtin for 'ffs()' is not wrong.
>
>But something like __builtin_ia32_readeflags_u64() is just entirely
>pointless. What is the supposed advantage over just doing inline
>assembly?
>
> Linus

Unless they are doing something like actually leaving it on the stack... yeah.