From 10d60b7304829c4745e6ae7fb4d43436feeab369 Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Mon, 4 Sep 2023 15:20:47 +0800 Subject: [PATCH] Fix eigen build (#56774) * Fix eigen build * Fix * Fix --- patches/eigen/Complex.h.patch | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/patches/eigen/Complex.h.patch b/patches/eigen/Complex.h.patch index 140e4ba8409..d005ea7f5d6 100644 --- a/patches/eigen/Complex.h.patch +++ b/patches/eigen/Complex.h.patch @@ -1,7 +1,7 @@ -diff --git a/Eigen/src/Core/arch/SSE/Complex.h b/Eigen/src/Core/arch/SSE/Complex.h -index f6f1b8c..2f4e7d1 100644 ---- a/Eigen/src/Core/arch/SSE/Complex.h -+++ b/Eigen/src/Core/arch/SSE/Complex.h +diff --git a/old/Complex.h b/new/Complex.h +index f6f1b8c..7558e8c 100644 +--- a/old/Complex.h ++++ b/new/Complex.h @@ -17,7 +17,7 @@ namespace internal { //---------- float ---------- struct Packet2cf @@ -11,3 +11,28 @@ index f6f1b8c..2f4e7d1 100644 EIGEN_STRONG_INLINE explicit Packet2cf(const __m128& a) : v(a) {} __m128 v; }; +@@ -113,19 +113,13 @@ template<> EIGEN_STRONG_INLINE Packet2cf ploadu(const std::complex EIGEN_STRONG_INLINE Packet2cf pset1(const std::complex& from) + { + Packet2cf res; +-#if EIGEN_GNUC_AT_MOST(4,2) +- // Workaround annoying "may be used uninitialized in this function" warning with gcc 4.2 +- res.v = _mm_loadl_pi(_mm_set1_ps(0.0f), reinterpret_cast(&from)); +-#elif EIGEN_GNUC_AT_LEAST(4,6) +- // Suppress annoying "may be used uninitialized in this function" warning with gcc >= 4.6 +- #pragma GCC diagnostic push +- #pragma GCC diagnostic ignored "-Wuninitialized" +- res.v = _mm_loadl_pi(res.v, (const __m64*)&from); +- #pragma GCC diagnostic pop ++#ifdef EIGEN_VECTORIZE_SSE3 ++ res.v = _mm_castpd_ps(_mm_loaddup_pd(reinterpret_cast(&from))); + #else +- res.v = _mm_loadl_pi(res.v, (const __m64*)&from); ++ res.v = _mm_castpd_ps(_mm_load_sd(reinterpret_cast(&from))); ++ res.v = _mm_movelh_ps(res.v, res.v); + #endif +- return Packet2cf(_mm_movelh_ps(res.v,res.v)); ++ return res; + } + + template<> EIGEN_STRONG_INLINE Packet2cf ploaddup(const std::complex* from) { return pset1(*from); } -- GitLab