| 1 | /* Optimized memmove for x86-64. |
| 2 | Copyright (C) 2016-2020 Free Software Foundation, Inc. |
| 3 | This file is part of the GNU C Library. |
| 4 | |
| 5 | The GNU C Library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | The GNU C Library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with the GNU C Library; if not, see |
| 17 | <https://www.gnu.org/licenses/>. */ |
| 18 | |
| 19 | #include <sysdep.h> |
| 20 | |
| 21 | #define VEC_SIZE 16 |
| 22 | #define VEC(i) xmm##i |
| 23 | #define PREFETCHNT prefetchnta |
| 24 | #define VMOVNT movntdq |
| 25 | /* Use movups and movaps for smaller code sizes. */ |
| 26 | #define VMOVU movups |
| 27 | #define VMOVA movaps |
| 28 | |
| 29 | #define SECTION(p) p |
| 30 | |
| 31 | #ifdef USE_MULTIARCH |
| 32 | # if !IS_IN (libc) |
| 33 | # define MEMCPY_SYMBOL(p,s) memcpy |
| 34 | # endif |
| 35 | #else |
| 36 | # if defined SHARED && IS_IN (libc) |
| 37 | # define MEMCPY_SYMBOL(p,s) __memcpy |
| 38 | # else |
| 39 | # define MEMCPY_SYMBOL(p,s) memcpy |
| 40 | # endif |
| 41 | #endif |
| 42 | #if !defined USE_MULTIARCH || !IS_IN (libc) |
| 43 | # define MEMPCPY_SYMBOL(p,s) __mempcpy |
| 44 | #endif |
| 45 | #ifndef MEMMOVE_SYMBOL |
| 46 | # define MEMMOVE_CHK_SYMBOL(p,s) p |
| 47 | # define MEMMOVE_SYMBOL(p,s) memmove |
| 48 | #endif |
| 49 | |
| 50 | #include "multiarch/memmove-vec-unaligned-erms.S" |
| 51 | |
| 52 | #ifndef USE_MULTIARCH |
| 53 | libc_hidden_builtin_def (memmove) |
| 54 | # if defined SHARED && IS_IN (libc) |
| 55 | strong_alias (memmove, __memcpy) |
| 56 | libc_hidden_ver (memmove, memcpy) |
| 57 | # endif |
| 58 | libc_hidden_def (__mempcpy) |
| 59 | weak_alias (__mempcpy, mempcpy) |
| 60 | libc_hidden_builtin_def (mempcpy) |
| 61 | |
| 62 | # if defined SHARED && IS_IN (libc) |
| 63 | # undef memcpy |
| 64 | # include <shlib-compat.h> |
| 65 | versioned_symbol (libc, __memcpy, memcpy, GLIBC_2_14); |
| 66 | |
| 67 | # if SHLIB_COMPAT (libc, GLIBC_2_2_5, GLIBC_2_14) |
| 68 | compat_symbol (libc, memmove, memcpy, GLIBC_2_2_5); |
| 69 | # endif |
| 70 | # endif |
| 71 | #endif |
| 72 | |