From d752c2d2bb000f805a052abb4336c7d9e7fb95d0 Mon Sep 17 00:00:00 2001 From: Yang Hau Date: Thu, 1 Aug 2024 01:24:28 +0800 Subject: [PATCH] feat: Add vcvts_f32_[s32|u32] --- neon2rvv.h | 4 ++-- tests/impl.cpp | 24 ++++++++++++++++++++++-- tests/impl.h | 4 ++-- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/neon2rvv.h b/neon2rvv.h index a397e126..6fb31f64 100644 --- a/neon2rvv.h +++ b/neon2rvv.h @@ -8068,9 +8068,9 @@ FORCE_INLINE float32x4_t vcvtq_f32_s32(int32x4_t a) { return __riscv_vfcvt_f_x_v FORCE_INLINE float32x4_t vcvtq_f32_u32(uint32x4_t a) { return __riscv_vfcvt_f_xu_v_f32m1(a, 4); } -// FORCE_INLINE float32_t vcvts_f32_s32(int32_t a); +FORCE_INLINE float32_t vcvts_f32_s32(int32_t a) { return (float32_t)a; } -// FORCE_INLINE float32_t vcvts_f32_u32(uint32_t a); +FORCE_INLINE float32_t vcvts_f32_u32(uint32_t a) { return (float32_t)a; } // FORCE_INLINE float64x1_t vcvt_f64_s64(int64x1_t a); diff --git a/tests/impl.cpp b/tests/impl.cpp index 30a8e937..2f37b567 100644 --- a/tests/impl.cpp +++ b/tests/impl.cpp @@ -30014,9 +30014,29 @@ result_t test_vcvtq_f32_u32(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { #endif // ENABLE_TEST_ALL } -result_t test_vcvts_f32_s32(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; } +result_t test_vcvts_f32_s32(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { +#ifdef ENABLE_TEST_ALL + const int32_t *_a = (const int32_t *)impl.test_cases_int_pointer1; + float _c, c; + _c = (float)_a[0]; + c = vcvts_f32_s32(_a[0]); + return c == _c ? TEST_SUCCESS : TEST_FAIL; +#else + return TEST_UNIMPL; +#endif // ENABLE_TEST_ALL +} -result_t test_vcvts_f32_u32(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; } +result_t test_vcvts_f32_u32(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { +#ifdef ENABLE_TEST_ALL + const uint32_t *_a = (const uint32_t *)impl.test_cases_int_pointer1; + float _c, c; + _c = (float)_a[0]; + c = vcvts_f32_u32(_a[0]); + return c == _c ? TEST_SUCCESS : TEST_FAIL; +#else + return TEST_UNIMPL; +#endif // ENABLE_TEST_ALL +} result_t test_vcvt_f64_s64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; } diff --git a/tests/impl.h b/tests/impl.h index edb32403..4678e2ad 100644 --- a/tests/impl.h +++ b/tests/impl.h @@ -1659,8 +1659,8 @@ _(vcvtq_s32_f32) \ _(vcvtq_f32_s32) \ _(vcvtq_f32_u32) \ - /*_(vcvts_f32_s32) */ \ - /*_(vcvts_f32_u32) */ \ + _(vcvts_f32_s32) \ + _(vcvts_f32_u32) \ /*_(vcvt_f64_s64) */ \ /*_(vcvtq_f64_s64) */ \ /*_(vcvt_f64_u64) */ \