summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2012-04-26 20:00:59 +0300
committerQt by Nokia <qt-info@nokia.com>2012-04-27 01:24:05 +0200
commit16042472ac78da02945c677a676a7e9354b0a40c (patch)
treefbbcecac58d2a6abd35244653db13da61da7a8f6 /src
parent5a1c67c6570285cabdf91a81ad2f3095ded38736 (diff)
fix build with mingw
since MinGW is GCC, invert the order and place the GCC constructs first Change-Id: I98113aa77e51f9e01c3641987e915bf475053a60 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qsimd.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp
index 837c78171e..c23dc92e96 100644
--- a/src/corelib/tools/qsimd.cpp
+++ b/src/corelib/tools/qsimd.cpp
@@ -156,12 +156,7 @@ static inline uint detectProcessorFeatures()
static int maxBasicCpuidSupported()
{
-#ifdef Q_OS_WIN
- // Use the __cpuid function; if the CPUID instruction isn't supported, it will return 0
- int info[4];
- __cpuid(info, 0);
- return info[0];
-#elif defined(Q_CC_GNU)
+#if defined(Q_CC_GNU)
long tmp1;
# ifdef Q_PROCESSOR_X86_32
@@ -190,6 +185,11 @@ static int maxBasicCpuidSupported()
: "0" (0)
: "ecx", "edx");
return result;
+#elif defined(Q_OS_WIN)
+ // Use the __cpuid function; if the CPUID instruction isn't supported, it will return 0
+ int info[4];
+ __cpuid(info, 0);
+ return info[0];
#else
return 0;
#endif
@@ -197,28 +197,24 @@ static int maxBasicCpuidSupported()
static void cpuidFeatures01(uint &ecx, uint &edx)
{
-#ifdef Q_OS_WIN
- int info[4];
- __cpuid(info, 1);
- ecx = info[2];
- edx = info[3];
-#elif defined(Q_CC_GNU)
+#if defined(Q_CC_GNU)
long tmp1;
asm ("xchg " PICreg", %2\n"
"cpuid\n"
"xchg " PICreg", %2\n"
: "=&c" (ecx), "=&d" (edx), "=&r" (tmp1)
: "a" (1));
+#elif defined(Q_OS_WIN)
+ int info[4];
+ __cpuid(info, 1);
+ ecx = info[2];
+ edx = info[3];
#endif
}
static void cpuidFeatures07_00(uint &ebx)
{
-#ifdef Q_OS_WIN
- int info[4];
- __cpuidex(info, 7, 0);
- ebx = info[1];
-#elif defined(Q_CC_GNU)
+#if defined(Q_CC_GNU)
unsigned long rbx; // in case it's 64-bit
asm ("xchg " PICreg", %0\n"
"cpuid\n"
@@ -227,6 +223,10 @@ static void cpuidFeatures07_00(uint &ebx)
: "a" (7), "c" (0)
: "%edx");
ebx = rbx;
+#elif defined(Q_OS_WIN)
+ int info[4];
+ __cpuidex(info, 7, 0);
+ ebx = info[1];
#endif
}