summaryrefslogtreecommitdiff
path: root/numpy/distutils/checks/cpu_f16c.c
diff options
context:
space:
mode:
authorSayed Adel <seiko@imavr.com>2021-05-26 00:34:57 +0200
committerSayed Adel <seiko@imavr.com>2021-05-26 23:35:47 +0200
commit0ec2c91dfdc6d62c7e2ebd0071a0dc990e1a84ec (patch)
tree399fc264a8b25e48e3aa96fe3b0df584a3c9f7b3 /numpy/distutils/checks/cpu_f16c.c
parent5520a1757e4476bc6526973ad46c46b82637ae1c (diff)
downloadnumpy-0ec2c91dfdc6d62c7e2ebd0071a0dc990e1a84ec.tar.gz
BUG, SIMD: Fix detect host/native CPU features on ICC during compile-time
Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics, whether or not the build options for those features are specified. Therefore, we must test #definitions of CPU features when option native/host is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise the test will be broken and leads to enable all possible features.
Diffstat (limited to 'numpy/distutils/checks/cpu_f16c.c')
-rw-r--r--numpy/distutils/checks/cpu_f16c.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/numpy/distutils/checks/cpu_f16c.c b/numpy/distutils/checks/cpu_f16c.c
index 678c582e4..fdf36cec5 100644
--- a/numpy/distutils/checks/cpu_f16c.c
+++ b/numpy/distutils/checks/cpu_f16c.c
@@ -1,3 +1,16 @@
+#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER)
+ /*
+ * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics,
+ * whether or not the build options for those features are specified.
+ * Therefore, we must test #definitions of CPU features when option native/host
+ * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise
+ * the test will be broken and leads to enable all possible features.
+ */
+ #ifndef __F16C__
+ #error "HOST/ARCH doesn't support F16C"
+ #endif
+#endif
+
#include <emmintrin.h>
#include <immintrin.h>