cpu_neon_dotprod.cpp 681 B

1234567891011121314151617181920212223242526
  1. #include <stdio.h>
  2. #if (defined __GNUC__ && (defined __arm__ || defined __aarch64__))/* || (defined _MSC_VER && (defined _M_ARM64 || defined _M_ARM64EC)) */
  3. // Windows + ARM64 case disabled: https://github.com/opencv/opencv/issues/25052
  4. #include "arm_neon.h"
  5. int test()
  6. {
  7. const unsigned int src[] = { 0, 0, 0, 0 };
  8. unsigned int dst[4];
  9. uint32x4_t v_src = *(uint32x4_t*)src;
  10. uint8x16_t v_m0 = *(uint8x16_t*)src;
  11. uint8x16_t v_m1 = *(uint8x16_t*)src;
  12. uint32x4_t v_dst = vdotq_u32(v_src, v_m0, v_m1);
  13. *(uint32x4_t*)dst = v_dst;
  14. return (int)dst[0];
  15. }
  16. #else
  17. #error "DOTPROD is not supported"
  18. #endif
  19. int main()
  20. {
  21. printf("%d\n", test());
  22. return 0;
  23. }