X-Git-Url: https://git.sesse.net/?p=nageru;a=blobdiff_plain;f=shared%2Fmemcpy_interleaved.cpp;fp=shared%2Fmemcpy_interleaved.cpp;h=4aba3c936a00effd9fb68ae99042db85375b4d24;hp=433694217bfb8559b368505633877a6bcdce55c5;hb=2f20f863e6b334d300d69cc41ff93170199b2491;hpb=b3fa9338f37e8c7e2bb9ca07d3417a909fcc6d6e diff --git a/shared/memcpy_interleaved.cpp b/shared/memcpy_interleaved.cpp index 4336942..4aba3c9 100644 --- a/shared/memcpy_interleaved.cpp +++ b/shared/memcpy_interleaved.cpp @@ -1,4 +1,4 @@ -#if (defined(__i386__) || defined(__x86_64__)) && defined(__GNUC__) && !defined(__clang__) +#if (defined(__i386__) || defined(__x86_64__)) && defined(__GNUC__) #define HAS_MULTIVERSIONING 1 #endif @@ -26,12 +26,22 @@ void memcpy_interleaved_slow(uint8_t *dest1, uint8_t *dest2, const uint8_t *src, #if HAS_MULTIVERSIONING +__attribute__((target("default"))) +size_t memcpy_interleaved_fastpath_core(uint8_t *dest1, uint8_t *dest2, const uint8_t *src, const uint8_t *limit); + __attribute__((target("sse2"))) size_t memcpy_interleaved_fastpath_core(uint8_t *dest1, uint8_t *dest2, const uint8_t *src, const uint8_t *limit); __attribute__((target("avx2"))) size_t memcpy_interleaved_fastpath_core(uint8_t *dest1, uint8_t *dest2, const uint8_t *src, const uint8_t *limit); +__attribute__((target("default"))) +size_t memcpy_interleaved_fastpath_core(uint8_t *dest1, uint8_t *dest2, const uint8_t *src, const uint8_t *limit) +{ + // No fast path possible unless we have SSE2 or higher. + return 0; +} + __attribute__((target("sse2"))) size_t memcpy_interleaved_fastpath_core(uint8_t *dest1, uint8_t *dest2, const uint8_t *src, const uint8_t *limit) { @@ -100,7 +110,6 @@ size_t memcpy_interleaved_fastpath_core(uint8_t *dest1, uint8_t *dest2, const ui } // Returns the number of bytes consumed. -__attribute__((target("sse2", "avx2"))) size_t memcpy_interleaved_fastpath(uint8_t *dest1, uint8_t *dest2, const uint8_t *src, size_t n) { const uint8_t *limit = src + n;