mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-27 03:41:23 +08:00
d1f75e9644
Falkor's memcpy and memmove share some implementation details, therefore, the two routines are moved to a single source file for code reuse. The two routines now share code for small and medium copies (up to and including 128 bytes). Large copies in memcpy do not handle overlap correctly, consequently, the loops for moving/copying more than 128 bytes stay separate for memcpy and memmove. To increase code reuse a number of small modifications were made: 1. The old implementation of memcpy copied the first 16-bytes as soon as the size of data was determined to be greater than 32 bytes. For memcpy code to also work when copying small/medium overlapping data, the first load and store was moved to the large copy case. 2. Medium memcpy case no longer assumes that 16 bytes were already copied and uses 8 registers to copy up to 128 bytes. 3. Small case for memmove was enlarged to that of memcpy, which is less than or equal to 32 bytes. 4. Medium case for memmove was enlarged to that of memcpy, which is less than or equal to 128 bytes. Other changes include: 1. Improve alignment of existing loop bodies. 2. 'Delouse' memmove and memcpy input arguments. Make sure that upper 32-bits of input registers are zeroed if unused. 3. Do one more iteration in memmove loops and reduce the number of copies made from the start/end of the buffer, depending on the direction of the memmove loop. Benchmarking: Looking at the results from bench-memcpy-random.out, we can see that now memmove_falkor is about 5% faster than memcpy_falkor_old, while memmove_falkor_old was more than 15% slower. The memcpy implementation remained largely unmodified, so there is no significant performance change. The reason for such a significant memmove performance gain is the increase of the upper bound on the small copy case to 32 bytes and the increase of the upper bound on the medium copy case to 128 bytes. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> |
||
---|---|---|
.. | ||
ifunc-impl-list.c | ||
init-arch.h | ||
Makefile | ||
memchr_generic.S | ||
memchr_nosimd.S | ||
memchr.c | ||
memcpy_falkor.S | ||
memcpy_generic.S | ||
memcpy_thunderx2.S | ||
memcpy_thunderx.S | ||
memcpy.c | ||
memmove.c | ||
memset_base64.S | ||
memset_emag.S | ||
memset_falkor.S | ||
memset_generic.S | ||
memset_kunpeng.S | ||
memset.c | ||
rtld-memset.S | ||
strlen_asimd.S | ||
strlen_generic.S | ||
strlen.c |