minor fixes for big endian altivec/vsx

This commit is contained in:
Konstantinos Margaritis 2016-07-10 07:05:10 -03:00
parent be107e387b
commit 9f7caa7e7d
3 changed files with 12 additions and 7 deletions

View File

@ -53,8 +53,10 @@ template<> struct packet_traits<std::complex<float> > : default_packet_traits
HasAbs2 = 0, HasAbs2 = 0,
HasMin = 0, HasMin = 0,
HasMax = 0, HasMax = 0,
HasSetLinear = 0, #ifdef __VSX__
HasBlend = 1 HasBlend = 1,
#endif
HasSetLinear = 0
}; };
}; };
@ -260,11 +262,13 @@ EIGEN_STRONG_INLINE void ptranspose(PacketBlock<Packet2cf,2>& kernel)
kernel.packet[0].v = tmp; kernel.packet[0].v = tmp;
} }
#ifdef __VSX__
template<> EIGEN_STRONG_INLINE Packet2cf pblend(const Selector<2>& ifPacket, const Packet2cf& thenPacket, const Packet2cf& elsePacket) { template<> EIGEN_STRONG_INLINE Packet2cf pblend(const Selector<2>& ifPacket, const Packet2cf& thenPacket, const Packet2cf& elsePacket) {
Packet2cf result; Packet2cf result;
result.v = reinterpret_cast<Packet4f>(pblend<Packet2d>(ifPacket, reinterpret_cast<Packet2d>(thenPacket.v), reinterpret_cast<Packet2d>(elsePacket.v))); result.v = reinterpret_cast<Packet4f>(pblend<Packet2d>(ifPacket, reinterpret_cast<Packet2d>(thenPacket.v), reinterpret_cast<Packet2d>(elsePacket.v)));
return result; return result;
} }
#endif
//---------- double ---------- //---------- double ----------
#ifdef __VSX__ #ifdef __VSX__

View File

@ -159,9 +159,9 @@ Packet4f pexp<Packet4f>(const Packet4f& _x)
Packet4i emm0; Packet4i emm0;
// clamp x // clamp x
x = vec_max(vec_min(x, p4f_exp_hi), p4f_exp_lo); x = pmax(pmin(x, p4f_exp_hi), p4f_exp_lo);
/* express exp(x) as exp(g + n*log(2)) */ // express exp(x) as exp(g + n*log(2))
fx = pmadd(x, p4f_cephes_LOG2EF, p4f_half); fx = pmadd(x, p4f_cephes_LOG2EF, p4f_half);
fx = pfloor(fx); fx = pfloor(fx);

View File

@ -152,13 +152,14 @@ template<> struct packet_traits<float> : default_packet_traits
HasExp = 1, HasExp = 1,
#ifdef __VSX__ #ifdef __VSX__
HasSqrt = 1, HasSqrt = 1,
#else
HasSqrt = 0,
#endif
#if !EIGEN_COMP_CLANG #if !EIGEN_COMP_CLANG
HasRsqrt = 1, HasRsqrt = 1,
#else #else
HasRsqrt = 0, HasRsqrt = 0,
#endif
#else
HasSqrt = 0,
HasRsqrt = 0,
#endif #endif
HasRound = 1, HasRound = 1,
HasFloor = 1, HasFloor = 1,