land http://codereview.appspot.com/6325044/ by Lei
authorreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 16 Jul 2012 16:07:42 +0000 (16:07 +0000)
committerreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 16 Jul 2012 16:07:42 +0000 (16:07 +0000)
git-svn-id: http://skia.googlecode.com/svn/trunk@4622 2bbb7eff-a529-9590-31e7-b0007b416f81

src/opts/opts_check_SSE2.cpp

index 5da6412..711ee33 100644 (file)
@@ -64,8 +64,8 @@ static inline void getcpuid(int info_type, int info[4]) {
 #endif
 #endif
 
-#if defined(__x86_64__) || defined(_WIN64)
-/* All x86_64 machines have SSE2, so don't even bother checking. */
+#if defined(__x86_64__) || defined(_WIN64) || SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
+/* All x86_64 machines have SSE2, or we know it's supported at compile time,  so don't even bother checking. */
 static inline bool hasSSE2() {
     return true;
 }
@@ -78,11 +78,19 @@ static inline bool hasSSE2() {
 }
 #endif
 
+#if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSSE3
+/* If we know SSSE3 is supported at compile time, don't even bother checking. */
+static inline bool hasSSSE3() {
+    return true;
+}
+#else
+
 static inline bool hasSSSE3() {
     int cpu_info[4] = { 0 };
     getcpuid(1, cpu_info);
     return (cpu_info[2] & 0x200) != 0;
 }
+#endif
 
 static bool cachedHasSSE2() {
     static bool gHasSSE2 = hasSSE2();