summaryrefslogtreecommitdiff
path: root/numpy/core/include
diff options
context:
space:
mode:
authorJulian Taylor <jtaylor.debian@googlemail.com>2016-09-24 12:45:01 +0200
committerJulian Taylor <jtaylor.debian@googlemail.com>2016-09-24 13:15:09 +0200
commita860256f88c8ebb3f74eb7e90ee89f05dedf3a7c (patch)
tree5aff93e33860517e465bf3f6f1d06c2929c4a436 /numpy/core/include
parent37740eb8c09dbc6b074aa10298401f994cd7fa55 (diff)
downloadnumpy-a860256f88c8ebb3f74eb7e90ee89f05dedf3a7c.tar.gz
MAINT: add runtime check for AVX macros
Diffstat (limited to 'numpy/core/include')
-rw-r--r--numpy/core/include/numpy/npy_common.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/numpy/core/include/numpy/npy_common.h b/numpy/core/include/numpy/npy_common.h
index d851b7fb2..21b15869f 100644
--- a/numpy/core/include/numpy/npy_common.h
+++ b/numpy/core/include/numpy/npy_common.h
@@ -29,6 +29,11 @@
#endif
/* compile target attributes */
+#ifdef HAVE_ATTRIBUTE_TARGET_AVX
+#define NPY_GCC_TARGET_AVX __attribute__((target("avx")))
+#else
+#define NPY_GCC_TARGET_AVX
+#endif
#ifdef HAVE_ATTRIBUTE_TARGET_AVX2
#define NPY_GCC_TARGET_AVX2 __attribute__((target("avx2")))
#else
@@ -92,7 +97,13 @@
#else
#define NPY_CPU_SUPPORTS_AVX2 0
#endif
+ #ifdef HAVE_ATTRIBUTE_TARGET_AVX
+ #define NPY_CPU_SUPPORTS_AVX __builtin_cpu_supports("avx")
+ #else
+ #define NPY_CPU_SUPPORTS_AVX 0
+ #endif
#else
+ #define NPY_CPU_SUPPORTS_AVX 0
#define NPY_CPU_SUPPORTS_AVX2 0
#endif