Skip to content

Commit

Permalink
feat: Add _mm_setzero_[ps|pd|si128]
Browse files Browse the repository at this point in the history
  • Loading branch information
howjmay committed Jan 26, 2024
1 parent 9814a6c commit 1adda2c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
12 changes: 9 additions & 3 deletions sse2rvv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2483,11 +2483,17 @@ FORCE_INLINE __m128 _mm_setr_ps(float e3, float e2, float e1, float e0) {
return vreinterpretq_f32_m128(__riscv_vle32_v_f32m1(arr, 4));
}

// FORCE_INLINE __m128d _mm_setzero_pd (void) {}
FORCE_INLINE __m128d _mm_setzero_pd(void) {
return vreinterpretq_f32_m128d(__riscv_vfmv_v_f_f32m1(0, 4));
}

// FORCE_INLINE __m128 _mm_setzero_ps (void) {}
FORCE_INLINE __m128 _mm_setzero_ps(void) {
return vreinterpretq_f32_m128(__riscv_vfmv_v_f_f32m1(0, 4));
}

// FORCE_INLINE __m128i _mm_setzero_si128 () {}
FORCE_INLINE __m128i _mm_setzero_si128() {
return vreinterpretq_f32_m128i(__riscv_vfmv_v_f_f32m1(0, 4));
}

// FORCE_INLINE void _mm_sfence (void) {}

Expand Down
30 changes: 15 additions & 15 deletions tests/impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3167,12 +3167,12 @@ result_t test_mm_setr_ps(const SSE2RVV_TEST_IMPL &impl, uint32_t iter) {
}

result_t test_mm_setzero_ps(const SSE2RVV_TEST_IMPL &impl, uint32_t iter) {
// #ifdef ENABLE_TEST_ALL
// __m128 a = _mm_setzero_ps();
// return validate_float(a, 0, 0, 0, 0);
// #else
#ifdef ENABLE_TEST_ALL
__m128 a = _mm_setzero_ps();
return validate_float(a, 0, 0, 0, 0);
#else
return TEST_UNIMPL;
// #endif // ENABLE_TEST_ALL
#endif // ENABLE_TEST_ALL
}

result_t test_mm_sfence(const SSE2RVV_TEST_IMPL &impl, uint32_t iter) {
Expand Down Expand Up @@ -6761,21 +6761,21 @@ result_t test_mm_setr_pd(const SSE2RVV_TEST_IMPL &impl, uint32_t iter) {
}

result_t test_mm_setzero_pd(const SSE2RVV_TEST_IMPL &impl, uint32_t iter) {
// #ifdef ENABLE_TEST_ALL
// __m128d a = _mm_setzero_pd();
// return validate_double(a, 0, 0);
// #else
#ifdef ENABLE_TEST_ALL
__m128d a = _mm_setzero_pd();
return validate_double(a, 0, 0);
#else
return TEST_UNIMPL;
// #endif // ENABLE_TEST_ALL
#endif // ENABLE_TEST_ALL
}

result_t test_mm_setzero_si128(const SSE2RVV_TEST_IMPL &impl, uint32_t iter) {
// #ifdef ENABLE_TEST_ALL
// __m128i a = _mm_setzero_si128();
// return validate_int32(a, 0, 0, 0, 0);
// #else
#ifdef ENABLE_TEST_ALL
__m128i a = _mm_setzero_si128();
return validate_int32(a, 0, 0, 0, 0);
#else
return TEST_UNIMPL;
// #endif // ENABLE_TEST_ALL
#endif // ENABLE_TEST_ALL
}

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

0 comments on commit 1adda2c

Please sign in to comment.