From 283d69294ba8bc2f09bef4d983f4f1b47b98ba23 Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen Date: Wed, 3 Apr 2024 21:03:26 +0000 Subject: [PATCH] Guard AVX2 implementation of psignbit in PacketMath.h --- Eigen/src/Core/arch/AVX/PacketMath.h | 4 ++++ 1 file changed, 4 insertions(+) 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) {