diff --git a/neon2rvv.h b/neon2rvv.h index 0c95e117..8cdec040 100644 --- a/neon2rvv.h +++ b/neon2rvv.h @@ -8138,13 +8138,13 @@ FORCE_INLINE uint32x4_t vcvtq_u32_f32(float32x4_t a) { return __riscv_vfcvt_rtz_ // FORCE_INLINE uint32_t vcvtas_u32_f32(float32_t a); -// FORCE_INLINE int64x1_t vcvt_s64_f64(float64x1_t a); +FORCE_INLINE int64x1_t vcvt_s64_f64(float64x1_t a) { return __riscv_vfcvt_rtz_x_f_v_i64m1(a, 1); } -// FORCE_INLINE int64x2_t vcvtq_s64_f64(float64x2_t a); +FORCE_INLINE int64x2_t vcvtq_s64_f64(float64x2_t a) { return __riscv_vfcvt_rtz_x_f_v_i64m1(a, 2); } -// FORCE_INLINE uint64x1_t vcvt_u64_f64(float64x1_t a); +FORCE_INLINE uint64x1_t vcvt_u64_f64(float64x1_t a) { return __riscv_vfcvt_rtz_xu_f_v_u64m1(a, 1); } -// FORCE_INLINE uint64x2_t vcvtq_u64_f64(float64x2_t a); +FORCE_INLINE uint64x2_t vcvtq_u64_f64(float64x2_t a) { return __riscv_vfcvt_rtz_xu_f_v_u64m1(a, 2); } // FORCE_INLINE int64x1_t vcvtn_s64_f64(float64x1_t a); @@ -8178,9 +8178,9 @@ FORCE_INLINE uint32x4_t vcvtq_u32_f32(float32x4_t a) { return __riscv_vfcvt_rtz_ // FORCE_INLINE uint64x2_t vcvtaq_u64_f64(float64x2_t a); -// FORCE_INLINE int64_t vcvtd_s64_f64(float64_t a); +FORCE_INLINE int64_t vcvtd_s64_f64(float64_t a) { return (int64_t)a; } -// FORCE_INLINE uint64_t vcvtd_u64_f64(float64_t a); +FORCE_INLINE uint64_t vcvtd_u64_f64(float64_t a) { return (uint64_t)a; } // FORCE_INLINE int64_t vcvtnd_s64_f64(float64_t a); diff --git a/tests/impl.cpp b/tests/impl.cpp index e64d026f..1339c891 100644 --- a/tests/impl.cpp +++ b/tests/impl.cpp @@ -30196,13 +30196,69 @@ result_t test_vcvtas_s32_f32(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { re result_t test_vcvtas_u32_f32(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; } -result_t test_vcvt_s64_f64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; } +result_t test_vcvt_s64_f64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { +#ifdef ENABLE_TEST_ALL + const double *_a = (const double *)impl.test_cases_float_pointer1; + int64_t _c[1]; + for (int i = 0; i < 1; i++) { + _c[i] = _a[i]; + } + + float64x1_t a = vld1_f64(_a); + int64x1_t c = vcvt_s64_f64(a); + return validate_int64(c, _c[0]); +#else + return TEST_UNIMPL; +#endif // ENABLE_TEST_ALL +} + +result_t test_vcvtq_s64_f64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { +#ifdef ENABLE_TEST_ALL + const double *_a = (const double *)impl.test_cases_float_pointer1; + int64_t _c[2]; + for (int i = 0; i < 2; i++) { + _c[i] = _a[i]; + } + + float64x2_t a = vld1q_f64(_a); + int64x2_t c = vcvtq_s64_f64(a); + return validate_int64(c, _c[0], _c[1]); +#else + return TEST_UNIMPL; +#endif // ENABLE_TEST_ALL +} -result_t test_vcvtq_s64_f64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; } +result_t test_vcvt_u64_f64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { +#ifdef ENABLE_TEST_ALL + const double *_a = (const double *)impl.test_cases_float_pointer1; + uint64_t _c[1]; + for (int i = 0; i < 1; i++) { + _c[i] = _a[i]; + } + + float64x1_t a = vld1_f64(_a); + uint64x1_t c = vcvt_u64_f64(a); + return validate_uint64(c, _c[0]); +#else + return TEST_UNIMPL; +#endif // ENABLE_TEST_ALL +} -result_t test_vcvt_u64_f64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; } +result_t test_vcvtq_u64_f64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { +#ifdef ENABLE_TEST_ALL + const double *_a = (const double *)impl.test_cases_float_pointer1; + uint64_t _c[2]; + for (int i = 0; i < 2; i++) { + _c[i] = _a[i]; + } -result_t test_vcvtq_u64_f64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; } + float64x2_t a = vld1q_f64(_a); + uint64x2_t c = vcvtq_u64_f64(a); + return validate_uint64(c, _c[0], _c[1]); +#else + return TEST_UNIMPL; +#endif // ENABLE_TEST_ALL +} result_t test_vcvtn_s64_f64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; } @@ -30236,9 +30292,31 @@ result_t test_vcvta_u64_f64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { ret result_t test_vcvtaq_u64_f64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; } -result_t test_vcvtd_s64_f64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; } +result_t test_vcvtd_s64_f64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { +#ifdef ENABLE_TEST_ALL + const double *_a = (const double *)impl.test_cases_float_pointer1; + int64_t _c, c; + _c = _a[0]; + + c = vcvtd_s64_f64(_a[0]); + return c == _c ? TEST_SUCCESS : TEST_FAIL; +#else + return TEST_UNIMPL; +#endif // ENABLE_TEST_ALL +} + +result_t test_vcvtd_u64_f64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { +#ifdef ENABLE_TEST_ALL + const double *_a = (const double *)impl.test_cases_float_pointer1; + uint64_t _c, c; + _c = _a[0]; -result_t test_vcvtd_u64_f64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; } + c = vcvtd_u64_f64(_a[0]); + return c == _c ? TEST_SUCCESS : TEST_FAIL; +#else + return TEST_UNIMPL; +#endif // ENABLE_TEST_ALL +} result_t test_vcvtnd_s64_f64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; } diff --git a/tests/impl.h b/tests/impl.h index f01b492b..b053816d 100644 --- a/tests/impl.h +++ b/tests/impl.h @@ -1694,10 +1694,10 @@ /*_(vcvtps_u32_f32) */ \ /*_(vcvtas_s32_f32) */ \ /*_(vcvtas_u32_f32) */ \ - /*_(vcvt_s64_f64) */ \ - /*_(vcvtq_s64_f64) */ \ - /*_(vcvt_u64_f64) */ \ - /*_(vcvtq_u64_f64) */ \ + _(vcvt_s64_f64) \ + _(vcvtq_s64_f64) \ + _(vcvt_u64_f64) \ + _(vcvtq_u64_f64) \ /*_(vcvtn_s64_f64) */ \ /*_(vcvtnq_s64_f64) */ \ /*_(vcvtn_u64_f64) */ \ @@ -1714,8 +1714,8 @@ /*_(vcvtaq_s64_f64) */ \ /*_(vcvta_u64_f64) */ \ /*_(vcvtaq_u64_f64) */ \ - /*_(vcvtd_s64_f64) */ \ - /*_(vcvtd_u64_f64) */ \ + _(vcvtd_s64_f64) \ + _(vcvtd_u64_f64) \ /*_(vcvtnd_s64_f64) */ \ /*_(vcvtnd_u64_f64) */ \ /*_(vcvtmd_s64_f64) */ \