[PATCH RFC] Imporve 64bit memcpy performance for Haswell CPU with AVX instruction
Yuriy Kaminskiy
yumkam@gmail.com
Sat Apr 19 13:22:00 GMT 2014
Ling Ma wrote:
[...]
>>> +#ifdef USE_AS_MEMMOVE
>>> + cmp %rsi, %rdi
>>> + jae L(copy_backward)
>>> +#endif
>> this could be unpredictable branch, backward copy only when overlap is
>> better.
>
> If we compare whether it is overlap, have to introduce another branch
> instruction, so keep it.
No, combined overlap/backward copy detection needs only *single* branch
instruction (but some extra arithmetic). See generic C code or i686 assembler
version:
=== cut string/memmove.c ===
/* This test makes the forward copying code be used whenever possible.
Reduces the working set. */
if (dstp - srcp >= len) /* *Unsigned* compare! */
{
/* Copy from the beginning to the end. */
=== cut sysdeps/i386/i686/memmove.S ===
[...]
More information about the Libc-alpha
mailing list