summaryrefslogtreecommitdiff
path: root/numpy/distutils/checks/cpu_asimdfhm.c
diff options
context:
space:
mode:
authorSayed Adel <seiko@imavr.com>2022-06-09 05:09:31 +0200
committerSayed Adel <seiko@imavr.com>2022-06-09 20:58:56 +0200
commitcc92935d94b6703b5971c6c42b771ab54b041b76 (patch)
tree0a3eea8cfa85818be619f99e9dca57d80b8b5112 /numpy/distutils/checks/cpu_asimdfhm.c
parent5fedeb7e4f5140ab5b422fe7502a0c3b23feaf9b (diff)
downloadnumpy-cc92935d94b6703b5971c6c42b771ab54b041b76.tar.gz
BLD, SIMD: Hardened the Neon/ASIMD compile-time tests
Avoid passing any constants or traced pointers to avoid compiler optimizations, so we make the sure the required instructions have been tested against the linker.
Diffstat (limited to 'numpy/distutils/checks/cpu_asimdfhm.c')
-rw-r--r--numpy/distutils/checks/cpu_asimdfhm.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/numpy/distutils/checks/cpu_asimdfhm.c b/numpy/distutils/checks/cpu_asimdfhm.c
index cb49751c4..af29d3003 100644
--- a/numpy/distutils/checks/cpu_asimdfhm.c
+++ b/numpy/distutils/checks/cpu_asimdfhm.c
@@ -3,12 +3,14 @@
#endif
#include <arm_neon.h>
-int main(void)
+int main(int argc, char **argv)
{
- float16x8_t vhp = vdupq_n_f16((float16_t)1);
- float16x4_t vlhp = vdup_n_f16((float16_t)1);
- float32x4_t vf = vdupq_n_f32(1.0f);
- float32x2_t vlf = vdup_n_f32(1.0f);
+ float16_t *src = (float16_t*)argv[argc-1];
+ float *src2 = (float*)argv[argc-2];
+ float16x8_t vhp = vdupq_n_f16(src[0]);
+ float16x4_t vlhp = vdup_n_f16((src[1]);
+ float32x4_t vf = vdupq_n_f32(src2[0]);
+ float32x2_t vlf = vdup_n_f32(src2[1]);
int ret = (int)vget_lane_f32(vfmlal_low_f16(vlf, vlhp, vlhp), 0);
ret += (int)vgetq_lane_f32(vfmlslq_high_f16(vf, vhp, vhp), 0);