From 4d1d14e069c53866a3a08fba155920ff9ccd29a6 Mon Sep 17 00:00:00 2001 From: Chip Kerchner Date: Wed, 8 May 2024 22:39:27 +0000 Subject: [PATCH] Change predux on PowerPC for Packet4i to NOT saturate the sum of the elements (like other architectures). --- Eigen/src/Core/arch/AltiVec/PacketMath.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Eigen/src/Core/arch/AltiVec/PacketMath.h b/Eigen/src/Core/arch/AltiVec/PacketMath.h index 4c92e05b0..6c472cdf1 100644 --- a/Eigen/src/Core/arch/AltiVec/PacketMath.h +++ b/Eigen/src/Core/arch/AltiVec/PacketMath.h @@ -2437,13 +2437,11 @@ EIGEN_STRONG_INLINE float predux(const Packet4f& a) { template <> EIGEN_STRONG_INLINE int predux(const Packet4i& a) { - Packet4i sum; - sum = vec_sums(a, p4i_ZERO); -#ifdef _BIG_ENDIAN - sum = vec_sld(sum, p4i_ZERO, 12); -#else - sum = vec_sld(p4i_ZERO, sum, 4); -#endif + Packet4i b, sum; + b = vec_sld(a, a, 8); + sum = a + b; + b = vec_sld(sum, sum, 4); + sum += b; return pfirst(sum); }