Skip to content

Commit

Permalink
Merge pull request #50 from howjmay/movepi64
Browse files Browse the repository at this point in the history
feat: Add _mm_movepi64_[e]pi64
  • Loading branch information
howjmay authored Jan 20, 2024
2 parents 8552de4 + 44b48a9 commit 5f8e62c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 24 deletions.
10 changes: 8 additions & 2 deletions sse2rvv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2032,9 +2032,15 @@ FORCE_INLINE int _mm_movemask_ps(__m128 a) {
return (int)(__riscv_vmv_x_s_u8m1_u8(nonzeros) & 0xf);
}

// FORCE_INLINE __m64 _mm_movepi64_pi64 (__m128i a) {}
FORCE_INLINE __m64 _mm_movepi64_pi64(__m128i a) {
return vreinterpretq_i32_m64(vreinterpretq_m128i_i32(a));
}

// FORCE_INLINE __m128i _mm_movpi64_epi64 (__m64 a) {}
FORCE_INLINE __m128i _mm_movpi64_epi64(__m64 a) {
vint32m1_t _a = vreinterpretq_m128i_i32(a);
vint32m1_t zeros = __riscv_vmv_v_x_i32m1(0, 4);
return vreinterpretq_i32_m64(__riscv_vslideup_vx_i32m1(zeros, _a, 0, 2));
}

// FORCE_INLINE __m128i _mm_mpsadbw_epu8 (__m128i a, __m128i b, const int imm8)
// {}
Expand Down
44 changes: 22 additions & 22 deletions tests/impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6084,33 +6084,33 @@ result_t test_mm_movemask_pd(const SSE2RVV_TEST_IMPL &impl, uint32_t iter) {
}

result_t test_mm_movepi64_pi64(const SSE2RVV_TEST_IMPL &impl, uint32_t iter) {
// #ifdef ENABLE_TEST_ALL
// const int64_t *_a = (const int64_t *)impl.test_cases_int_pointer1;
//
// int64_t d0 = _a[0];
//
// __m128i a = load_m128i(_a);
// __m64 c = _mm_movepi64_pi64(a);
//
// return validate_int64(c, d0);
// #else
#ifdef ENABLE_TEST_ALL
const int64_t *_a = (const int64_t *)impl.test_cases_int_pointer1;

int64_t d0 = _a[0];

__m128i a = load_m128i(_a);
__m64 c = _mm_movepi64_pi64(a);

return validate_int64(c, d0);
#else
return TEST_UNIMPL;
// #endif // ENABLE_TEST_ALL
#endif // ENABLE_TEST_ALL
}

result_t test_mm_movpi64_epi64(const SSE2RVV_TEST_IMPL &impl, uint32_t iter) {
// #ifdef ENABLE_TEST_ALL
// const int64_t *_a = (const int64_t *)impl.test_cases_int_pointer1;
//
// int64_t d0 = _a[0];
//
// __m64 a = load_m64(_a);
// __m128i c = _mm_movpi64_epi64(a);
//
// return validate_int64(c, d0, 0);
// #else
#ifdef ENABLE_TEST_ALL
const int64_t *_a = (const int64_t *)impl.test_cases_int_pointer1;

int64_t d0 = _a[0];

__m64 a = load_m64(_a);
__m128i c = _mm_movpi64_epi64(a);

return validate_int64(c, d0, 0);
#else
return TEST_UNIMPL;
// #endif // ENABLE_TEST_ALL
#endif // ENABLE_TEST_ALL
}

result_t test_mm_mul_epu32(const SSE2RVV_TEST_IMPL &impl, uint32_t iter) {
Expand Down

0 comments on commit 5f8e62c

Please sign in to comment.