cpu_neon.cpp 731 B

1234567891011121314151617181920212223242526272829303132
  1. #include <stdio.h>
  2. #if defined _WIN32 && (defined(_M_ARM) || defined(_M_ARM64) || defined(_M_ARM64EC))
  3. # define _ARM64_DISTINCT_NEON_TYPES
  4. # include <Intrin.h>
  5. # include <arm_neon.h>
  6. # define CV_NEON 1
  7. #elif defined(__ARM_NEON)
  8. # include <arm_neon.h>
  9. # define CV_NEON 1
  10. #endif
  11. // MSVC 2019 bug. Details: https://github.com/opencv/opencv/pull/16027
  12. void test_aliased_type(const uint8x16_t& a) { }
  13. void test_aliased_type(const int8x16_t& a) { }
  14. #if defined CV_NEON
  15. int test()
  16. {
  17. const float src[] = { 0.0f, 0.0f, 0.0f, 0.0f };
  18. float32x4_t val = vld1q_f32((const float32_t*)(src));
  19. return (int)vgetq_lane_f32(val, 0);
  20. }
  21. #else
  22. #error "NEON is not supported"
  23. #endif
  24. int main()
  25. {
  26. printf("%d\n", test());
  27. return 0;
  28. }