Tests: Check always-defined platform macros with #if, not #ifdef libeigen/eigen!3355 Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
diff --git a/Eigen/src/Core/NumTraits.h b/Eigen/src/Core/NumTraits.h index 75c3789..417a71c 100644 --- a/Eigen/src/Core/NumTraits.h +++ b/Eigen/src/Core/NumTraits.h
@@ -248,7 +248,7 @@ struct NumTraits<long double> : GenericNumTraits<long double> { EIGEN_DEVICE_FUNC constexpr static long double dummy_precision() { return static_cast<long double>(1e-15l); } -#if defined(EIGEN_ARCH_PPC) && (__LDBL_MANT_DIG__ == 106) +#if EIGEN_ARCH_PPC && (__LDBL_MANT_DIG__ == 106) // PowerPC double double causes issues with some values EIGEN_DEVICE_FUNC constexpr static long double epsilon() { // 2^(-(__LDBL_MANT_DIG__)+1)
diff --git a/contrib/test/tensor_executor.cpp b/contrib/test/tensor_executor.cpp index e2cd7ea..da6b2ac 100644 --- a/contrib/test/tensor_executor.cpp +++ b/contrib/test/tensor_executor.cpp
@@ -836,10 +836,12 @@ for (Index i = 0; i < dst.size(); ++i) VERIFY_IS_EQUAL(dst.coeff(i), numext::maxi(lhs.coeff(i), rhs.coeff(i))); } -#ifndef EIGEN_DONT_VECTORIZE -#define EIGEN_DONT_VECTORIZE 0 +// Eigen defines EIGEN_DONT_VECTORIZE without a value, e.g. when EIGEN_DONT_ALIGN disables alignment. +#ifdef EIGEN_DONT_VECTORIZE +#define VECTORIZABLE(T, VAL) false +#else +#define VECTORIZABLE(T, VAL) (Eigen::internal::packet_traits<T>::Vectorizable && (VAL)) #endif -#define VECTORIZABLE(T, VAL) !EIGEN_DONT_VECTORIZE&& Eigen::internal::packet_traits<T>::Vectorizable&& VAL #define CALL_SUBTEST_PART(PART) CALL_SUBTEST_##PART
diff --git a/test/array_cwise.cpp b/test/array_cwise.cpp index e427d8e..eba0db4 100644 --- a/test/array_cwise.cpp +++ b/test/array_cwise.cpp
@@ -142,7 +142,7 @@ template <typename Scalar> void binary_ops_test() { binary_op_test<Scalar>(BINARY_FUNCTOR_TEST_ARGS(pow)); -#ifndef EIGEN_COMP_MSVC +#if !EIGEN_COMP_MSVC binary_op_test<Scalar>(BINARY_FUNCTOR_TEST_ARGS(atan2)); #else binary_op_test<Scalar>( @@ -376,7 +376,7 @@ } Base a = eigenPow(j); -#ifdef EIGEN_COMP_MSVC +#if EIGEN_COMP_MSVC // Work around MSVC return value on underflow. // if std::pow returns 0 and Eigen returns a denormalized value, then skip the test int eigen_fpclass = std::fpclassify(a);
diff --git a/test/gpu_common.h b/test/gpu_common.h index efd09c1..eb07860 100644 --- a/test/gpu_common.h +++ b/test/gpu_common.h
@@ -133,7 +133,7 @@ std::cout << " EIGEN_CUDACC: " << int(EIGEN_CUDACC) << "\n"; #endif -#ifdef EIGEN_CUDA_SDK_VER +#if EIGEN_CUDA_SDK_VER std::cout << " EIGEN_CUDA_SDK_VER: " << int(EIGEN_CUDA_SDK_VER) << "\n"; #endif
diff --git a/test/packetmath.cpp b/test/packetmath.cpp index d66ae69..7b73f1d 100644 --- a/test/packetmath.cpp +++ b/test/packetmath.cpp
@@ -2217,8 +2217,8 @@ } RealScalar zero(0); -#ifdef EIGEN_ARCH_ARM - // ARM automatically flushes denormals to zero. +#if EIGEN_ARCH_ARM + // 32-bit ARM NEON flushes subnormals to zero. // Preserve sign by multiplying by +0. if (numext::abs(a) < (std::numeric_limits<RealScalar>::min)()) { a = a * zero;