[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250409143821.GE9833@noisy.programming.kicks-ass.net>
Date: Wed, 9 Apr 2025 16:38:21 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Josh Poimboeuf <jpoimboe@...nel.org>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH RFC 4/5] x86/alternative: Improve code generation
readability
On Tue, Apr 08, 2025 at 01:21:17AM -0700, Josh Poimboeuf wrote:
> Improve the readability and compactness of alternatives code.
>
> ---------------------
> ALTERNATIVE() before:
> ---------------------
>
> # ALT: oldinstr
> 771:
> rep movsb
> 772:
> # ALT: padding
> .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"
> # ALT: replacement
> 774:
> call rep_movs_alternative
> 775:
> .popsection
>
> --------------------
> ALTERNATIVE() after:
> --------------------
>
> # <ALTERNATIVE>
> 771: rep movsb
> 772: .skip -(((775f-774f)-(772b-771b)) > 0) * ((775f-774f)-(772b-771b)),0x90
> 773:
> # ALT ENTRY:
> .pushsection .altinstructions,"a"; .long 771b - .; .long 774f - .; .4byte (((1 << 0) << 16) | ((18*32+ 4))); .byte 773b-771b; .byte 775f-774f; .popsection
I find this very hard to read. I prefer the multi line form it had
before.
Other than that, I like the new layout.
> # ALT REPLACEMENT:
> .pushsection .altinstr_replacement, "ax"
> 774: call rep_movs_alternative
> 775:
> .popsection
> # </ALTERNATIVE>
Powered by blists - more mailing lists