Skip to content

Commit

Permalink
qsimd: Fix compilation with trunk clang for mingw
Browse files Browse the repository at this point in the history
Current tip-of-tree clang (after Clang 8 was branched) added an
intrinsic function __builtin_ia32_xgetbv, and added the following
define that provides _xgetbv:
    #define _xgetbv(A) __builtin_ia32_xgetbv((long long)(A))

This fallback declaration of the _xgetbv function only is used
in case the Q_OS_WIN branch of the #if/#elif below is used, if
the #if (defined(Q_CC_GNU) && !defined(Q_CC_EMSCRIPTEN)) ||
defined(Q_CC_GHS) wasn't taken. I left out the
!defined(Q_CC_EMSCRIPTEN) part as I believe Q_OS_WIN and
Q_CC_EMSCRIPTEN are mutually exclusive.

Change-Id: I257fc4283ff9f0845df51ab764cf58acdf285c66
Reviewed-by: Thiago Macieira <[email protected]>
  • Loading branch information
mstorsjo committed Jan 22, 2019
1 parent 524a37f commit 9818af7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/corelib/tools/qsimd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ static void cpuidFeatures07_00(uint &ebx, uint &ecx, uint &edx)
#endif
}

#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && !(defined(Q_CC_GNU) || defined(Q_CC_GHS))
// fallback overload in case this intrinsic does not exist: unsigned __int64 _xgetbv(unsigned int);
inline quint64 _xgetbv(__int64) { return 0; }
#endif
Expand Down

0 comments on commit 9818af7

Please sign in to comment.