cpu_rvv.cpp 407 B

1234567891011121314151617181920212223
  1. #include <stdio.h>
  2. #if defined(__riscv)
  3. # include <riscv_vector.h>
  4. # define CV_RVV 1
  5. #endif
  6. #if defined CV_RVV
  7. int test()
  8. {
  9. const float src[] = { 0.0f, 0.0f, 0.0f, 0.0f };
  10. vfloat32m1_t val = vle32_v_f32m1((const float*)(src), 4);
  11. return (int)vfmv_f_s_f32m1_f32(val);
  12. }
  13. #else
  14. #error "RISC-V vector extension(RVV) is not supported"
  15. #endif
  16. int main()
  17. {
  18. printf("%d\n", test());
  19. return 0;
  20. }