From 6dcd373b9d518c688b16800d9d0d7a88cb5f3dc2 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Fri, 9 Jul 2010 18:51:17 -0400 Subject: [PATCH] let ei_pset1 use _mm_loaddup_pd. Not a significant speed improvement, but also not a speed regression, and replaces 3 instructions by 1 single instruction. --- Eigen/src/Core/arch/SSE/PacketMath.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Eigen/src/Core/arch/SSE/PacketMath.h b/Eigen/src/Core/arch/SSE/PacketMath.h index a5d527271..dc28bdb56 100644 --- a/Eigen/src/Core/arch/SSE/PacketMath.h +++ b/Eigen/src/Core/arch/SSE/PacketMath.h @@ -109,8 +109,12 @@ template<> EIGEN_STRONG_INLINE Packet4f ei_pset1(const float& from) { return ei_vec4f_swizzle1(res,0,0,0,0); } template<> EIGEN_STRONG_INLINE Packet2d ei_pset1(const double& from) { +#ifdef EIGEN_VECTORIZE_SSE3 + return _mm_loaddup_pd(&from); +#else Packet2d res = _mm_set_sd(from); return ei_vec2d_swizzle1(res, 0, 0); +#endif } #else template<> EIGEN_STRONG_INLINE Packet4f ei_pset1(const float& from) { return _mm_set1_ps(from); }