aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-17 15:09:17 +0000
committerGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-17 15:09:17 +0000
commitea85494f9270a48e1a61478c85c20c3c77c430de (patch)
tree891c865d6dd4d490b3df24d23312de9059f3e73a
parent54bf33f5cc99eb4add69c52f6c82d2332e0d1bf7 (diff)
Use intrinsics instead of inline assembly for detecting CPU ID & SSE2/3 support
on 64-bit builds in MS Visual Studio 2010. Original code provided by jianliang79. http://code.google.com/p/skia/issues/detail?id=600 git-svn-id: http://skia.googlecode.com/svn/trunk@3991 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--src/opts/opts_check_SSE2.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/opts/opts_check_SSE2.cpp b/src/opts/opts_check_SSE2.cpp
index 16dbcff2df..a839696a66 100644
--- a/src/opts/opts_check_SSE2.cpp
+++ b/src/opts/opts_check_SSE2.cpp
@@ -14,6 +14,10 @@
#include "SkUtils_opts_SSE2.h"
#include "SkUtils.h"
+#if defined(_MSC_VER) && defined(_WIN64)
+#include <intrin.h>
+#endif
+
/* This file must *not* be compiled with -msse or -msse2, otherwise
gcc may generate sse2 even for scalar ops (and thus give an invalid
instruction on Pentium3 on the code below). Only files named *_SSE2.cpp
@@ -22,6 +26,9 @@
#ifdef _MSC_VER
static inline void getcpuid(int info_type, int info[4]) {
+#if defined(_WIN64)
+ __cpuid(info, info_type);
+#else
__asm {
mov eax, [info_type]
cpuid
@@ -31,6 +38,7 @@ static inline void getcpuid(int info_type, int info[4]) {
mov [edi+8], ecx
mov [edi+12], edx
}
+#endif
}
#else
#if defined(__x86_64__)