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

From: H. Peter Anvin

Date: Sun Dec 21 2025 - 18:44:49 EST


On December 21, 2025 3:20:43 PM PST, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>On Sun, 21 Dec 2025 at 13:47, Eric Dumazet <edumazet@xxxxxxxxxx> wrote:
>>
>> Unfortunately I was told it was not better, some clang versions had
>> bugs with it.
>
>The whole "builtin is worse than inline asm" is actually a thing even
>when not actively buggy. We've had things like that a few times
>before.
>
>It's why we have out own variable_ffs() implementation, for example,
>and do things like
>
> #define ffs(x) (__builtin_constant_p(x) ? __builtin_ffs(x) : variable_ffs(x))
>
>because __builtin_ffs() generates pointlessly silly code on at least
>some compiler versions:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106471
>
>So then just using inline asm gets us at least reliable results, and
>we can - and do - tweak it for specific known configs.
>
> Linus

Sigh.

It's just disappointing to see this kind of stuff.