Sujet : Re: rep movsb vs. simpler instructions for memcpy/memmove
De : monnier (at) *nospam* iro.umontreal.ca (Stefan Monnier)
Groupes : comp.archDate : 13. Mar 2025, 17:43:07
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <jwv7c4s3n4d.fsf-monnier+comp.arch@gnu.org>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
User-Agent : Gnus/5.13 (Gnus v5.13)
What is different about MM compared to `rep movsb`
MM does not modify the pointers. MM keeps its current index,
thus the compiler can use the Rf pointer multiple times.
that you can confidently state that it will always be optimal?
Compared to the explosion in memmove() subroutine, yes.
Are you suggesting that what prevents Intel to make `rep movsb` optimal
is the fact that it modifies its pointers?
I have no experience implementing such an instruction, but I find it odd
that such a "cosmetic detail" would have such an profound impact on the
performance of an instruction. Can't they just "macroexpand" it during
decoding into two instructions (one which copies the bytes without
modifying the pointers, and then one which just adjusts the pointers)?
Stefan