diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2017-01-27 11:07:14 -0800 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2017-01-30 18:16:50 +0000 |
commit | 0159cbb1a29f7a1fd6569948def3fdf42b3e3798 (patch) | |
tree | 85429785b666f7fa7689437938405fccccd5d260 /src/corelib/tools | |
parent | bec3658e19a8028fbc50c6cca9615e5ca052adb2 (diff) |
Move the declaration of SSE3 & newer macros above their use
Change-Id: I445bb15619f6401494e8fffd149db66da3405b48
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qsimd_p.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index f9c4d0d5ce..ab9f383803 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -181,6 +181,20 @@ # define QT_FUNCTION_TARGET(x) #endif +#if defined(Q_CC_MSVC) && (defined(_M_AVX) || defined(__AVX__)) +// Visual Studio defines __AVX__ when /arch:AVX is passed, but not the earlier macros +// See: https://msdn.microsoft.com/en-us/library/b0084kay.aspx +// SSE2 is handled by _M_IX86_FP below +# define __SSE3__ 1 +# define __SSSE3__ 1 +// no Intel CPU supports SSE4a, so don't define it +# define __SSE4_1__ 1 +# define __SSE4_2__ 1 +# ifndef __AVX__ +# define __AVX__ 1 +# endif +#endif + // SSE intrinsics #define QT_FUNCTION_TARGET_STRING_SSE2 "sse2" #if defined(__SSE2__) || (defined(QT_COMPILER_SUPPORTS_SSE2) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)) @@ -229,20 +243,6 @@ #if defined(__AVX__) || (defined(QT_COMPILER_SUPPORTS_AVX) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)) // immintrin.h is the ultimate header, we don't need anything else after this #include <immintrin.h> - -# if defined(Q_CC_MSVC) && (defined(_M_AVX) || defined(__AVX__)) -// MS Visual Studio 2010 has no macro pre-defined to identify the use of /arch:AVX -// MS Visual Studio 2013 adds it: __AVX__ -// See: http://connect.microsoft.com/VisualStudio/feedback/details/605858/arch-avx-should-define-a-predefined-macro-in-x64-and-set-a-unique-value-for-m-ix86-fp-in-win32 -# define __SSE3__ 1 -# define __SSSE3__ 1 -// no Intel CPU supports SSE4a, so don't define it -# define __SSE4_1__ 1 -# define __SSE4_2__ 1 -# ifndef __AVX__ -# define __AVX__ 1 -# endif -# endif #endif #define QT_FUNCTION_TARGET_STRING_AVX512F "avx512f" |