[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250605190054.GH30486@noisy.programming.kicks-ass.net>
Date: Thu, 5 Jun 2025 21:00:54 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Mateusz Guzik <mjguzik@...il.com>
Cc: torvalds@...ux-foundation.org, mingo@...hat.com, x86@...nel.org,
linux-kernel@...r.kernel.org, ubizjak@...il.com
Subject: Re: [PATCH v2] x86: prevent gcc from emitting rep movsq/stosq for
inlined ops
On Thu, Jun 05, 2025 at 06:47:33PM +0200, Mateusz Guzik wrote:
> gcc is over eager to use rep movsq/stosq (starts above 40 bytes), which
> comes with a significant penalty on CPUs without the respective fast
> short ops bits (FSRM/FSRS).
I don't suppose there's a magic compiler toggle to make it emit prefix
padded 'rep movs'/'rep stos' variants such that they are 5 bytes each,
right?
Something like:
2e 2e 2e f3 a4 cs cs rep movsb %ds:(%rsi),%es:(%rdi)
because if we can get the compilers to do this; then I can get objtool
to collect all these locations and then we can runtime patch them to be:
call rep_movs_alternative / rep_stos_alternative
or whatever other crap we want really.
Powered by blists - more mailing lists