Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(890)

Unified Diff: src/opts/SkUtils_opts_SSE2.cpp

Issue 285313002: SSE2 implementation of memcpy32 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase and fix comments Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/opts/SkUtils_opts_SSE2.h ('k') | src/opts/SkUtils_opts_arm.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+ }
+}
« no previous file with comments | « src/opts/SkUtils_opts_SSE2.h ('k') | src/opts/SkUtils_opts_arm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698