diff options
author | Gael Guennebaud <g.gael@free.fr> | 2011-02-23 18:20:55 +0300 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2011-02-23 18:20:55 +0300 |
commit | 955c099eb58347c8d333cbd3ae274511f8050f54 (patch) | |
tree | 4521559b12095eba8611ac0339ad16afbbbe789e /Eigen | |
parent | a00aaf7f7ecf5f533c37dcf73dc034df10381754 (diff) |
implement ploaddup for altivec and add respective unit test
Diffstat (limited to 'Eigen')
-rw-r--r-- | Eigen/src/Core/arch/AltiVec/Complex.h | 5 | ||||
-rw-r--r-- | Eigen/src/Core/arch/AltiVec/PacketMath.h | 14 |
2 files changed, 19 insertions, 0 deletions
diff --git a/Eigen/src/Core/arch/AltiVec/Complex.h b/Eigen/src/Core/arch/AltiVec/Complex.h index 53fb1ba31..fd118ccff 100644 --- a/Eigen/src/Core/arch/AltiVec/Complex.h +++ b/Eigen/src/Core/arch/AltiVec/Complex.h @@ -112,6 +112,11 @@ template<> EIGEN_STRONG_INLINE Packet2cf pandnot<Packet2cf>(const Packet2cf& a, template<> EIGEN_STRONG_INLINE Packet2cf pload <Packet2cf>(const std::complex<float>* from) { EIGEN_DEBUG_ALIGNED_LOAD return Packet2cf(pload<Packet4f>((const float*)from)); } template<> EIGEN_STRONG_INLINE Packet2cf ploadu<Packet2cf>(const std::complex<float>* from) { EIGEN_DEBUG_UNALIGNED_LOAD return Packet2cf(ploadu<Packet4f>((const float*)from)); } +template<> EIGEN_STRONG_INLINE Packet2cf ploaddup<Packet2cf>(const std::complex<float>* from) +{ + return pset1<Packet2cf>(*from); +} + template<> EIGEN_STRONG_INLINE void pstore <std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { EIGEN_DEBUG_ALIGNED_STORE pstore((float*)to, from.v); } template<> EIGEN_STRONG_INLINE void pstoreu<std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu((float*)to, from.v); } diff --git a/Eigen/src/Core/arch/AltiVec/PacketMath.h b/Eigen/src/Core/arch/AltiVec/PacketMath.h index 96cb54283..efb4f62d1 100644 --- a/Eigen/src/Core/arch/AltiVec/PacketMath.h +++ b/Eigen/src/Core/arch/AltiVec/PacketMath.h @@ -73,6 +73,7 @@ static Packet4f p4f_COUNTDOWN = { 3.0, 2.0, 1.0, 0.0 }; static Packet4i p4i_COUNTDOWN = { 3, 2, 1, 0 }; static Packet16uc p16uc_REVERSE = {12,13,14,15, 8,9,10,11, 4,5,6,7, 0,1,2,3}; static Packet16uc p16uc_FORWARD = vec_lvsl(0, (float*)0); +static Packet16uc p16uc_DUPLICATE = {0,1,2,3, 0,1,2,3, 4,5,6,7, 4,5,6,7}; static _EIGEN_DECLARE_CONST_FAST_Packet4f(ZERO, 0); static _EIGEN_DECLARE_CONST_FAST_Packet4i(ZERO, 0); @@ -292,6 +293,19 @@ template<> EIGEN_STRONG_INLINE Packet4i ploadu<Packet4i>(const int* from) return (Packet4i) vec_perm(MSQ, LSQ, mask); // align the data } +template<> EIGEN_STRONG_INLINE Packet4f ploaddup<Packet4f>(const float* from) +{ + Packet16uc tmp; + tmp = vec_ld(0, (unsigned char *)from); // most significant quadword + return (Packet4f) vec_perm(tmp, tmp, p16uc_DUPLICATE); +} +template<> EIGEN_STRONG_INLINE Packet4i ploaddup<Packet4i>(const int* from) +{ + Packet16uc tmp; + tmp = vec_ld(0, (unsigned char *)from); // most significant quadword + return (Packet4i) vec_perm(tmp, tmp, p16uc_DUPLICATE); +} + template<> EIGEN_STRONG_INLINE void pstore<float>(float* to, const Packet4f& from) { EIGEN_DEBUG_ALIGNED_STORE vec_st(from, 0, to); } template<> EIGEN_STRONG_INLINE void pstore<int>(int* to, const Packet4i& from) { EIGEN_DEBUG_ALIGNED_STORE vec_st(from, 0, to); } |