]> git.sesse.net Git - nageru/commitdiff
More tweaks to the memcpy_interleaved multiversioning.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 19 Feb 2019 08:39:05 +0000 (09:39 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 19 Feb 2019 08:39:05 +0000 (09:39 +0100)
shared/memcpy_interleaved.cpp

index 433694217bfb8559b368505633877a6bcdce55c5..4aba3c936a00effd9fb68ae99042db85375b4d24 100644 (file)
@@ -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;