From deb93ed1bf359ac99923e3a2b90a2920b1101290 Mon Sep 17 00:00:00 2001 From: Everton Constantino Date: Wed, 18 Mar 2020 12:27:39 -0300 Subject: [PATCH] Adhere to recommended load/store intrinsics for pp64le --- Eigen/src/Core/arch/AltiVec/PacketMath.h | 29 ++++++++++++++++++------ 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/Eigen/src/Core/arch/AltiVec/PacketMath.h b/Eigen/src/Core/arch/AltiVec/PacketMath.h index ea99523e6..4778a7096 100755 --- a/Eigen/src/Core/arch/AltiVec/PacketMath.h +++ b/Eigen/src/Core/arch/AltiVec/PacketMath.h @@ -68,7 +68,6 @@ typedef __vector unsigned char Packet16uc; #define DST_CHAN 1 #define DST_CTRL(size, count, stride) (((size) << 24) | ((count) << 16) | (stride)) - // These constants are endian-agnostic static _EIGEN_DECLARE_CONST_FAST_Packet4f(ZERO, 0); //{ 0.0, 0.0, 0.0, 0.0} static _EIGEN_DECLARE_CONST_FAST_Packet4i(ZERO, 0); //{ 0, 0, 0, 0,} @@ -251,7 +250,11 @@ template<> EIGEN_STRONG_INLINE Packet4f pload(const float* from) // ignoring these warnings for now. EIGEN_UNUSED_VARIABLE(from); EIGEN_DEBUG_ALIGNED_LOAD +#ifdef __VSX__ + return vec_xl(0, from); +#else return vec_ld(0, from); +#endif } template<> EIGEN_STRONG_INLINE Packet4i pload(const int* from) @@ -260,7 +263,11 @@ template<> EIGEN_STRONG_INLINE Packet4i pload(const int* from) // ignoring these warnings for now. EIGEN_UNUSED_VARIABLE(from); EIGEN_DEBUG_ALIGNED_LOAD +#ifdef __VSX__ + return vec_xl(0, from); +#else return vec_ld(0, from); +#endif } template<> EIGEN_STRONG_INLINE void pstore(float* to, const Packet4f& from) @@ -269,7 +276,11 @@ template<> EIGEN_STRONG_INLINE void pstore(float* to, const Packet4f& f // ignoring these warnings for now. EIGEN_UNUSED_VARIABLE(to); EIGEN_DEBUG_ALIGNED_STORE +#ifdef __VSX__ + vec_xst(from, 0, to); +#else vec_st(from, 0, to); +#endif } template<> EIGEN_STRONG_INLINE void pstore(int* to, const Packet4i& from) @@ -278,7 +289,11 @@ template<> EIGEN_STRONG_INLINE void pstore(int* to, const Packet4i& f // ignoring these warnings for now. EIGEN_UNUSED_VARIABLE(to); EIGEN_DEBUG_ALIGNED_STORE +#ifdef __VSX__ + vec_xst(from, 0, to); +#else vec_st(from, 0, to); +#endif } template<> EIGEN_STRONG_INLINE Packet4f pset1(const float& from) { @@ -489,12 +504,12 @@ template<> EIGEN_STRONG_INLINE Packet4i ploadu(const int* from) template<> EIGEN_STRONG_INLINE Packet4i ploadu(const int* from) { EIGEN_DEBUG_UNALIGNED_LOAD - return vec_vsx_ld(0, from); + return vec_xl(0, from); } template<> EIGEN_STRONG_INLINE Packet4f ploadu(const float* from) { EIGEN_DEBUG_UNALIGNED_LOAD - return vec_vsx_ld(0, from); + return vec_xl(0, from); } #endif @@ -555,12 +570,12 @@ template<> EIGEN_STRONG_INLINE void pstoreu(int* to, const Packet4i& f template<> EIGEN_STRONG_INLINE void pstoreu(int* to, const Packet4i& from) { EIGEN_DEBUG_UNALIGNED_STORE - vec_vsx_st(from, 0, to); + vec_xst(from, 0, to); } template<> EIGEN_STRONG_INLINE void pstoreu(float* to, const Packet4f& from) { EIGEN_DEBUG_UNALIGNED_STORE - vec_vsx_st(from, 0, to); + vec_xst(from, 0, to); } #endif @@ -1049,7 +1064,7 @@ template<> EIGEN_STRONG_INLINE Packet2d pfloor(const Packet2d& a) { re template<> EIGEN_STRONG_INLINE Packet2d ploadu(const double* from) { EIGEN_DEBUG_UNALIGNED_LOAD - return vec_vsx_ld(0, from); + return vec_xl(0, from); } template<> EIGEN_STRONG_INLINE Packet2d ploaddup(const double* from) @@ -1063,7 +1078,7 @@ template<> EIGEN_STRONG_INLINE Packet2d ploaddup(const double* from) template<> EIGEN_STRONG_INLINE void pstoreu(double* to, const Packet2d& from) { EIGEN_DEBUG_UNALIGNED_STORE - vec_vsx_st(from, 0, to); + vec_xst(from, 0, to); } template<> EIGEN_STRONG_INLINE void prefetch(const double* addr) { EIGEN_PPC_PREFETCH(addr); }