aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-02 17:27:51 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-02 17:27:51 +0000
commitab69788571ed968dc0bcc934b9979195c6a28310 (patch)
treee3e7e3518840750109cefb3ba81c74d6da6b45eb
parent4a2cb30accbd5f9b0b60904a55e0bfecf706255a (diff)
create symbols for the various SSE values
add GCC check for SSSE3, and assume it is ordered SSE3 < SSSE3 < SSE4 git-svn-id: http://skia.googlecode.com/svn/trunk@4421 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--include/core/SkChecksum.h26
-rw-r--r--include/core/SkPreConfig.h16
2 files changed, 32 insertions, 10 deletions
diff --git a/include/core/SkChecksum.h b/include/core/SkChecksum.h
index ab88cbc01a..020403f607 100644
--- a/include/core/SkChecksum.h
+++ b/include/core/SkChecksum.h
@@ -59,11 +59,27 @@ inline uint32_t SkComputeChecksum32(const uint32_t* ptr, size_t size) {
SkASSERT(SkIsAlign4(size));
SkASSERT(SkIsAlign4((intptr_t)ptr));
- const uint32_t* stop = ptr + (size >> 2);
- uint32_t result = 0;
- while (ptr < stop) {
- SkCHECKSUM_MASH(result, *ptr);
- ptr++;
+ uint32_t result;
+
+ if (8 == sizeof(void*)) {
+ uint64_t result8 = 0;
+ if (size & 4) {
+ result8 = *ptr++; // initial 32bit value
+ }
+ const uint64_t* ptr8 = (const uint64_t*)ptr;
+ const uint64_t* stop = ptr8 + (size >> 3);
+ while (ptr8 < stop) {
+ SkCHECKSUM_MASH(result8, *ptr8);
+ ptr8++;
+ }
+ result = static_cast<uint32_t>(result8 ^ (result8 >> 32));
+ } else {
+ result = 0;
+ const uint32_t* stop = ptr + (size >> 2);
+ while (ptr < stop) {
+ SkCHECKSUM_MASH(result, *ptr);
+ ptr++;
+ }
}
return result;
}
diff --git a/include/core/SkPreConfig.h b/include/core/SkPreConfig.h
index 22601a7e80..812e446b13 100644
--- a/include/core/SkPreConfig.h
+++ b/include/core/SkPreConfig.h
@@ -103,14 +103,20 @@
//////////////////////////////////////////////////////////////////////
/**
- * If defined, SK_CPU_SSE_LEVEL should be set to [2,3,41,42]. On non-intel CPU,
- * this should be undefined.
+ * If defined, SK_CPU_SSE_LEVEL should be set to the highest supported level.
+ * On non-intel CPU this should be undefined.
*/
+#define SK_CPU_LEVEL_SSE2_VALUE 20
+#define SK_CPU_LEVEL_SSE3_VALUE 30
+#define SK_CPU_LEVEL_SSSE3_VALUE 31
+
#ifndef SK_CPU_SSE_LEVEL
- #ifdef __SSE3__
- #define SK_CPU_SSE_LEVEL 3
+ #if defined(__SSSE3__)
+ #define SK_CPU_SSE_LEVEL SK_CPU_LEVEL_SSSE3_VALUE
+ #elif defined(__SSE3__)
+ #define SK_CPU_SSE_LEVEL SK_CPU_LEVEL_SSE3_VALUE
#elif defined(__SSE2__)
- #define SK_CPU_SSE_LEVEL 2
+ #define SK_CPU_SSE_LEVEL SK_CPU_LEVEL_SSE2_VALUE
#endif
#endif