Index: src/opts/SkUtils_opts_SSE2.cpp |
diff --git a/src/opts/SkUtils_opts_SSE2.cpp b/src/opts/SkUtils_opts_SSE2.cpp |
index a3c5aa5dfd7f1cf417abda23f10d662d80bf8045..bd2f9b29a44ad612a93b14ee57c16b16d54b1f8f 100644 |
--- a/src/opts/SkUtils_opts_SSE2.cpp |
+++ b/src/opts/SkUtils_opts_SSE2.cpp |
@@ -67,3 +67,33 @@ void sk_memset32_SSE2(uint32_t *dst, uint32_t value, int count) |
--count; |
} |
} |
+ |
+void sk_memcpy32_SSE2(uint32_t *dst, const uint32_t *src, int count) |
+{ |
+ if (count >= 16) { |
+ while (((size_t)dst) & 0x0F) { |
+ *dst++ = *src++; |
+ --count; |
+ } |
+ __m128i *dst128 = reinterpret_cast<__m128i*>(dst); |
+ const __m128i *src128 = reinterpret_cast<const __m128i*>(src); |
+ while (count >= 16) { |
+ __m128i a = _mm_loadu_si128(src128++); |
+ __m128i b = _mm_loadu_si128(src128++); |
+ __m128i c = _mm_loadu_si128(src128++); |
+ __m128i d = _mm_loadu_si128(src128++); |
+ |
+ _mm_store_si128(dst128++, a); |
+ _mm_store_si128(dst128++, b); |
+ _mm_store_si128(dst128++, c); |
+ _mm_store_si128(dst128++, d); |
+ count -= 16; |
+ } |
+ dst = reinterpret_cast<uint32_t*>(dst128); |
+ src = reinterpret_cast<const uint32_t*>(src128); |
+ } |
+ while (count > 0) { |
+ *dst++ = *src++; |
+ --count; |
+ } |
+} |