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

Unified Diff: src/core/SkUtils.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/core/SkBlitRow_D32.cpp ('k') | src/opts/SkUtils_opts_SSE2.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkUtils.cpp
diff --git a/src/core/SkUtils.cpp b/src/core/SkUtils.cpp
index 76da23a6d036c4a36fcc1a48143629b035b90d67..c65947dfe933e2a544b0da227421bf5e39e822ad 100644
--- a/src/core/SkUtils.cpp
+++ b/src/core/SkUtils.cpp
@@ -34,6 +34,18 @@
*(dst)++ = value; *(dst)++ = value; \
*(dst)++ = value; *(dst)++ = value; \
} while (0)
+
+#define copy_16_longs(dst, src) \
+ do { \
+ *(dst)++ = *(src)++; *(dst)++ = *(src)++; \
+ *(dst)++ = *(src)++; *(dst)++ = *(src)++; \
+ *(dst)++ = *(src)++; *(dst)++ = *(src)++; \
+ *(dst)++ = *(src)++; *(dst)++ = *(src)++; \
+ *(dst)++ = *(src)++; *(dst)++ = *(src)++; \
+ *(dst)++ = *(src)++; *(dst)++ = *(src)++; \
+ *(dst)++ = *(src)++; *(dst)++ = *(src)++; \
+ *(dst)++ = *(src)++; *(dst)++ = *(src)++; \
+ } while (0)
#endif
///////////////////////////////////////////////////////////////////////////////
@@ -109,6 +121,24 @@ static void sk_memset32_portable(uint32_t dst[], uint32_t value, int count) {
}
}
+static void sk_memcpy32_portable(uint32_t dst[], const uint32_t src[], int count) {
+ SkASSERT(dst != NULL && count >= 0);
+
+ int sixteenlongs = count >> 4;
+ if (sixteenlongs) {
+ do {
+ copy_16_longs(dst, src);
+ } while (--sixteenlongs != 0);
+ count &= 15;
+ }
+
+ if (count) {
+ do {
+ *dst++ = *src++;
+ } while (--count != 0);
+ }
+}
+
static void choose_memset16(SkMemset16Proc* proc) {
*proc = SkMemset16GetPlatformProc();
if (NULL == *proc) {
@@ -141,6 +171,22 @@ void sk_memset32(uint32_t dst[], uint32_t value, int count) {
return proc(dst, value, count);
}
+static void choose_memcpy32(SkMemcpy32Proc* proc) {
+ *proc = SkMemcpy32GetPlatformProc();
+ if (NULL == *proc) {
+ *proc = &sk_memcpy32_portable;
+ }
+}
+
+void sk_memcpy32(uint32_t dst[], const uint32_t src[], int count) {
+ SK_DECLARE_STATIC_ONCE(once);
+ static SkMemcpy32Proc proc = NULL;
+ SkOnce(&once, choose_memcpy32, &proc);
+ SkASSERT(proc != NULL);
+
+ return proc(dst, src, count);
+}
+
///////////////////////////////////////////////////////////////////////////////
/* 0xxxxxxx 1 total
« no previous file with comments | « src/core/SkBlitRow_D32.cpp ('k') | src/opts/SkUtils_opts_SSE2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698