This is the mail archive of the
mailing list for the glibc project.
Re: memmove optimization on X86_64
On 5/6/07, Aurelien Jarno <email@example.com> wrote:
memmove should still work when src and dest are shift by only one byte.
Doing 64 bits by 64 bits copy won't work in that case.
In this case you must copy from the end to the start, initially
aligning with byte sized copies, followed by word sized copies, and
finally aligning with bytes sized copies.
The compiler builtin __builtin_memmove can be inlined, and also does
the same optimizations.
See gcc/builtins.c (expand_builtin_memmove).
The builtin memmove is decomposed into a memcpy which is
expand_builtin_memcpy. Note that if you confuse the compiler and for
example it can't determine you passed a pointer to memmove's first
argument (validate_arglist), it will default to calling memmove
provided by the C library e.g. expand_call at the end of