diff options
author | Gael Guennebaud <g.gael@free.fr> | 2009-02-10 18:06:05 +0000 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2009-02-10 18:06:05 +0000 |
commit | cbbc6d940bd6ddf7d96352b4b4e3033ff4e555fe (patch) | |
tree | c9e905f59b380bac934bf44dd635060cb1f2c264 /Eigen/src/Core/arch/SSE | |
parent | a0cc5fba0a3dc600e858720c9fcde3a9c13e740a (diff) |
* add ei_predux_mul internal function
* apply Ricard Marxer's prod() patch with fixes for the vectorized path
Diffstat (limited to 'Eigen/src/Core/arch/SSE')
-rw-r--r-- | Eigen/src/Core/arch/SSE/PacketMath.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Eigen/src/Core/arch/SSE/PacketMath.h b/Eigen/src/Core/arch/SSE/PacketMath.h index cce00ed7b..7bef79309 100644 --- a/Eigen/src/Core/arch/SSE/PacketMath.h +++ b/Eigen/src/Core/arch/SSE/PacketMath.h @@ -214,6 +214,23 @@ template<> EIGEN_STRONG_INLINE __m128i ei_preduxp<__m128i>(const __m128i* vecs) return _mm_add_epi32(tmp0, tmp2); } +// Other reduction functions: + +template<> EIGEN_STRONG_INLINE float ei_predux_mul<__m128>(const __m128& a) +{ + __m128 tmp = _mm_mul_ps(a, _mm_movehl_ps(a,a)); + return ei_pfirst(_mm_mul_ss(tmp, _mm_shuffle_ps(tmp,tmp, 1))); +} +template<> EIGEN_STRONG_INLINE double ei_predux_mul<__m128d>(const __m128d& a) +{ + return ei_pfirst(_mm_mul_sd(a, _mm_unpackhi_pd(a,a))); +} +template<> EIGEN_STRONG_INLINE int ei_predux_mul<__m128i>(const __m128i& a) +{ + __m128i tmp = ei_pmul(a, _mm_unpackhi_epi64(a,a)); + return ei_pfirst(tmp) * ei_pfirst(_mm_shuffle_epi32(tmp, 1)); +} + #if (defined __GNUC__) // template <> EIGEN_STRONG_INLINE __m128 ei_pmadd(const __m128& a, const __m128& b, const __m128& c) // { |