mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-12 17:33:15 +08:00
Fix special packetmath erfc flushing for ARM32.
This commit is contained in:
parent
fd48fbb260
commit
7b6623af30
@ -12,6 +12,20 @@
|
||||
#include "packetmath_test_shared.h"
|
||||
#include "../Eigen/SpecialFunctions"
|
||||
|
||||
#if EIGEN_ARCH_ARM
|
||||
// Note: 32-bit arm always flushes subnormals to zero.
|
||||
#define MAYBE_FLUSH(op) \
|
||||
[](Scalar x) { \
|
||||
Scalar y = static_cast<Scalar>(op(x)); \
|
||||
if (Eigen::numext::abs(y) < (std::numeric_limits<decltype(y)>::min)()) { \
|
||||
y = y * decltype(y)(0); /* Preserve sign. */ \
|
||||
} \
|
||||
return y; \
|
||||
}
|
||||
#else
|
||||
#define MAYBE_FLUSH(op) op
|
||||
#endif
|
||||
|
||||
template <typename Scalar, typename Packet>
|
||||
void packetmath_real() {
|
||||
using std::abs;
|
||||
@ -119,7 +133,7 @@ void packetmath_real() {
|
||||
CHECK_CWISE1_IF(internal::packet_traits<Scalar>::HasErf, std::erf, internal::perf);
|
||||
// FIXME(rmlarsen): This test occasionally fails due to difference in tiny subnormal results
|
||||
// near the underflow boundary. I am not sure which version is correct.
|
||||
CHECK_CWISE1_IF(internal::packet_traits<Scalar>::HasErfc, std::erfc, internal::perfc);
|
||||
CHECK_CWISE1_IF(internal::packet_traits<Scalar>::HasErfc, MAYBE_FLUSH(std::erfc), internal::perfc);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user