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
This commit is contained in:
reed@google.com 2012-07-02 17:27:51 +00:00
parent 4a2cb30acc
commit ab69788571
2 changed files with 32 additions and 10 deletions

View File

@ -59,11 +59,27 @@ inline uint32_t SkComputeChecksum32(const uint32_t* ptr, size_t size) {
SkASSERT(SkIsAlign4(size)); SkASSERT(SkIsAlign4(size));
SkASSERT(SkIsAlign4((intptr_t)ptr)); SkASSERT(SkIsAlign4((intptr_t)ptr));
const uint32_t* stop = ptr + (size >> 2); uint32_t result;
uint32_t result = 0;
while (ptr < stop) { if (8 == sizeof(void*)) {
SkCHECKSUM_MASH(result, *ptr); uint64_t result8 = 0;
ptr++; 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; return result;
} }

View File

@ -103,14 +103,20 @@
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
/** /**
* If defined, SK_CPU_SSE_LEVEL should be set to [2,3,41,42]. On non-intel CPU, * If defined, SK_CPU_SSE_LEVEL should be set to the highest supported level.
* this should be undefined. * 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 #ifndef SK_CPU_SSE_LEVEL
#ifdef __SSE3__ #if defined(__SSSE3__)
#define SK_CPU_SSE_LEVEL 3 #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__) #elif defined(__SSE2__)
#define SK_CPU_SSE_LEVEL 2 #define SK_CPU_SSE_LEVEL SK_CPU_LEVEL_SSE2_VALUE
#endif #endif
#endif #endif