From f615807da60f47848d20a2ec05fafa9941eabb09 Mon Sep 17 00:00:00 2001 From: Raghuveer Devulapalli Date: Sun, 21 Jul 2019 07:31:11 -0700 Subject: BUG: fix build issue on icc 2016 Test if compiler supports _builtin_supports("avx512f") before calling it --- numpy/core/setup_common.py | 2 ++ numpy/core/src/umath/cpuid.c | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'numpy') diff --git a/numpy/core/setup_common.py b/numpy/core/setup_common.py index bf6abcf02..307fab334 100644 --- a/numpy/core/setup_common.py +++ b/numpy/core/setup_common.py @@ -138,6 +138,8 @@ OPTIONAL_INTRINSICS = [("__builtin_isnan", '5.'), # broken on OSX 10.11, make sure its not optimized away ("volatile int r = __builtin_cpu_supports", '"sse"', "stdio.h", "__BUILTIN_CPU_SUPPORTS"), + ("volatile int r = __builtin_cpu_supports", '"avx512f"', + "stdio.h", "__BUILTIN_CPU_SUPPORTS_AVX512F"), # MMX only needed for icc, but some clangs don't have it ("_m_from_int64", '0', "emmintrin.h"), ("_mm_load_ps", '(float*)0', "xmmintrin.h"), # SSE diff --git a/numpy/core/src/umath/cpuid.c b/numpy/core/src/umath/cpuid.c index 51c540457..8673f1736 100644 --- a/numpy/core/src/umath/cpuid.c +++ b/numpy/core/src/umath/cpuid.c @@ -57,10 +57,10 @@ npy_cpu_supports(const char * feature) { #ifdef HAVE___BUILTIN_CPU_SUPPORTS if (strcmp(feature, "avx512f") == 0) { -#if defined(__GNUC__) && (__GNUC__ < 5) - return 0; -#else +#ifdef HAVE___BUILTIN_CPU_SUPPORTS_AVX512F return __builtin_cpu_supports("avx512f") && os_avx512_support(); +#else + return 0; #endif } else if (strcmp(feature, "avx2") == 0) { -- cgit v1.2.1