diff options
author | Julian Taylor <jtaylor.debian@googlemail.com> | 2016-10-11 19:03:02 +0200 |
---|---|---|
committer | Julian Taylor <jtaylor.debian@googlemail.com> | 2016-10-11 19:20:51 +0200 |
commit | b5471e08bd4fe30363c1f66a640e9ceae1653a86 (patch) | |
tree | 8a117962bdb86d94e936001bf960f2fc14a5bffe /numpy/core | |
parent | dbb70947b95b92abf3e48ef8be7bd3ab79489892 (diff) | |
download | numpy-b5471e08bd4fe30363c1f66a640e9ceae1653a86.tar.gz |
MAINT: check that linker can handle AVX
some people use new compilers with old linkers so the target attribute
check for AVX is not enough
closes gh-8128
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/include/numpy/npy_common.h | 4 | ||||
-rw-r--r-- | numpy/core/setup.py | 8 | ||||
-rw-r--r-- | numpy/core/setup_common.py | 7 |
3 files changed, 13 insertions, 6 deletions
diff --git a/numpy/core/include/numpy/npy_common.h b/numpy/core/include/numpy/npy_common.h index 11a988163..bd221547f 100644 --- a/numpy/core/include/numpy/npy_common.h +++ b/numpy/core/include/numpy/npy_common.h @@ -29,12 +29,12 @@ #endif /* compile target attributes */ -#ifdef HAVE_ATTRIBUTE_TARGET_AVX +#if defined HAVE_ATTRIBUTE_TARGET_AVX && defined HAVE_LINK_AVX #define NPY_GCC_TARGET_AVX __attribute__((target("avx"))) #else #define NPY_GCC_TARGET_AVX #endif -#ifdef HAVE_ATTRIBUTE_TARGET_AVX2 +#if defined HAVE_ATTRIBUTE_TARGET_AVX2 && defined HAVE_LINK_AVX2 #define NPY_GCC_TARGET_AVX2 __attribute__((target("avx2"))) #else #define NPY_GCC_TARGET_AVX2 diff --git a/numpy/core/setup.py b/numpy/core/setup.py index 0b055dba4..07c8478cd 100644 --- a/numpy/core/setup.py +++ b/numpy/core/setup.py @@ -152,12 +152,14 @@ def check_math_capabilities(config, moredefs, mathlibs): for tup in OPTIONAL_INTRINSICS: headers = None if len(tup) == 2: - f, args = tup + f, args, m = tup[0], tup[1], fname2def(tup[0]) + elif len(tup) == 3: + f, args, headers, m = tup[0], tup[1], [tup[2]], fname2def(tup[0]) else: - f, args, headers = tup[0], tup[1], [tup[2]] + f, args, headers, m = tup[0], tup[1], [tup[2]], fname2def(tup[3]) if config.check_func(f, decl=False, call=True, call_args=args, headers=headers): - moredefs.append((fname2def(f), 1)) + moredefs.append((m, 1)) for dec, fn in OPTIONAL_FUNCTION_ATTRIBUTES: if config.check_gcc_function_attribute(dec, fn): diff --git a/numpy/core/setup_common.py b/numpy/core/setup_common.py index cc2047b45..9202faecf 100644 --- a/numpy/core/setup_common.py +++ b/numpy/core/setup_common.py @@ -116,7 +116,7 @@ OPTIONAL_HEADERS = [ ] # optional gcc compiler builtins and their call arguments and optional a -# required header +# required header and definition name (HAVE_ prepended) # call arguments are required as the compiler will do strict signature checking OPTIONAL_INTRINSICS = [("__builtin_isnan", '5.'), ("__builtin_isinf", '5.'), @@ -131,6 +131,11 @@ OPTIONAL_INTRINSICS = [("__builtin_isnan", '5.'), "xmmintrin.h"), # SSE ("_mm_load_pd", '(double*)0', "emmintrin.h"), # SSE2 ("__builtin_prefetch", "(float*)0, 0, 3"), + # check that the linker can handle avx + ("__asm__ volatile", '"vpand %xmm1, %xmm2, %xmm3"', + "stdio.h", "LINK_AVX"), + ("__asm__ volatile", '"vpand %ymm1, %ymm2, %ymm3"', + "stdio.h", "LINK_AVX2"), ] # function attributes |