summaryrefslogtreecommitdiff
path: root/numpy/distutils/checks/cpu_fma3.c
diff options
context:
space:
mode:
authorSayed Adel <seiko@imavr.com>2020-06-13 18:15:25 +0200
committerSayed Adel <seiko@imavr.com>2020-06-15 22:48:29 +0200
commitda21d28ef69e65c5bfef8dc22840fe16fec52540 (patch)
treedcff74da7f8712f0328d3c1ed49527a0fd6f131d /numpy/distutils/checks/cpu_fma3.c
parent5345c2575a28fa2dfbbec83c99636669476c2745 (diff)
downloadnumpy-da21d28ef69e65c5bfef8dc22840fe16fec52540.tar.gz
ENH: [1/7] enable multi-platform SIMD compiler optimizations
Implement new distutils class `CCompilerOpt`, used for handling the CPU/hardware optimization, starting from parsing the command arguments, to managing the relationship between the CPU baseline and dispatch-able features, also generating the required C headers and ending with compiling the sources with proper compiler's flags. `CCompilerOpt` mainly used as a helper class for `CCompiler`, and doesn't provide any runtime detection for the CPU features, instead only focuses on the compiler side, but it generates abstract C headers that can be used later for the final runtime dispatching process.
Diffstat (limited to 'numpy/distutils/checks/cpu_fma3.c')
-rw-r--r--numpy/distutils/checks/cpu_fma3.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/numpy/distutils/checks/cpu_fma3.c b/numpy/distutils/checks/cpu_fma3.c
new file mode 100644
index 000000000..cf34c6cb1
--- /dev/null
+++ b/numpy/distutils/checks/cpu_fma3.c
@@ -0,0 +1,8 @@
+#include <xmmintrin.h>
+#include <immintrin.h>
+
+int main(void)
+{
+ __m256 a = _mm256_fmadd_ps(_mm256_setzero_ps(), _mm256_setzero_ps(), _mm256_setzero_ps());
+ return (int)_mm_cvtss_f32(_mm256_castps256_ps128(a));
+}