Skip to content

Commit

Permalink
Merge pull request numpy#315 from howjmay/vaddd
Browse files Browse the repository at this point in the history
feat: Add vaddd_[s64|u64]
  • Loading branch information
howjmay committed Mar 29, 2024
2 parents 8d8af05 + af776f4 commit 0cbaf72
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
4 changes: 2 additions & 2 deletions neon2rvv.h
Expand Up @@ -214,9 +214,9 @@ FORCE_INLINE float64x1_t vadd_f64(float64x1_t a, float64x1_t b) { return __riscv

FORCE_INLINE float64x2_t vaddq_f64(float64x2_t a, float64x2_t b) { return __riscv_vfadd_vv_f64m1(a, b, 2); }

// FORCE_INLINE int64_t vaddd_s64(int64_t a, int64_t b);
FORCE_INLINE int64_t vaddd_s64(int64_t a, int64_t b) { return a + b; }

// FORCE_INLINE uint64_t vaddd_u64(uint64_t a, uint64_t b);
FORCE_INLINE uint64_t vaddd_u64(uint64_t a, uint64_t b) { return a + b; }

FORCE_INLINE uint8x16_t vaddq_u8(uint8x16_t a, uint8x16_t b) { return __riscv_vadd_vv_u8m1(a, b, 16); }

Expand Down
26 changes: 24 additions & 2 deletions tests/impl.cpp
Expand Up @@ -545,9 +545,31 @@ result_t test_vaddq_f64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {
#endif // ENABLE_TEST_ALL
}

result_t test_vaddd_s64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; }
result_t test_vaddd_s64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {
#ifdef ENABLE_TEST_ALL
const int64_t *_a = (int64_t *)impl.test_cases_int_pointer1;
const int64_t *_b = (int64_t *)impl.test_cases_int_pointer2;
int64_t d0 = _a[0] + _b[0];

int64_t c = vaddd_s64(_a[0], _b[0]);
return c == d0 ? TEST_SUCCESS : TEST_FAIL;
#else
return TEST_UNIMPL;
#endif // ENABLE_TEST_ALL
}

result_t test_vaddd_u64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; }
result_t test_vaddd_u64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {
#ifdef ENABLE_TEST_ALL
const uint64_t *_a = (uint64_t *)impl.test_cases_int_pointer1;
const uint64_t *_b = (uint64_t *)impl.test_cases_int_pointer2;
uint64_t d0 = _a[0] + _b[0];

uint64_t c = vaddd_u64(_a[0], _b[0]);
return c == d0 ? TEST_SUCCESS : TEST_FAIL;
#else
return TEST_UNIMPL;
#endif // ENABLE_TEST_ALL
}

result_t test_vaddq_u8(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {
#ifdef ENABLE_TEST_ALL
Expand Down
4 changes: 2 additions & 2 deletions tests/impl.h
Expand Up @@ -22,8 +22,8 @@
_(vaddq_f32) \
_(vadd_f64) \
_(vaddq_f64) \
/*_(vaddd_s64) */ \
/*_(vaddd_u64) */ \
_(vaddd_s64) \
_(vaddd_u64) \
_(vaddq_u8) \
_(vaddq_u16) \
_(vaddq_u32) \
Expand Down

0 comments on commit 0cbaf72

Please sign in to comment.