Skip to content

Commit

Permalink
feat: Add vrecpe[s|d]_[f32|f64]
Browse files Browse the repository at this point in the history
  • Loading branch information
howjmay committed Jul 25, 2024
1 parent fd1fe49 commit fbb4002
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
4 changes: 2 additions & 2 deletions neon2rvv.h
Original file line number Diff line number Diff line change
Expand Up @@ -7243,9 +7243,9 @@ FORCE_INLINE float64x1_t vrecpe_f64(float64x1_t a) { return __riscv_vfrec7_v_f64

FORCE_INLINE float64x2_t vrecpeq_f64(float64x2_t a) { return __riscv_vfrec7_v_f64m1(a, 2); }

// FORCE_INLINE float32_t vrecpes_f32(float32_t a);
FORCE_INLINE float32_t vrecpes_f32(float32_t a) { return 1.0f / a; }

// FORCE_INLINE float64_t vrecped_f64(float64_t a);
FORCE_INLINE float64_t vrecped_f64(float64_t a) { return 1.0f / a; }

// FORCE_INLINE uint32x4_t vrecpeq_u32(uint32x4_t a);

Expand Down
26 changes: 24 additions & 2 deletions tests/impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25755,9 +25755,31 @@ result_t test_vrecpeq_f64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {
#endif // ENABLE_TEST_ALL
}

result_t test_vrecpes_f32(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; }
result_t test_vrecpes_f32(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {
#ifdef ENABLE_TEST_ALL
const float *_a = impl.test_cases_float_pointer1;
float _c, c;
_c = 1.0f / _a[0];

c = vrecpes_f32(_a[0]);
return validate_float_error(c, _c, 0.01f);
#else
return TEST_UNIMPL;
#endif // ENABLE_TEST_ALL
}

result_t test_vrecped_f64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; }
result_t test_vrecped_f64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {
#ifdef ENABLE_TEST_ALL
const double *_a = (const double *)impl.test_cases_float_pointer1;
double _c, c;
_c = 1.0f / _a[0];

c = vrecped_f64(_a[0]);
return validate_double_error(c, _c, 0.01f);
#else
return TEST_UNIMPL;
#endif // ENABLE_TEST_ALL
}

result_t test_vrecpeq_u32(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; }

Expand Down
4 changes: 2 additions & 2 deletions tests/impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1393,8 +1393,8 @@
_(vrecpeq_f32) \
_(vrecpe_f64) \
_(vrecpeq_f64) \
/*_(vrecpes_f32) */ \
/*_(vrecped_f64) */ \
_(vrecpes_f32) \
_(vrecped_f64) \
_(vrecpeq_u32) \
_(vrsqrte_f32) \
_(vrsqrte_u32) \
Expand Down

0 comments on commit fbb4002

Please sign in to comment.