diff options
author | Rasmus Munk Larsen <rmlarsen@google.com> | 2021-06-10 19:18:50 -0700 |
---|---|---|
committer | Rasmus Munk Larsen <rmlarsen@google.com> | 2021-06-11 02:35:53 +0000 |
commit | fc87e2cbaa65e7e93a2c695ce5a9dc048a64a985 (patch) | |
tree | 5660a36af91911a5f9e1b53c3de2b2622ebcce74 /Eigen/src/Core/arch/NEON/PacketMath.h | |
parent | f64b2954c711b7846ae6ae228c5f14bd8dd56ec4 (diff) |
Use bit_cast to create -0.0 for floating point types to avoid compiler optimization changing sign with --ffast-math enabled.
Diffstat (limited to 'Eigen/src/Core/arch/NEON/PacketMath.h')
-rw-r--r-- | Eigen/src/Core/arch/NEON/PacketMath.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Eigen/src/Core/arch/NEON/PacketMath.h b/Eigen/src/Core/arch/NEON/PacketMath.h index 73a35c570..e1efe9bcb 100644 --- a/Eigen/src/Core/arch/NEON/PacketMath.h +++ b/Eigen/src/Core/arch/NEON/PacketMath.h @@ -866,12 +866,12 @@ template<> EIGEN_STRONG_INLINE Packet2ul psub<Packet2ul>(const Packet2ul& a, con template<> EIGEN_STRONG_INLINE Packet2f pxor<Packet2f>(const Packet2f& a, const Packet2f& b); template<> EIGEN_STRONG_INLINE Packet2f paddsub<Packet2f>(const Packet2f& a, const Packet2f & b) { - Packet2f mask = {-0.0f, 0.0f}; + Packet2f mask = {numext::bit_cast<float>(0x80000000u), 0.0f}; return padd(a, pxor(mask, b)); } template<> EIGEN_STRONG_INLINE Packet4f pxor<Packet4f>(const Packet4f& a, const Packet4f& b); template<> EIGEN_STRONG_INLINE Packet4f paddsub<Packet4f>(const Packet4f& a, const Packet4f& b) { - Packet4f mask = {-0.0f, 0.0f, -0.0f, 0.0f}; + Packet4f mask = {numext::bit_cast<float>(0x80000000u), 0.0f, numext::bit_cast<float>(0x80000000u), 0.0f}; return padd(a, pxor(mask, b)); } @@ -3751,7 +3751,7 @@ template<> EIGEN_STRONG_INLINE Packet2d psub<Packet2d>(const Packet2d& a, const template<> EIGEN_STRONG_INLINE Packet2d pxor<Packet2d>(const Packet2d& , const Packet2d& ); template<> EIGEN_STRONG_INLINE Packet2d paddsub<Packet2d>(const Packet2d& a, const Packet2d& b){ - const Packet2d mask = {-0.0,0.0}; + const Packet2d mask = {numext::bit_cast<double>(0x8000000000000000ull),0.0}; return padd(a, pxor(mask, b)); } |