summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorAndreas Kling <andreas.kling@nokia.com>2010-07-26 10:07:16 (GMT)
committerAndreas Kling <andreas.kling@nokia.com>2010-07-26 10:37:01 (GMT)
commitefa190848270347362a1caab739961d185561627 (patch)
tree0d683db967e87a8e23360699da1787e87ff916f0 /src/corelib
parent5878a161e8a4b332fc056874aee4833352dedaa9 (diff)
downloadQt-efa190848270347362a1caab739961d185561627.zip
Qt-efa190848270347362a1caab739961d185561627.tar.gz
Qt-efa190848270347362a1caab739961d185561627.tar.bz2
Use the appropriate CPUID bitmap for detecting SSE3 etc
This information actually comes from ECX after CPUID(0x00000001), not EDX after CPUID(0x80000001)
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/tools/qsimd.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp
index aa2ee47..ea90b66 100644
--- a/src/corelib/tools/qsimd.cpp
+++ b/src/corelib/tools/qsimd.cpp
@@ -91,6 +91,7 @@ uint qDetectCPUFeatures()
features = MMX|SSE|SSE2;
#elif defined(__i386__) || defined(_M_IX86)
unsigned int extended_result = 0;
+ unsigned int feature_result = 0;
uint result = 0;
/* see p. 118 of amd64 instruction set manual Vol3 */
#if defined(Q_CC_GNU)
@@ -112,7 +113,8 @@ uint qDetectCPUFeatures()
"1:\n"
"pop %%ebx\n"
"mov %%edx, %0\n"
- : "=r" (result)
+ "mov %%ecx, %1\n"
+ : "=r" (result), "=r" (feature_result)
:
: "%eax", "%ecx", "%edx"
);
@@ -164,6 +166,7 @@ uint qDetectCPUFeatures()
mov eax, 1
cpuid
mov result, edx
+ mov feature_result, ecx
skip:
pop edx
pop ecx
@@ -218,15 +221,15 @@ uint qDetectCPUFeatures()
features |= SSE;
if (result & (1u << 26))
features |= SSE2;
- if (extended_result & (1u))
+ if (feature_result & (1u))
features |= SSE3;
- if (extended_result & (1u << 9))
+ if (feature_result & (1u << 9))
features |= SSSE3;
- if (extended_result & (1u << 19))
+ if (feature_result & (1u << 19))
features |= SSE4_1;
- if (extended_result & (1u << 20))
+ if (feature_result & (1u << 20))
features |= SSE4_2;
- if (extended_result & (1u << 28))
+ if (feature_result & (1u << 28))
features |= AVX;
#endif // i386