Re: [PATCH RFC 4/5] x86/alternative: Improve code generation readability
From: Linus Torvalds
Date: Wed Apr 09 2025 - 14:05:18 EST
On Wed, 9 Apr 2025 at 10:41, Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
>
> I actually think the compactness of putting the entry on a single line
> is really nice.
Yeah, I think the noise with size calculations in particular is stuff
that I never look at, and making it one long line is better than
multiple lines, I think.
That said, for some of the alternatives, it would be even nicer if we
could make the noise more compact by just hardcoding sizes. Our
generic alternatives macros do result in some *very* verbose output
that is entirely illegible to humans.
And yes, we need that generic case for most of them, since the
instruction size will depend on register choice and the modrm
addressing details etc.
But some of them are kind of pointless.
I did have something that just knew that 'clac'/'stac' were three-byte
instructions (and it was very obvious indeed back when we encoded them
as such, using the ".byte" syntax).
And that avoided a *lot* of noise in the alternatives section, and
removed the subsequent ".skip" part entirely because both sides would
just use the right size without any calculations.
I can't find that hacky patch of mine, and I didn't keep it around
because it *was* hacky, but maybe I'll try to resurrect a cleaner
version of it.
There may not be very many people who care, because yeah, it really
only shows up when looking at the compiler-generated assembler output,
and I agree that that isn't exactly _common_.
Linus