From ff1ffa7577ba88412daf9904bbc1e4de9e024436 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 15 Nov 2017 15:14:35 -0800 Subject: Add support for AVX-512 intrinsics found in MSVC 2017 15.3 It seems the compiler supports /arch:AVX512 and /arch:AVX512F but none of the other switches (and neither are documented). And when you pass those, you also get Conflict Detection (CD), Double & Quad (DQ), Byte & Word (BW) and Vector Length (VL), which matches the ICC switch "-xCORE-AVX512". Unlike ICC, there doesn't seem to be an option to enable only the common part of AVX-512. Support for Intel Xeon Phi's current features (Exponential & Reciprocation and Prefetch) and future ones (IFMA, VBMI, 4FMAPS, 4VNNI and VPOPCNTDQ) seems to be missing altogether. See https://blogs.msdn.microsoft.com/vcblog/2017/07/11/microsoft-visual-studio-2017-supports-intel-avx-512/ Change-Id: I98105cd9616b8097957db680d73eb1f86e487e6d Reviewed-by: Oswald Buddenhagen --- config.tests/avx512/avx512.cpp | 29 ++++++++++++++++------------- config.tests/avx512/avx512.pro | 2 +- 2 files changed, 17 insertions(+), 14 deletions(-) (limited to 'config.tests') diff --git a/config.tests/avx512/avx512.cpp b/config.tests/avx512/avx512.cpp index ca1a5d1357..29e88ebf15 100644 --- a/config.tests/avx512/avx512.cpp +++ b/config.tests/avx512/avx512.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 Intel Corporation. +** Copyright (C) 2017 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the configuration of the Qt Toolkit. @@ -39,15 +39,18 @@ #include -#ifndef AVX512WANT -# error ".pro file must define AVX512WANT macro to the AVX-512 feature to be tested" +#ifndef __AVX512F__ +# error "There doesn't seem to be AVX-512 support in this compiler" +#endif +#ifndef WANT_AVX512 +# error ".pro file must define WANT_AVX512 macro to the AVX-512 feature to be tested" #endif // The following checks if __AVXx__ is defined, where x is the value in -// AVX512WANT +// WANT_AVX512 #define HAS2(x) __AVX512 ## x ## __ #define HAS(x) HAS2(x) -#if !HAS(AVX512WANT) +#if !HAS(WANT_AVX512) # error "Feature not supported" #endif @@ -62,36 +65,36 @@ int main(int, char**argv) d = _mm512_loadu_pd((double *)argv + 64); f = _mm512_loadu_ps((float *)argv + 128); -#ifdef __AVX512ER__ +#ifdef WANT_AVX512ER /* AVX512 Exponential and Reciprocal */ f = _mm512_exp2a23_round_ps(f, 8); #endif -#ifdef __AVX512CD__ +#ifdef WANT_AVX512CD /* AVX512 Conflict Detection */ i = _mm512_maskz_conflict_epi32(m, i); #endif -#ifdef __AVX512PF__ +#ifdef WANT_AVX512PF /* AVX512 Prefetch */ _mm512_mask_prefetch_i64scatter_pd(argv, 0xf, i, 2, 2); #endif -#ifdef __AVX512DQ__ +#ifdef WANT_AVX512DQ /* AVX512 Doubleword and Quadword support */ m = _mm512_movepi32_mask(i); #endif -#ifdef __AVX512BW__ +#ifdef WANT_AVX512BW /* AVX512 Byte and Word support */ i = _mm512_mask_loadu_epi8(i, m, argv - 8); #endif -#ifdef __AVX512VL__ +#ifdef WANT_AVX512VL /* AVX512 Vector Length */ __m256i i2 = _mm256_maskz_loadu_epi32(0, argv); _mm256_mask_storeu_epi32(argv + 1, m, i2); #endif -#ifdef __AVX512IFMA__ +#ifdef WANT_AVX512IFMA /* AVX512 Integer Fused Multiply-Add */ i = _mm512_madd52lo_epu64(i, i, i); #endif -#ifdef __AVX512VBMI__ +#ifdef WANT_AVX512VBMI /* AVX512 Vector Byte Manipulation Instructions */ i = _mm512_permutexvar_epi8(i, i); #endif diff --git a/config.tests/avx512/avx512.pro b/config.tests/avx512/avx512.pro index 1edf5e5432..d295f6320c 100644 --- a/config.tests/avx512/avx512.pro +++ b/config.tests/avx512/avx512.pro @@ -7,4 +7,4 @@ value = $$eval($$varname) !defined($$varname, "var"): error("This compiler does not support AVX512") QMAKE_CXXFLAGS += $$value -DEFINES += AVX512WANT=$$AVX512 +DEFINES += WANT_AVX512=$$AVX512 WANT_AVX512$$AVX512 -- cgit v1.2.3