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
This commit is contained in:
tomhudson@google.com 2012-05-17 15:09:17 +00:00
parent 54bf33f5cc
commit ea85494f92

View File

@ -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__)