Re: [PATCH RFC 4/5] x86/alternative: Improve code generation readability
From: Josh Poimboeuf
Date: Wed Apr 16 2025 - 19:30:13 EST
On Wed, Apr 09, 2025 at 11:02:29AM -0700, Linus Torvalds wrote:
> 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.
We could just give up on trying to making the code itself readable, and
instead put the code+features in comments, e.g.:
# <ALTERNATIVE>
#
# ORIG: rep movsb
# NEW: call rep_movs_alternative # ALT_NOT(X86_FEATURE_FSRM)
#
771: rep movsb; 772: .skip -(((775f-774f)-(772b-771b)) > 0) * ((775f-774f)-(772b-771b)),0x90; 773: .pushsection .altinstructions,"a"; .long 771b - .; .long 774f - .; .4byte (((1 << 0) << 16) | ((18*32+ 4))); .byte 773b-771b; .byte 775f-774f; .popsection; .pushsection .altinstr_replacement, "ax"; 774: call rep_movs_alternative; 775: .popsection
# </ALTERNATIVE>
--
Josh