From 16042472ac78da02945c677a676a7e9354b0a40c Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Thu, 26 Apr 2012 20:00:59 +0300 Subject: fix build with mingw since MinGW is GCC, invert the order and place the GCC constructs first Change-Id: I98113aa77e51f9e01c3641987e915bf475053a60 Reviewed-by: Thiago Macieira --- src/corelib/tools/qsimd.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src') 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 } -- cgit v1.2.3