diff --git a/Eigen/src/Core/arch/AVX/PacketMath.h b/Eigen/src/Core/arch/AVX/PacketMath.h index ebea1dc75..2383e46e5 100644 --- a/Eigen/src/Core/arch/AVX/PacketMath.h +++ b/Eigen/src/Core/arch/AVX/PacketMath.h @@ -1837,7 +1837,11 @@ EIGEN_STRONG_INLINE Packet8bf psignbit(const Packet8bf& a) { } template <> EIGEN_STRONG_INLINE Packet8f psignbit(const Packet8f& a) { +#ifdef EIGEN_VECTORIZE_AVX2 return _mm256_castsi256_ps(_mm256_cmpgt_epi32(_mm256_setzero_si256(), _mm256_castps_si256(a))); +#else + return _mm256_castsi256_ps(parithmetic_shift_right<31>(Packet8i(_mm256_castps_si256(a)))); +#endif } template <> EIGEN_STRONG_INLINE Packet8ui psignbit(const Packet8ui& a) {