Re: [PATCH v3 2/2] x86/lib: Use REP MOVSB for large memcpy() on ERMS CPUs without FSRM
From: Linus Torvalds
Date: Sun Nov 15 2026 - 13:45:45 EST
On Sun, 15 Nov 2026 at 04:42, David Laight <david.laight.linux@xxxxxxxxx> wrote:
>
> > But having extra registers free could help at the call-site,
>
> There isn't much you can put at the call site instead of a 5 byte call.
You misunderstand.
Avoiding call-clobbered registers means that the caller has more
registers live and can do better code generation.
Making the calling convention clobber registers that aren't useful is
*bad*. And if you do a loop - which you know is either large or
unknown size - and take the I$ hit, adding a couple of push/pop
instructions really doesn't hurt AT ALL.
It has nothing to do with the 5-byte "'call' or 'rep movsb'" instruction.
(And I realize that 'rep movsb' is only two bytes. You'd add a 3-byte
nop or harmless prefixes to it depending on which decodes better)
Linus