diff options
author | Damjan Marion <damarion@cisco.com> | 2021-10-12 20:30:02 +0200 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2021-11-10 16:45:23 +0000 |
commit | 56f54af21d18f9fdd471b81db77a3942b0aa4d9c (patch) | |
tree | 80c5e9681dc209cdbb3c54d7205bc07ad4379f69 /src/vppinfra/string.h | |
parent | 904638f4625c82d166d67870f9cf8088dd29a8b2 (diff) |
vppinfra: new memcpy for x86_64
Change-Id: I5a5055580479960ac53e3f989aa188faf57fb05d
Type: improvement
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/string.h')
-rw-r--r-- | src/vppinfra/string.h | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/src/vppinfra/string.h b/src/vppinfra/string.h index 7f9211b1bd2..758a541814d 100644 --- a/src/vppinfra/string.h +++ b/src/vppinfra/string.h @@ -47,6 +47,7 @@ #include <vppinfra/clib.h> /* for CLIB_LINUX_KERNEL */ #include <vppinfra/vector.h> #include <vppinfra/error_bootstrap.h> +#include <vppinfra/memcpy_x86_64.h> #ifdef CLIB_LINUX_KERNEL #include <linux/string.h> @@ -67,26 +68,6 @@ /* Exchanges source and destination. */ void clib_memswap (void *_a, void *_b, uword bytes); -/* - * the vector unit memcpy variants confuse coverity - * so don't let it anywhere near them. - */ -#ifndef __COVERITY__ -#if __AVX512BITALG__ -#include <vppinfra/memcpy_avx512.h> -#define clib_memcpy_fast_arch(a, b, c) clib_memcpy_fast_avx512 (a, b, c) -#elif __AVX2__ -#include <vppinfra/memcpy_avx2.h> -#define clib_memcpy_fast_arch(a, b, c) clib_memcpy_fast_avx2 (a, b, c) -#elif __SSSE3__ -#include <vppinfra/memcpy_sse3.h> -#define clib_memcpy_fast_arch(a, b, c) clib_memcpy_fast_sse3 (a, b, c) -#endif /* __AVX512BITALG__ */ -#endif /* __COVERITY__ */ - -#ifndef clib_memcpy_fast_arch -#define clib_memcpy_fast_arch(a, b, c) memcpy (a, b, c) -#endif /* clib_memcpy_fast_arch */ static_always_inline void * clib_memcpy_fast (void *restrict dst, const void *restrict src, size_t n) @@ -94,11 +75,16 @@ clib_memcpy_fast (void *restrict dst, const void *restrict src, size_t n) ASSERT (dst && src && "memcpy(src, dst, n) with src == NULL or dst == NULL is undefined " "behaviour"); - return clib_memcpy_fast_arch (dst, src, n); +#if defined(__COVERITY__) + return memcpy (dst, src, n); +#elif defined(__x86_64__) + clib_memcpy_x86_64 (dst, src, n); + return dst; +#else + return memcpy (dst, src, n); +#endif } -#undef clib_memcpy_fast_arch - #include <vppinfra/memcpy.h> /* c-11 string manipulation variants */ |