cpu_lasx.cpp 434 B

1234567891011121314151617181920212223
  1. #include <stdio.h>
  2. #if defined(__loongarch_asx)
  3. # include <lasxintrin.h>
  4. # define CV_LASX 1
  5. #endif
  6. #if defined CV_LASX
  7. int test()
  8. {
  9. const float src[] = { 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f };
  10. v8f32 val = (v8f32)__lasx_xvld((const float*)(src), 0);
  11. return __lasx_xvpickve2gr_w(__lasx_xvftint_w_s (val), 7);
  12. }
  13. #else
  14. #error "LASX is not supported"
  15. #endif
  16. int main()
  17. {
  18. printf("%d\n", test());
  19. return 0;
  20. }