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 vcvt[q|d]_f64_[s64|u64] #497

Merged
merged 1 commit into from
Jul 31, 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
12 changes: 6 additions & 6 deletions neon2rvv.h
Original file line number Diff line number Diff line change
Expand Up @@ -8072,17 +8072,17 @@ FORCE_INLINE float32_t vcvts_f32_s32(int32_t a) { return (float32_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);
FORCE_INLINE float64x1_t vcvt_f64_s64(int64x1_t a) { return __riscv_vfcvt_f_x_v_f64m1(a, 1); }

// FORCE_INLINE float64x2_t vcvtq_f64_s64(int64x2_t a);
FORCE_INLINE float64x2_t vcvtq_f64_s64(int64x2_t a) { return __riscv_vfcvt_f_x_v_f64m1(a, 2); }

// FORCE_INLINE float64x1_t vcvt_f64_u64(uint64x1_t a);
FORCE_INLINE float64x1_t vcvt_f64_u64(uint64x1_t a) { return __riscv_vfcvt_f_xu_v_f64m1(a, 1); }

// FORCE_INLINE float64x2_t vcvtq_f64_u64(uint64x2_t a);
FORCE_INLINE float64x2_t vcvtq_f64_u64(uint64x2_t a) { return __riscv_vfcvt_f_xu_v_f64m1(a, 2); }

// FORCE_INLINE float64_t vcvtd_f64_s64(int64_t a);
FORCE_INLINE float64_t vcvtd_f64_s64(int64_t a) { return (float64_t)a; }

// FORCE_INLINE float64_t vcvtd_f64_u64(uint64_t a);
FORCE_INLINE float64_t vcvtd_f64_u64(uint64_t a) { return (float64_t)a; }

FORCE_INLINE uint32x4_t vcvtq_u32_f32(float32x4_t a) { return __riscv_vfcvt_rtz_xu_f_v_u32m1(a, 4); }

Expand Down
90 changes: 84 additions & 6 deletions tests/impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30038,17 +30038,95 @@ result_t test_vcvts_f32_u32(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {
#endif // ENABLE_TEST_ALL
}

result_t test_vcvt_f64_s64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; }
result_t test_vcvt_f64_s64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {
#ifdef ENABLE_TEST_ALL
const int64_t *_a = (const int64_t *)impl.test_cases_int_pointer1;
double _c[1];
for (int i = 0; i < 1; i++) {
_c[i] = _a[i];
}

int64x1_t a = vld1_s64(_a);
float64x1_t c = vcvt_f64_s64(a);
return validate_double(c, _c[0]);
#else
return TEST_UNIMPL;
#endif // ENABLE_TEST_ALL
}

result_t test_vcvtq_f64_s64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {
#ifdef ENABLE_TEST_ALL
const int64_t *_a = (const int64_t *)impl.test_cases_int_pointer1;
double _c[2];
for (int i = 0; i < 2; i++) {
_c[i] = _a[i];
}

int64x2_t a = vld1q_s64(_a);
float64x2_t c = vcvtq_f64_s64(a);
return validate_double(c, _c[0], _c[1]);
#else
return TEST_UNIMPL;
#endif // ENABLE_TEST_ALL
}

result_t test_vcvt_f64_u64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {
#ifdef ENABLE_TEST_ALL
const uint64_t *_a = (const uint64_t *)impl.test_cases_int_pointer1;
double _c[1];
for (int i = 0; i < 1; i++) {
_c[i] = _a[i];
}

uint64x1_t a = vld1_u64(_a);
float64x1_t c = vcvt_f64_u64(a);
return validate_double(c, _c[0]);
#else
return TEST_UNIMPL;
#endif // ENABLE_TEST_ALL
}

result_t test_vcvtq_f64_s64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; }
result_t test_vcvtq_f64_u64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {
#ifdef ENABLE_TEST_ALL
const uint64_t *_a = (const uint64_t *)impl.test_cases_int_pointer1;
double _c[2];
for (int i = 0; i < 2; i++) {
_c[i] = _a[i];
}

result_t test_vcvt_f64_u64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; }
uint64x2_t a = vld1q_u64(_a);
float64x2_t c = vcvtq_f64_u64(a);
return validate_double(c, _c[0], _c[1]);
#else
return TEST_UNIMPL;
#endif // ENABLE_TEST_ALL
}

result_t test_vcvtq_f64_u64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; }
result_t test_vcvtd_f64_s64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {
#ifdef ENABLE_TEST_ALL
const int64_t *_a = (const int64_t *)impl.test_cases_int_pointer1;
double _c, c;
_c = _a[0];

result_t test_vcvtd_f64_s64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; }
c = vcvtd_f64_s64(_a[0]);
return c == _c ? TEST_SUCCESS : TEST_FAIL;
#else
return TEST_UNIMPL;
#endif // ENABLE_TEST_ALL
}

result_t test_vcvtd_f64_u64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; }
result_t test_vcvtd_f64_u64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {
#ifdef ENABLE_TEST_ALL
const uint64_t *_a = (const uint64_t *)impl.test_cases_int_pointer1;
double _c, c;
_c = _a[0];

c = vcvtd_f64_u64(_a[0]);
return c == _c ? TEST_SUCCESS : TEST_FAIL;
#else
return TEST_UNIMPL;
#endif // ENABLE_TEST_ALL
}

result_t test_vcvtq_u32_f32(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {
#ifdef ENABLE_TEST_ALL
Expand Down
12 changes: 6 additions & 6 deletions tests/impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1661,12 +1661,12 @@
_(vcvtq_f32_u32) \
_(vcvts_f32_s32) \
_(vcvts_f32_u32) \
/*_(vcvt_f64_s64) */ \
/*_(vcvtq_f64_s64) */ \
/*_(vcvt_f64_u64) */ \
/*_(vcvtq_f64_u64) */ \
/*_(vcvtd_f64_s64) */ \
/*_(vcvtd_f64_u64) */ \
_(vcvt_f64_s64) \
_(vcvtq_f64_s64) \
_(vcvt_f64_u64) \
_(vcvtq_f64_u64) \
_(vcvtd_f64_s64) \
_(vcvtd_f64_u64) \
_(vcvtq_u32_f32) \
/*_(vcvtn_s32_f32) */ \
/*_(vcvtnq_s32_f32) */ \
Expand Down
Loading