Skip to content

Commit

Permalink
feat: Add vaddl_s8
Browse files Browse the repository at this point in the history
  • Loading branch information
howjmay committed Oct 17, 2023
1 parent 741651f commit 29e2d13
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 3 additions & 1 deletion neon2rvv.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ FORCE_INLINE uint32x4_t vaddq_u32(uint32x4_t __a, uint32x4_t __b) { return __ris

FORCE_INLINE uint64x2_t vaddq_u64(uint64x2_t __a, uint64x2_t __b) { return __riscv_vadd_vv_u64m1(__a, __b, 2); }

// FORCE_INLINE int16x8_t vaddl_s8(int8x8_t __a, int8x8_t __b);
FORCE_INLINE int16x8_t vaddl_s8(int8x8_t __a, int8x8_t __b) {
return __riscv_vget_v_i16m2_i16m1(__riscv_vwadd_vv_i16m2(__a, __b, 8), 0);
}

// FORCE_INLINE int32x4_t vaddl_s16(int16x4_t __a, int16x4_t __b);

Expand Down
15 changes: 14 additions & 1 deletion tests/impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,20 @@ result_t test_vaddq_u64(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {
return validate_uint64(c, d0, d1);
}

result_t test_vaddl_s8(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; }
result_t test_vaddl_s8(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) {
const int8_t *_a = (int8_t *)impl.test_cases_int_pointer1;
const int8_t *_b = (int8_t *)impl.test_cases_int_pointer1;
int16_t _c[8];

for (int i = 0; i < 8; i++) {
_c[i] = (int16_t)(_a[i] + _b[i]);
}

int8x8_t a = vld1_s8(_a);
int8x8_t b = vld1_s8(_b);
int16x8_t c = vaddl_s8(a, b);
return validate_int16(c, _c[0], _c[1], _c[2], _c[3], _c[4], _c[5], _c[6], _c[7]);
}

result_t test_vaddl_s16(const NEON2RVV_TEST_IMPL &impl, uint32_t iter) { return TEST_UNIMPL; }

Expand Down

0 comments on commit 29e2d13

Please sign in to comment.