aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/arch/SSE
diff options
context:
space:
mode:
authorGravatar Guoqiang QI <425418567@qq.com>2020-09-21 15:49:00 +0000
committerGravatar Rasmus Munk Larsen <rmlarsen@google.com>2020-09-21 15:49:00 +0000
commit821702e77154ead54ebf2a30f8e76481c12f7d44 (patch)
treee7729d213bf2079793086ae4c496eeb05bf0284c /Eigen/src/Core/arch/SSE
parent493a7c773c6aa3d170349177f8a245e67e493159 (diff)
Fix the #issue1997 and #issue1991 bug triggered by unsupport a[index](type a: __i28d) ops with MSVC compiler
Diffstat (limited to 'Eigen/src/Core/arch/SSE')
-rw-r--r--Eigen/src/Core/arch/SSE/TypeCasting.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/Eigen/src/Core/arch/SSE/TypeCasting.h b/Eigen/src/Core/arch/SSE/TypeCasting.h
index e75df2bfa..1f01d3c28 100644
--- a/Eigen/src/Core/arch/SSE/TypeCasting.h
+++ b/Eigen/src/Core/arch/SSE/TypeCasting.h
@@ -70,7 +70,16 @@ template<> EIGEN_STRONG_INLINE Packet2d pcast<Packet4f, Packet2d>(const Packet4f
}
template<> EIGEN_STRONG_INLINE Packet2l pcast<Packet2d, Packet2l>(const Packet2d& a) {
+ // using a[1]/a[0] to get high/low 64 bit from __m128d is faster than _mm_cvtsd_f64() ,but
+ // it will trigger the bug report at https://gitlab.com/libeigen/eigen/-/issues/1997 since the
+ // a[index] ops was not supported by MSVC compiler(supported by gcc).
+#if EIGEN_COMP_MSVC
+ return _mm_set_epi64x(int64_t(_mm_cvtsd_f64(_mm_unpackhi_pd(a,a))), int64_t(_mm_cvtsd_f64(a)));
+#elif ((defined EIGEN_VECTORIZE_AVX) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_MINGW) && (__GXX_ABI_VERSION < 1004)) || EIGEN_OS_QNX
+ return _mm_set_epi64x(int64_t(a.m_val[1]), int64_t(a.m_val[0]));
+#else
return _mm_set_epi64x(int64_t(a[1]), int64_t(a[0]));
+#endif
}
template <>