avx: use simde_mm_dp_ps to implement simde_mm256_dp_ps
@@ -3531,36 +3531,13 @@ simde__m256i simde_mm256_insertf128_si256(simde__m256i a, simde__m128i b, int im
# define _mm256_insertf128_si256(a, b, imm8) simde_mm256_insertf128_si256(a, b, imm8)
#endif
-SIMDE__FUNCTION_ATTRIBUTES
-simde__m256
-simde_mm256_dp_ps (simde__m256 a, simde__m256 b, const int imm8) {
- simde__m256_private
- r_,
- a_ = simde__m256_to_private(a),
- b_ = simde__m256_to_private(b);
-
- simde_float32 sum1 = SIMDE_FLOAT32_C(0.0);
- simde_float32 sum2 = SIMDE_FLOAT32_C(0.0);
-
- SIMDE__VECTORIZE_REDUCTION(+:sum1)
- for (size_t i = 0 ; i < 4 ; i++) {
- sum1 += (imm8 & (16 << i)) ? (a_.f32[i + 4] * b_.f32[i + 4]) : SIMDE_FLOAT32_C(0.0);
- }
- SIMDE__VECTORIZE_REDUCTION(+:sum2)
- for (size_t i = 0 ; i < 4 ; i++) {
- sum2 += (imm8 & (16 << i)) ? (a_.f32[ i ] * b_.f32[ i ]) : SIMDE_FLOAT32_C(0.0);
- }
-
- SIMDE__VECTORIZE
- for (size_t i = 0 ; i < 4 ; i++) {
- r_.f32[i + 4] = (imm8 & (8 >> i)) ? sum1 : SIMDE_FLOAT32_C(0.0);
- r_.f32[ i ] = (imm8 & (8 >> i)) ? sum2 : SIMDE_FLOAT32_C(0.0);
- }
-
- return simde__m256_from_private(r_);
-}
#if defined(SIMDE_AVX_NATIVE)
# define simde_mm256_dp_ps(a, b, imm8) _mm256_dp_ps(a, b, imm8)
+#else
+# define simde_mm256_dp_ps(a, b, imm8) \
+ simde_mm256_set_m128( \
+ simde_mm_dp_ps(simde_mm256_extractf128_ps(a, 1), simde_mm256_extractf128_ps(b, 1), imm8), \
+ simde_mm_dp_ps(simde_mm256_extractf128_ps(a, 0), simde_mm256_extractf128_ps(b, 0), imm8))
#endif
#if defined(SIMDE_AVX_ENABLE_NATIVE_ALIASES)
# define _mm256_dp_ps(a, b, imm8) simde_mm256_dp_ps(a, b, imm8)
