Re: [PATCH v3 2/2] x86/lib: Use REP MOVSB for large memcpy() on ERMS CPUs without FSRM

From: Linus Torvalds

Date: Sat Nov 14 2026 - 19:56:44 EST


On Sat, 14 Nov 2026 at 14:45, David Laight <david.laight.linux@xxxxxxxxx> wrote:
>
> Otherwise you'll need to spill to stack for even a simple byte copy loop.

I think the optimization should be for the inline case.

Once you do a call, having a couple of push/pop instructions in the
target is a complete no-op.

But having extra registers free could help at the call-site, and if
the 'rep movs' is inlined you only modify rcx/rsi/rdi. I think the
calling convention should mirror that.

Linus