Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add vrsqrte[s|d]_[f32|f64] #452

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions neon2rvv.h
Original file line number Diff line number Diff line change
Expand Up @@ -7259,9 +7259,9 @@ FORCE_INLINE float64x1_t vrsqrte_f64(float64x1_t a) { return __riscv_vfrsqrt7_v_

FORCE_INLINE float64x2_t vrsqrteq_f64(float64x2_t a) { return __riscv_vfrsqrt7_v_f64m1(a, 2); }

// FORCE_INLINE float32_t vrsqrtes_f32(float32_t a);
FORCE_INLINE float32_t vrsqrtes_f32(float32_t a) { return 1 / sqrtf(a); }

// FORCE_INLINE float64_t vrsqrted_f64(float64_t a);
FORCE_INLINE float64_t vrsqrted_f64(float64_t a) { return 1 / sqrt(a); }

// FORCE_INLINE uint32x4_t vrsqrteq_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 @@ -25845,9 +25845,31 @@ result_t test_vrsqrteq_f64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {
#endif // ENABLE_TEST_ALL
}

result_t test_vrsqrtes_f32(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; }
result_t test_vrsqrtes_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 / sqrtf(_a[0]);

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

result_t test_vrsqrted_f64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; }
result_t test_vrsqrted_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 / sqrt(_a[0]);

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

result_t test_vrsqrteq_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 @@ -1401,8 +1401,8 @@
_(vrsqrteq_f32) \
_(vrsqrte_f64) \
_(vrsqrteq_f64) \
/*_(vrsqrtes_f32) */ \
/*_(vrsqrted_f64) */ \
_(vrsqrtes_f32) \
_(vrsqrted_f64) \
_(vrsqrteq_u32) \
_(vget_lane_s8) \
_(vget_lane_s16) \
Expand Down
Loading