cpu_neon.cpp 724 B

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