/ lib / numpy / distutils / checks / cpu_neon.c
cpu_neon.c
 1  #ifdef _MSC_VER
 2      #include <Intrin.h>
 3  #endif
 4  #include <arm_neon.h>
 5  
 6  int main(int argc, char **argv)
 7  {
 8      // passing from untraced pointers to avoid optimizing out any constants
 9      // so we can test against the linker.
10      float *src = (float*)argv[argc-1];
11      float32x4_t v1 = vdupq_n_f32(src[0]), v2 = vdupq_n_f32(src[1]);
12      int ret = (int)vgetq_lane_f32(vmulq_f32(v1, v2), 0);
13  #ifdef __aarch64__
14      double *src2 = (double*)argv[argc-2];
15      float64x2_t vd1 = vdupq_n_f64(src2[0]), vd2 = vdupq_n_f64(src2[1]);
16      ret += (int)vgetq_lane_f64(vmulq_f64(vd1, vd2), 0);
17  #endif
18      return ret;
19  }