From 55d7e5f18bb321981edef0cb02fdad5b5ad0bd0a Mon Sep 17 00:00:00 2001 From: Jan-Arve Saether Date: Wed, 16 May 2012 14:34:14 +0200 Subject: [PATCH] Compile fix: Do not rely on __cpuidex() for msvc2008 Since its hard to detect if __cpuidex() is actually available at compile time, we'll add a function overload that will be chosen if the intrinsic __cpuidex() is not available. Note that the QtXgetbvHack that was used for _xgetbv did not really work (MS compiler will bail out because of ambiguous overloads if the intrinsic _xgetbv existed). Therefore, we apply the same workaround for _xgetbv. Change-Id: Iee3bf8bc6352ba0861b05d779f1f001d4eb013ff Reviewed-by: Thiago Macieira --- src/corelib/tools/qsimd.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index ac21e5beb9..821de8d3ee 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -212,6 +212,10 @@ static void cpuidFeatures01(uint &ecx, uint &edx) #endif } +#ifdef Q_OS_WIN +inline void __cpuidex(int info[4], int, __int64) { memset(info, 0, 4*sizeof(int));} +#endif + static void cpuidFeatures07_00(uint &ebx) { #if defined(Q_CC_GNU) @@ -231,10 +235,7 @@ static void cpuidFeatures07_00(uint &ebx) } #ifdef Q_OS_WIN -namespace QtXgetbvHack { - inline quint64 _xgetbv(int) { return 0; } -} -using namespace QtXgetbvHack; +inline quint64 _xgetbv(__int64) { return 0; } #endif static void xgetbv(int in, uint &eax, uint &edx)