mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-27 07:11:59 +08:00
Fix altivec and vsx builds
This commit is contained in:
parent
c0378fedd8
commit
88cd53774e
@ -237,12 +237,12 @@ template<> EIGEN_STRONG_INLINE Packet2cf pblend(const Selector<2>& ifPacket, con
|
|||||||
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
|
|
||||||
|
|
||||||
template<> EIGEN_STRONG_INLINE Packet2cf psqrt<Packet2cf>(const Packet2cf& a)
|
template<> EIGEN_STRONG_INLINE Packet2cf psqrt<Packet2cf>(const Packet2cf& a)
|
||||||
{
|
{
|
||||||
return psqrt_complex<Packet2cf>(a);
|
return psqrt_complex<Packet2cf>(a);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//---------- double ----------
|
//---------- double ----------
|
||||||
#ifdef EIGEN_VECTORIZE_VSX
|
#ifdef EIGEN_VECTORIZE_VSX
|
||||||
|
@ -40,7 +40,7 @@ Packet4f pcos<Packet4f>(const Packet4f& _x)
|
|||||||
return pcos_float(_x);
|
return pcos_float(_x);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __VSX__
|
#ifdef EIGEN_VECTORIZE_VSX
|
||||||
#ifndef EIGEN_COMP_CLANG
|
#ifndef EIGEN_COMP_CLANG
|
||||||
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
|
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
|
||||||
Packet4f prsqrt<Packet4f>(const Packet4f& x)
|
Packet4f prsqrt<Packet4f>(const Packet4f& x)
|
||||||
@ -48,8 +48,6 @@ Packet4f prsqrt<Packet4f>(const Packet4f& x)
|
|||||||
return vec_rsqrt(x);
|
return vec_rsqrt(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef EIGEN_VECTORIZE_VSX
|
|
||||||
#ifndef EIGEN_COMP_CLANG
|
|
||||||
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
|
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
|
||||||
Packet2d prsqrt<Packet2d>(const Packet2d& x)
|
Packet2d prsqrt<Packet2d>(const Packet2d& x)
|
||||||
{
|
{
|
||||||
@ -85,30 +83,8 @@ Packet2d prsqrt<Packet2d>(const Packet2d& x)
|
|||||||
// vec_rsqrt returns different results from the generic version
|
// vec_rsqrt returns different results from the generic version
|
||||||
// return vec_rsqrt(x);
|
// return vec_rsqrt(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
|
||||||
Packet2d patan<Packet2d>(const Packet2d& _x)
|
|
||||||
{
|
|
||||||
return patan_double(_x);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
|
||||||
Packet4f prsqrt<Packet4f>(const Packet4f& x)
|
|
||||||
{
|
|
||||||
return pset1<Packet4f>(1.0f) / psqrt<Packet4f>(x);
|
|
||||||
// vec_rsqrt returns different results from the generic version
|
|
||||||
// return vec_rsqrt(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
|
||||||
Packet2d prsqrt<Packet2d>(const Packet2d& x)
|
|
||||||
{
|
|
||||||
return pset1<Packet2d>(1.0) / psqrt<Packet2d>(x);
|
|
||||||
// vec_rsqrt returns different results from the generic version
|
|
||||||
// return vec_rsqrt(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||||
Packet2d pexp<Packet2d>(const Packet2d& _x)
|
Packet2d pexp<Packet2d>(const Packet2d& _x)
|
||||||
{
|
{
|
||||||
|
@ -846,12 +846,6 @@ template<> EIGEN_STRONG_INLINE Packet4i pmadd(const Packet4i& a, const Packet4i&
|
|||||||
template<> EIGEN_STRONG_INLINE Packet8s pmadd(const Packet8s& a, const Packet8s& b, const Packet8s& c) { return vec_madd(a,b,c); }
|
template<> EIGEN_STRONG_INLINE Packet8s pmadd(const Packet8s& a, const Packet8s& b, const Packet8s& c) { return vec_madd(a,b,c); }
|
||||||
template<> EIGEN_STRONG_INLINE Packet8us pmadd(const Packet8us& a, const Packet8us& b, const Packet8us& c) { return vec_madd(a,b,c); }
|
template<> EIGEN_STRONG_INLINE Packet8us pmadd(const Packet8us& a, const Packet8us& b, const Packet8us& c) { return vec_madd(a,b,c); }
|
||||||
|
|
||||||
#ifdef EIGEN_VECTORIZE_VSX
|
|
||||||
template<> EIGEN_STRONG_INLINE Packet4f pmsub(const Packet4f& a, const Packet4f& b, const Packet4f& c) { return vec_msub(a,b,c); }
|
|
||||||
template<> EIGEN_STRONG_INLINE Packet4f pnmadd(const Packet4f& a, const Packet4f& b, const Packet4f& c) { return vec_nmsub(a,b,c); }
|
|
||||||
template<> EIGEN_STRONG_INLINE Packet4f pnmsub(const Packet4f& a, const Packet4f& b, const Packet4f& c) { return vec_nmadd(a,b,c); }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template<> EIGEN_STRONG_INLINE Packet4f pmin<Packet4f>(const Packet4f& a, const Packet4f& b)
|
template<> EIGEN_STRONG_INLINE Packet4f pmin<Packet4f>(const Packet4f& a, const Packet4f& b)
|
||||||
{
|
{
|
||||||
#ifdef EIGEN_VECTORIZE_VSX
|
#ifdef EIGEN_VECTORIZE_VSX
|
||||||
@ -988,18 +982,15 @@ template<> EIGEN_STRONG_INLINE Packet4f print<Packet4f>(const Packet4f& a)
|
|||||||
|
|
||||||
template<typename Packet> EIGEN_STRONG_INLINE Packet ploadu_common(const __UNPACK_TYPE__(Packet)* from)
|
template<typename Packet> EIGEN_STRONG_INLINE Packet ploadu_common(const __UNPACK_TYPE__(Packet)* from)
|
||||||
{
|
{
|
||||||
EIGEN_DEBUG_ALIGNED_LOAD
|
EIGEN_DEBUG_UNALIGNED_LOAD
|
||||||
#ifdef _BIG_ENDIAN
|
#ifdef EIGEN_VECTORIZE_VSX
|
||||||
Packet16uc MSQ, LSQ;
|
return vec_xl(0, const_cast<__UNPACK_TYPE__(Packet)*>(from));
|
||||||
Packet16uc mask;
|
#else
|
||||||
MSQ = vec_ld(0, (unsigned char *)from); // most significant quadword
|
Packet16uc mask = vec_lvsl(0, from); // create the permute mask
|
||||||
LSQ = vec_ld(15, (unsigned char *)from); // least significant quadword
|
Packet16uc MSQ = vec_ld(0, (unsigned char *)from); // most significant quadword
|
||||||
mask = vec_lvsl(0, from); // create the permute mask
|
Packet16uc LSQ = vec_ld(15, (unsigned char *)from); // least significant quadword
|
||||||
//TODO: Add static_cast here
|
//TODO: Add static_cast here
|
||||||
return (Packet) vec_perm(MSQ, LSQ, mask); // align the data
|
return (Packet) vec_perm(MSQ, LSQ, mask); // align the data
|
||||||
#else
|
|
||||||
EIGEN_DEBUG_UNALIGNED_LOAD
|
|
||||||
return vec_xl(0, const_cast<__UNPACK_TYPE__(Packet)*>(from));
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1104,7 +1095,9 @@ template<> EIGEN_STRONG_INLINE Packet16uc ploaddup<Packet16uc>(const unsigned ch
|
|||||||
template<typename Packet> EIGEN_STRONG_INLINE void pstoreu_common(__UNPACK_TYPE__(Packet)* to, const Packet& from)
|
template<typename Packet> EIGEN_STRONG_INLINE void pstoreu_common(__UNPACK_TYPE__(Packet)* to, const Packet& from)
|
||||||
{
|
{
|
||||||
EIGEN_DEBUG_UNALIGNED_STORE
|
EIGEN_DEBUG_UNALIGNED_STORE
|
||||||
#ifdef _BIG_ENDIAN
|
#ifdef EIGEN_VECTORIZE_VSX
|
||||||
|
vec_xst(from, 0, to);
|
||||||
|
#else
|
||||||
// Taken from http://developer.apple.com/hardwaredrivers/ve/alignment.html
|
// Taken from http://developer.apple.com/hardwaredrivers/ve/alignment.html
|
||||||
// Warning: not thread safe!
|
// Warning: not thread safe!
|
||||||
Packet16uc MSQ, LSQ, edges;
|
Packet16uc MSQ, LSQ, edges;
|
||||||
@ -1119,8 +1112,6 @@ template<typename Packet> EIGEN_STRONG_INLINE void pstoreu_common(__UNPACK_TYPE_
|
|||||||
LSQ = vec_perm((Packet16uc)from,edges,align); // misalign the data (LSQ)
|
LSQ = vec_perm((Packet16uc)from,edges,align); // misalign the data (LSQ)
|
||||||
vec_st( LSQ, 15, (unsigned char *)to ); // Store the LSQ part first
|
vec_st( LSQ, 15, (unsigned char *)to ); // Store the LSQ part first
|
||||||
vec_st( MSQ, 0, (unsigned char *)to ); // Store the MSQ part second
|
vec_st( MSQ, 0, (unsigned char *)to ); // Store the MSQ part second
|
||||||
#else
|
|
||||||
vec_xst(from, 0, to);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
template<> EIGEN_STRONG_INLINE void pstoreu<float>(float* to, const Packet4f& from)
|
template<> EIGEN_STRONG_INLINE void pstoreu<float>(float* to, const Packet4f& from)
|
||||||
@ -1379,10 +1370,6 @@ template<> EIGEN_STRONG_INLINE Packet8bf psub<Packet8bf>(const Packet8bf& a, con
|
|||||||
BF16_TO_F32_BINARY_OP_WRAPPER(psub<Packet4f>, a, b);
|
BF16_TO_F32_BINARY_OP_WRAPPER(psub<Packet4f>, a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<> EIGEN_STRONG_INLINE Packet8bf pexp<Packet8bf> (const Packet8bf& a){
|
|
||||||
BF16_TO_F32_UNARY_OP_WRAPPER(pexp_float, a);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<> EIGEN_STRONG_INLINE Packet4f pldexp<Packet4f>(const Packet4f& a, const Packet4f& exponent) {
|
template<> EIGEN_STRONG_INLINE Packet4f pldexp<Packet4f>(const Packet4f& a, const Packet4f& exponent) {
|
||||||
return pldexp_generic(a,exponent);
|
return pldexp_generic(a,exponent);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user