mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-20 08:39:37 +08:00
issue #2581: review and cleanup of compiler version checks
This commit is contained in:
parent
b523120687
commit
d70b4864d9
@ -34,16 +34,16 @@
|
||||
#include <new>
|
||||
#endif
|
||||
|
||||
// Disable the ipa-cp-clone optimization flag with MinGW 6.x or newer (enabled by default with -O3)
|
||||
// Disable the ipa-cp-clone optimization flag with MinGW 6.x or older (enabled by default with -O3)
|
||||
// See http://eigen.tuxfamily.org/bz/show_bug.cgi?id=556 for details.
|
||||
#if EIGEN_COMP_MINGW && EIGEN_GNUC_AT_MOST(5,5)
|
||||
#if EIGEN_COMP_MINGW && EIGEN_GNUC_STRICT_LESS_THAN(6,0,0)
|
||||
#pragma GCC optimize ("-fno-ipa-cp-clone")
|
||||
#endif
|
||||
|
||||
// Prevent ICC from specializing std::complex operators that silently fail
|
||||
// on device. This allows us to use our own device-compatible specializations
|
||||
// instead.
|
||||
#if defined(EIGEN_COMP_ICC) && defined(EIGEN_GPU_COMPILE_PHASE) \
|
||||
#if EIGEN_COMP_ICC && defined(EIGEN_GPU_COMPILE_PHASE) \
|
||||
&& !defined(_OVERRIDE_COMPLEX_SPECIALIZATION_)
|
||||
#define _OVERRIDE_COMPLEX_SPECIALIZATION_ 1
|
||||
#endif
|
||||
|
@ -670,7 +670,7 @@ template<> EIGEN_STRONG_INLINE Packet8i pcmp_eq(const Packet8i& a, const Packet8
|
||||
}
|
||||
|
||||
template<> EIGEN_STRONG_INLINE Packet8f pmin<Packet8f>(const Packet8f& a, const Packet8f& b) {
|
||||
#if EIGEN_COMP_GNUC && EIGEN_COMP_GNUC < 63
|
||||
#if EIGEN_GNUC_STRICT_LESS_THAN(6,3,0)
|
||||
// There appears to be a bug in GCC, by which the optimizer may flip
|
||||
// the argument order in calls to _mm_min_ps/_mm_max_ps, so we have to
|
||||
// resort to inline ASM here. This is supposed to be fixed in gcc6.3,
|
||||
@ -684,7 +684,7 @@ template<> EIGEN_STRONG_INLINE Packet8f pmin<Packet8f>(const Packet8f& a, const
|
||||
#endif
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE Packet4d pmin<Packet4d>(const Packet4d& a, const Packet4d& b) {
|
||||
#if EIGEN_COMP_GNUC && EIGEN_COMP_GNUC < 63
|
||||
#if EIGEN_GNUC_STRICT_LESS_THAN(6,3,0)
|
||||
// See pmin above
|
||||
Packet4d res;
|
||||
asm("vminpd %[a], %[b], %[res]" : [res] "=x" (res) : [a] "x" (a), [b] "x" (b));
|
||||
@ -705,7 +705,7 @@ template<> EIGEN_STRONG_INLINE Packet8i pmin<Packet8i>(const Packet8i& a, const
|
||||
}
|
||||
|
||||
template<> EIGEN_STRONG_INLINE Packet8f pmax<Packet8f>(const Packet8f& a, const Packet8f& b) {
|
||||
#if EIGEN_COMP_GNUC && EIGEN_COMP_GNUC < 63
|
||||
#if EIGEN_GNUC_STRICT_LESS_THAN(6,3,0)
|
||||
// See pmin above
|
||||
Packet8f res;
|
||||
asm("vmaxps %[a], %[b], %[res]" : [res] "=x" (res) : [a] "x" (a), [b] "x" (b));
|
||||
@ -716,7 +716,7 @@ template<> EIGEN_STRONG_INLINE Packet8f pmax<Packet8f>(const Packet8f& a, const
|
||||
#endif
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE Packet4d pmax<Packet4d>(const Packet4d& a, const Packet4d& b) {
|
||||
#if EIGEN_COMP_GNUC && EIGEN_COMP_GNUC < 63
|
||||
#if EIGEN_GNUC_STRICT_LESS_THAN(6,3,0)
|
||||
// See pmin above
|
||||
Packet4d res;
|
||||
asm("vmaxpd %[a], %[b], %[res]" : [res] "=x" (res) : [a] "x" (a), [b] "x" (b));
|
||||
|
@ -31,7 +31,7 @@ namespace internal {
|
||||
#endif
|
||||
|
||||
// Disable the code for older versions of gcc that don't support many of the required avx512 math instrinsics.
|
||||
#if EIGEN_GNUC_AT_LEAST(5, 3) || EIGEN_COMP_CLANG || EIGEN_COMP_MSVC >= 1923 || EIGEN_COMP_ICC >= 1900
|
||||
#if EIGEN_GNUC_STRICT_AT_LEAST(5,3,0) || EIGEN_COMP_CLANG || EIGEN_COMP_MSVC >= 1923 || EIGEN_COMP_ICC >= 1900
|
||||
#define EIGEN_HAS_AVX512_MATH 1
|
||||
#else
|
||||
#define EIGEN_HAS_AVX512_MATH 0
|
||||
@ -2384,7 +2384,7 @@ EIGEN_STRONG_INLINE Packet16f Bf16ToF32(const Packet16bf& a) {
|
||||
EIGEN_STRONG_INLINE Packet16bf F32ToBf16(const Packet16f& a) {
|
||||
Packet16bf r;
|
||||
|
||||
#if defined(EIGEN_VECTORIZE_AVX512BF16) && EIGEN_GNUC_AT_LEAST(10, 1)
|
||||
#if defined(EIGEN_VECTORIZE_AVX512BF16) && EIGEN_GNUC_STRICT_AT_LEAST(10,1,0)
|
||||
// Since GCC 10.1 supports avx512bf16 and C style explicit cast
|
||||
// (C++ static_cast is not supported yet), do conversion via intrinsic
|
||||
// and register path for performance.
|
||||
|
@ -17,7 +17,7 @@ namespace Eigen {
|
||||
namespace internal {
|
||||
|
||||
// Disable the code for older versions of gcc that don't support many of the required avx512 math instrinsics.
|
||||
#if EIGEN_GNUC_AT_LEAST(5, 3) || EIGEN_COMP_CLANG || EIGEN_COMP_MSVC >= 1923 || EIGEN_COMP_ICC >= 1900
|
||||
#if EIGEN_GNUC_STRICT_AT_LEAST(5,3,0) || EIGEN_COMP_CLANG || EIGEN_COMP_MSVC >= 1923 || EIGEN_COMP_ICC >= 1900
|
||||
#define EIGEN_HAS_AVX512_MATH 1
|
||||
#else
|
||||
#define EIGEN_HAS_AVX512_MATH 0
|
||||
|
@ -61,7 +61,7 @@ Packet4f patan<Packet4f>(const Packet4f& _x)
|
||||
}
|
||||
|
||||
#ifdef EIGEN_VECTORIZE_VSX
|
||||
#ifndef EIGEN_COMP_CLANG
|
||||
#if !EIGEN_COMP_CLANG
|
||||
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet4f prsqrt<Packet4f>(const Packet4f& x)
|
||||
{
|
||||
@ -103,7 +103,7 @@ template<> EIGEN_STRONG_INLINE Packet8bf psqrt<Packet8bf> (const Packet8bf& a){
|
||||
BF16_TO_F32_UNARY_OP_WRAPPER(psqrt<Packet4f>, a);
|
||||
}
|
||||
|
||||
#ifndef EIGEN_COMP_CLANG
|
||||
#if !EIGEN_COMP_CLANG
|
||||
template<> EIGEN_STRONG_INLINE Packet8bf prsqrt<Packet8bf> (const Packet8bf& a){
|
||||
BF16_TO_F32_UNARY_OP_WRAPPER(prsqrt<Packet4f>, a);
|
||||
}
|
||||
|
@ -2935,8 +2935,7 @@ template<> EIGEN_STRONG_INLINE Packet2d psignbit(const Packet2d& a) { return (P
|
||||
// are buggy, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70963
|
||||
template<>
|
||||
inline Packet2l pcast<Packet2d, Packet2l>(const Packet2d& x) {
|
||||
#if EIGEN_GNUC_AT_LEAST(5, 4) || \
|
||||
(EIGEN_GNUC_AT(6, 1) && __GNUC_PATCHLEVEL__ >= 1)
|
||||
#if EIGEN_GNUC_STRICT_AT_LEAST(7,1,0)
|
||||
return vec_cts(x, 0); // TODO: check clang version.
|
||||
#else
|
||||
double tmp[2];
|
||||
|
@ -39,7 +39,7 @@
|
||||
// To allow std::complex operator use on device, define _OVERRIDE_COMPLEX_SPECIALIZATION_
|
||||
// prior to first inclusion of <complex>. This prevents ICC from adding
|
||||
// its own specializations, so our custom ones below can be used instead.
|
||||
#if !(defined(EIGEN_COMP_ICC) && defined(_USE_COMPLEX_SPECIALIZATION_))
|
||||
#if !(EIGEN_COMP_ICC && defined(_USE_COMPLEX_SPECIALIZATION_))
|
||||
|
||||
// Import Eigen's internal operator specializations.
|
||||
#define EIGEN_USING_STD_COMPLEX_OPERATORS \
|
||||
|
@ -96,7 +96,7 @@ struct gebp_traits <float,float,false,false,Architecture::NEON,GEBPPacketFull>
|
||||
template<int LaneID>
|
||||
EIGEN_STRONG_INLINE void madd_helper(const LhsPacket& a, const RhsPacketx4& b, AccPacket& c) const
|
||||
{
|
||||
#if EIGEN_COMP_GNUC_STRICT
|
||||
#if EIGEN_GNUC_STRICT_LESS_THAN(9,0,0)
|
||||
// 1. workaround gcc issue https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89101
|
||||
// vfmaq_laneq_f32 is implemented through a costly dup, which was fixed in gcc9
|
||||
// 2. workaround the gcc register split problem on arm64-neon
|
||||
@ -166,7 +166,7 @@ struct gebp_traits <double,double,false,false,Architecture::NEON>
|
||||
template <int LaneID>
|
||||
EIGEN_STRONG_INLINE void madd_helper(const LhsPacket& a, const RhsPacketx4& b, AccPacket& c) const
|
||||
{
|
||||
#if EIGEN_COMP_GNUC_STRICT
|
||||
#if EIGEN_GNUC_STRICT_LESS_THAN(9,0,0)
|
||||
// 1. workaround gcc issue https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89101
|
||||
// vfmaq_laneq_f64 is implemented through a costly dup, which was fixed in gcc9
|
||||
// 2. workaround the gcc register split problem on arm64-neon
|
||||
|
@ -3696,11 +3696,11 @@ template<> EIGEN_STRONG_INLINE Packet4bf pnegate<Packet4bf>(const Packet4bf& a)
|
||||
|
||||
// Clang 3.5 in the iOS toolchain has an ICE triggered by NEON intrisics for double.
|
||||
// Confirmed at least with __apple_build_version__ = 6000054.
|
||||
#ifdef __apple_build_version__
|
||||
#if EIGEN_COMP_CLANGAPPLE
|
||||
// Let's hope that by the time __apple_build_version__ hits the 601* range, the bug will be fixed.
|
||||
// https://gist.github.com/yamaya/2924292 suggests that the 3 first digits are only updated with
|
||||
// major toolchain updates.
|
||||
#define EIGEN_APPLE_DOUBLE_NEON_BUG (__apple_build_version__ < 6010000)
|
||||
#define EIGEN_APPLE_DOUBLE_NEON_BUG (EIGEN_COMP_CLANGAPPLE < 6010000)
|
||||
#else
|
||||
#define EIGEN_APPLE_DOUBLE_NEON_BUG 0
|
||||
#endif
|
||||
@ -3928,7 +3928,7 @@ template<> EIGEN_STRONG_INLINE double predux<Packet2d>(const Packet2d& a)
|
||||
|
||||
// Other reduction functions:
|
||||
// mul
|
||||
#if EIGEN_COMP_CLANG && defined(__apple_build_version__)
|
||||
#if EIGEN_COMP_CLANGAPPLE
|
||||
template<> EIGEN_STRONG_INLINE double predux_mul<Packet2d>(const Packet2d& a)
|
||||
{ return (vget_low_f64(a) * vget_high_f64(a))[0]; }
|
||||
#else
|
||||
|
@ -475,7 +475,7 @@ template<> EIGEN_STRONG_INLINE Packet16b pcmp_eq(const Packet16b& a, const Packe
|
||||
template<> EIGEN_STRONG_INLINE Packet4i pcmp_le(const Packet4i& a, const Packet4i& b) { return por(pcmp_lt(a,b), pcmp_eq(a,b)); }
|
||||
|
||||
template<> EIGEN_STRONG_INLINE Packet4f pmin<Packet4f>(const Packet4f& a, const Packet4f& b) {
|
||||
#if EIGEN_COMP_GNUC_STRICT && EIGEN_COMP_GNUC < 63
|
||||
#if EIGEN_GNUC_STRICT_LESS_THAN(6,3,0)
|
||||
// There appears to be a bug in GCC, by which the optimizer may
|
||||
// flip the argument order in calls to _mm_min_ps, so we have to
|
||||
// resort to inline ASM here. This is supposed to be fixed in gcc6.3,
|
||||
@ -494,7 +494,7 @@ template<> EIGEN_STRONG_INLINE Packet4f pmin<Packet4f>(const Packet4f& a, const
|
||||
#endif
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE Packet2d pmin<Packet2d>(const Packet2d& a, const Packet2d& b) {
|
||||
#if EIGEN_COMP_GNUC_STRICT && EIGEN_COMP_GNUC < 63
|
||||
#if EIGEN_GNUC_STRICT_LESS_THAN(6,3,0)
|
||||
// There appears to be a bug in GCC, by which the optimizer may
|
||||
// flip the argument order in calls to _mm_min_pd, so we have to
|
||||
// resort to inline ASM here. This is supposed to be fixed in gcc6.3,
|
||||
@ -525,7 +525,7 @@ template<> EIGEN_STRONG_INLINE Packet4i pmin<Packet4i>(const Packet4i& a, const
|
||||
|
||||
|
||||
template<> EIGEN_STRONG_INLINE Packet4f pmax<Packet4f>(const Packet4f& a, const Packet4f& b) {
|
||||
#if EIGEN_COMP_GNUC_STRICT && EIGEN_COMP_GNUC < 63
|
||||
#if EIGEN_GNUC_STRICT_LESS_THAN(6,3,0)
|
||||
// There appears to be a bug in GCC, by which the optimizer may
|
||||
// flip the argument order in calls to _mm_max_ps, so we have to
|
||||
// resort to inline ASM here. This is supposed to be fixed in gcc6.3,
|
||||
@ -544,7 +544,7 @@ template<> EIGEN_STRONG_INLINE Packet4f pmax<Packet4f>(const Packet4f& a, const
|
||||
#endif
|
||||
}
|
||||
template<> EIGEN_STRONG_INLINE Packet2d pmax<Packet2d>(const Packet2d& a, const Packet2d& b) {
|
||||
#if EIGEN_COMP_GNUC_STRICT && EIGEN_COMP_GNUC < 63
|
||||
#if EIGEN_GNUC_STRICT_LESS_THAN(6,3,0)
|
||||
// There appears to be a bug in GCC, by which the optimizer may
|
||||
// flip the argument order in calls to _mm_max_pd, so we have to
|
||||
// resort to inline ASM here. This is supposed to be fixed in gcc6.3,
|
||||
|
@ -154,7 +154,7 @@ struct functor_traits<swap_assign_op<Scalar> > {
|
||||
enum {
|
||||
Cost = 3 * NumTraits<Scalar>::ReadCost,
|
||||
PacketAccess =
|
||||
#if defined(EIGEN_VECTORIZE_AVX) && EIGEN_COMP_CLANG && (EIGEN_COMP_CLANG<800 || defined(__apple_build_version__))
|
||||
#if defined(EIGEN_VECTORIZE_AVX) && (EIGEN_CLANG_STRICT_LESS_THAN(8,0,0) || EIGEN_COMP_CLANGAPPLE)
|
||||
// This is a partial workaround for a bug in clang generating bad code
|
||||
// when mixing 256/512 bits loads and 128 bits moves.
|
||||
// See http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1684
|
||||
|
@ -1212,7 +1212,7 @@ struct lhs_process_one_packet
|
||||
traits.madd(*A0, *rhs_panel, *C1, *T0, fix<1>);
|
||||
traits.madd(*A0, *rhs_panel, *C2, *T0, fix<2>);
|
||||
traits.madd(*A0, *rhs_panel, *C3, *T0, fix<3>);
|
||||
#if EIGEN_GNUC_AT_LEAST(6,0) && defined(EIGEN_VECTORIZE_SSE) && !(EIGEN_COMP_LCC)
|
||||
#if EIGEN_GNUC_STRICT_AT_LEAST(6,0,0) && defined(EIGEN_VECTORIZE_SSE) && !(EIGEN_COMP_LCC)
|
||||
__asm__ ("" : "+x,m" (*A0));
|
||||
#endif
|
||||
EIGEN_ASM_COMMENT("end step of gebp micro kernel 1X4");
|
||||
@ -1628,7 +1628,7 @@ void gebp_kernel<LhsScalar,RhsScalar,Index,DataMapper,mr,nr,ConjugateLhs,Conjuga
|
||||
RhsPanel27 rhs_panel;
|
||||
RhsPacket T0;
|
||||
LhsPacket A2;
|
||||
#if EIGEN_COMP_GNUC_STRICT && EIGEN_ARCH_ARM64 && defined(EIGEN_VECTORIZE_NEON) && !(EIGEN_GNUC_AT_LEAST(9,0))
|
||||
#if EIGEN_ARCH_ARM64 && defined(EIGEN_VECTORIZE_NEON) && EIGEN_GNUC_STRICT_LESS_THAN(9,0,0)
|
||||
// see http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1633
|
||||
// without this workaround A0, A1, and A2 are loaded in the same register,
|
||||
// which is not good for pipelining
|
||||
@ -1834,7 +1834,7 @@ void gebp_kernel<LhsScalar,RhsScalar,Index,DataMapper,mr,nr,ConjugateLhs,Conjuga
|
||||
RhsPanel15 rhs_panel;
|
||||
RhsPacket T0;
|
||||
LhsPacket A2;
|
||||
#if EIGEN_COMP_GNUC_STRICT && EIGEN_ARCH_ARM64 && defined(EIGEN_VECTORIZE_NEON) && !(EIGEN_GNUC_AT_LEAST(9,0))
|
||||
#if EIGEN_ARCH_ARM64 && defined(EIGEN_VECTORIZE_NEON) && EIGEN_GNUC_STRICT_LESS_THAN(9,0,0)
|
||||
// see http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1633
|
||||
// without this workaround A0, A1, and A2 are loaded in the same register,
|
||||
// which is not good for pipelining
|
||||
@ -2081,7 +2081,7 @@ void gebp_kernel<LhsScalar,RhsScalar,Index,DataMapper,mr,nr,ConjugateLhs,Conjuga
|
||||
RhsPacket T0;
|
||||
// NOTE: the begin/end asm comments below work around bug 935!
|
||||
// but they are not enough for gcc>=6 without FMA (bug 1637)
|
||||
#if EIGEN_GNUC_AT_LEAST(6,0) && defined(EIGEN_VECTORIZE_SSE)
|
||||
#if EIGEN_GNUC_STRICT_AT_LEAST(6,0,0) && defined(EIGEN_VECTORIZE_SSE)
|
||||
#define EIGEN_GEBP_2Px8_SPILLING_WORKAROUND __asm__ ("" : [a0] "+x,m" (A0),[a1] "+x,m" (A1));
|
||||
#else
|
||||
#define EIGEN_GEBP_2Px8_SPILLING_WORKAROUND
|
||||
@ -2245,7 +2245,7 @@ void gebp_kernel<LhsScalar,RhsScalar,Index,DataMapper,mr,nr,ConjugateLhs,Conjuga
|
||||
|
||||
// NOTE: the begin/end asm comments below work around bug 935!
|
||||
// but they are not enough for gcc>=6 without FMA (bug 1637)
|
||||
#if EIGEN_GNUC_AT_LEAST(6,0) && defined(EIGEN_VECTORIZE_SSE) && !(EIGEN_COMP_LCC)
|
||||
#if EIGEN_GNUC_STRICT_AT_LEAST(6,0,0) && defined(EIGEN_VECTORIZE_SSE) && !(EIGEN_COMP_LCC)
|
||||
#define EIGEN_GEBP_2PX4_SPILLING_WORKAROUND __asm__ ("" : [a0] "+x,m" (A0),[a1] "+x,m" (A1));
|
||||
#else
|
||||
#define EIGEN_GEBP_2PX4_SPILLING_WORKAROUND
|
||||
|
@ -186,14 +186,14 @@
|
||||
#define EIGEN_SSE2_ON_MSVC_2008_OR_LATER
|
||||
#endif
|
||||
#else
|
||||
#if (defined __SSE2__) && ( (!EIGEN_COMP_GNUC) || EIGEN_COMP_ICC || EIGEN_COMP_GNUC )
|
||||
#define EIGEN_SSE2_ON_NON_MSVC_BUT_NOT_OLD_GCC
|
||||
#if defined(__SSE2__)
|
||||
#define EIGEN_SSE2_ON_NON_MSVC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !(defined(EIGEN_DONT_VECTORIZE) || defined(EIGEN_GPUCC))
|
||||
|
||||
#if defined (EIGEN_SSE2_ON_NON_MSVC_BUT_NOT_OLD_GCC) || defined(EIGEN_SSE2_ON_MSVC_2008_OR_LATER)
|
||||
#if defined (EIGEN_SSE2_ON_NON_MSVC) || defined(EIGEN_SSE2_ON_MSVC_2008_OR_LATER)
|
||||
|
||||
// Defines symbols for compile-time detection of which instructions are
|
||||
// used.
|
||||
@ -285,7 +285,7 @@
|
||||
#endif
|
||||
|
||||
// Disable AVX support on broken xcode versions
|
||||
#if defined(__apple_build_version__) && (__apple_build_version__ == 11000033 ) && ( __MAC_OS_X_VERSION_MIN_REQUIRED == 101500 )
|
||||
#if ( EIGEN_COMP_CLANGAPPLE == 11000033 ) && ( __MAC_OS_X_VERSION_MIN_REQUIRED == 101500 )
|
||||
// A nasty bug in the clang compiler shipped with xcode in a common compilation situation
|
||||
// when XCode 11.0 and Mac deployment target macOS 10.15 is https://trac.macports.org/ticket/58776#no1
|
||||
#ifdef EIGEN_VECTORIZE_AVX
|
||||
@ -427,7 +427,7 @@
|
||||
#include <arm_fp16.h>
|
||||
#endif
|
||||
|
||||
#if defined(__F16C__) && (!defined(EIGEN_GPUCC) && (!EIGEN_COMP_CLANG || EIGEN_COMP_CLANG>=380))
|
||||
#if defined(__F16C__) && !defined(EIGEN_GPUCC) && (!EIGEN_COMP_CLANG_STRICT || EIGEN_CLANG_STRICT_AT_LEAST(3,8,0))
|
||||
// We can use the optimized fp16 to float and float to fp16 conversion routines
|
||||
#define EIGEN_HAS_FP16_C
|
||||
|
||||
|
@ -59,20 +59,27 @@
|
||||
// Compiler identification, EIGEN_COMP_*
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
/// \internal EIGEN_COMP_GNUC set to 1 for all compilers compatible with GCC
|
||||
/// \internal EIGEN_COMP_GNUC set to version (e.g., 951 for GCC 9.5.1) for all compilers compatible with GCC
|
||||
#ifdef __GNUC__
|
||||
#define EIGEN_COMP_GNUC (__GNUC__*10+__GNUC_MINOR__)
|
||||
#define EIGEN_COMP_GNUC (__GNUC__*100+__GNUC_MINOR__*10+__GNUC_PATCH__)
|
||||
#else
|
||||
#define EIGEN_COMP_GNUC 0
|
||||
#endif
|
||||
|
||||
/// \internal EIGEN_COMP_CLANG set to major+minor version (e.g., 307 for clang 3.7) if the compiler is clang
|
||||
/// \internal EIGEN_COMP_CLANG set to version (e.g., 372 for clang 3.7.2) if the compiler is clang
|
||||
#if defined(__clang__)
|
||||
#define EIGEN_COMP_CLANG (__clang_major__*100+__clang_minor__)
|
||||
#define EIGEN_COMP_CLANG (__clang_major__*100+__clang_minor__*10+__clang_patchlevel__)
|
||||
#else
|
||||
#define EIGEN_COMP_CLANG 0
|
||||
#endif
|
||||
|
||||
/// \internal EIGEN_COMP_CLANGAPPLE set to the version number (e.g. 9000000 for AppleClang 9.0) if the compiler is AppleClang
|
||||
#if defined(__clang__) && defined(__apple_build_version__)
|
||||
#define EIGEN_COMP_CLANGAPPLE __apple_build_version__
|
||||
#else
|
||||
#define EIGEN_COMP_CLANGAPPLE 0
|
||||
#endif
|
||||
|
||||
/// \internal EIGEN_COMP_CASTXML set to 1 if being preprocessed by CastXML
|
||||
#if defined(__castxml__)
|
||||
#define EIGEN_COMP_CASTXML 1
|
||||
@ -244,25 +251,48 @@
|
||||
#endif
|
||||
|
||||
|
||||
/// \internal EIGEN_GNUC_STRICT set to 1 if the compiler is really GCC and not a compatible compiler (e.g., ICC, clang, mingw, etc.)
|
||||
/// \internal EIGEN_COMP_GNUC_STRICT set to 1 if the compiler is really GCC and not a compatible compiler (e.g., ICC, clang, mingw, etc.)
|
||||
#if EIGEN_COMP_GNUC && !(EIGEN_COMP_CLANG || EIGEN_COMP_ICC || EIGEN_COMP_CLANGICC || EIGEN_COMP_MINGW || EIGEN_COMP_PGI || EIGEN_COMP_IBM || EIGEN_COMP_ARM || EIGEN_COMP_EMSCRIPTEN || EIGEN_COMP_FCC || EIGEN_COMP_CLANGFCC || EIGEN_COMP_CPE || EIGEN_COMP_CLANGCPE || EIGEN_COMP_LCC)
|
||||
#define EIGEN_COMP_GNUC_STRICT 1
|
||||
#else
|
||||
#define EIGEN_COMP_GNUC_STRICT 0
|
||||
#endif
|
||||
|
||||
|
||||
#if EIGEN_COMP_GNUC
|
||||
#define EIGEN_GNUC_AT_LEAST(x,y) ((__GNUC__==x && __GNUC_MINOR__>=y) || __GNUC__>x)
|
||||
#define EIGEN_GNUC_AT_MOST(x,y) ((__GNUC__==x && __GNUC_MINOR__<=y) || __GNUC__<x)
|
||||
#define EIGEN_GNUC_AT(x,y) ( __GNUC__==x && __GNUC_MINOR__==y )
|
||||
// GCC, and compilers that pretend to be it, have different version schemes, so this only makes sense to use with the real GCC.
|
||||
#if EIGEN_COMP_GNUC_STRICT
|
||||
#define EIGEN_GNUC_STRICT_AT_LEAST(x,y,z) ((__GNUC__ > x) || \
|
||||
(__GNUC__ == x && __GNUC_MINOR__ > y) || \
|
||||
(__GNUC__ == x && __GNUC_MINOR__ == y && __GNUC_PATCH__ >= z))
|
||||
#define EIGEN_GNUC_STRICT_LESS_THAN(x,y,z) ((__GNUC__ < x) || \
|
||||
(__GNUC__ == x && __GNUC_MINOR__ < y) || \
|
||||
(__GNUC__ == x && __GNUC_MINOR__ == y && __GNUC_PATCH__ < z))
|
||||
#else
|
||||
#define EIGEN_GNUC_AT_LEAST(x,y) 0
|
||||
#define EIGEN_GNUC_AT_MOST(x,y) 0
|
||||
#define EIGEN_GNUC_AT(x,y) 0
|
||||
#define EIGEN_GNUC_STRICT_AT_LEAST(x,y,z) 0
|
||||
#define EIGEN_GNUC_STRICT_LESS_THAN(x,y,z) 0
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/// \internal EIGEN_COMP_CLANG_STRICT set to 1 if the compiler is really Clang and not a compatible compiler (e.g., AppleClang, etc.)
|
||||
#if EIGEN_COMP_CLANG && !(EIGEN_COMP_CLANGAPPLE || EIGEN_COMP_CLANGICC || EIGEN_COMP_CLANGFCC || EIGEN_COMP_CLANGCPE)
|
||||
#define EIGEN_COMP_CLANG_STRICT 1
|
||||
#else
|
||||
#define EIGEN_COMP_CLANG_STRICT 0
|
||||
#endif
|
||||
|
||||
// Clang, and compilers forked from it, have different version schemes, so this only makes sense to use with the real Clang.
|
||||
#if EIGEN_COMP_CLANG_STRICT
|
||||
#define EIGEN_CLANG_STRICT_AT_LEAST(x,y,z) ((__clang_major__ > x) || \
|
||||
(__clang_major__ == x && __clang_minor__ > y) || \
|
||||
(__clang_major__ == x && __clang_minor__ == y && __clang_patchlevel__ >= z))
|
||||
#define EIGEN_CLANG_STRICT_LESS_THAN(x,y,z) ((__clang_major__ < x) || \
|
||||
(__clang_major__ == x && __clang_minor__ < y) || \
|
||||
(__clang_major__ == x && __clang_minor__ == y && __clang_patchlevel__ < z))
|
||||
#else
|
||||
#define EIGEN_CLANG_STRICT_AT_LEAST(x,y,z) 0
|
||||
#define EIGEN_CLANG_STRICT_LESS_THAN(x,y,z) 0
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
// Architecture identification, EIGEN_ARCH_*
|
||||
//------------------------------------------------------------------------------------------
|
||||
@ -667,10 +697,13 @@
|
||||
// but in practice we should not rely on them but rather on the availability of
|
||||
// individual features as defined later.
|
||||
// This is why there is no EIGEN_HAS_CXX17.
|
||||
#if EIGEN_MAX_CPP_VER<14 || EIGEN_COMP_CXXVER<14 || (EIGEN_COMP_MSVC && EIGEN_COMP_MSVC < 1900) || \
|
||||
(EIGEN_COMP_ICC && EIGEN_COMP_ICC < 1500) || (EIGEN_COMP_NVCC && EIGEN_COMP_NVCC < 80000) || \
|
||||
(EIGEN_COMP_CLANG && ((EIGEN_COMP_CLANG<309) || (defined(__apple_build_version__) && (__apple_build_version__ < 9000000)))) || \
|
||||
(EIGEN_COMP_GNUC_STRICT && EIGEN_COMP_GNUC<51)
|
||||
#if EIGEN_MAX_CPP_VER < 14 || EIGEN_COMP_CXXVER < 14 || \
|
||||
(EIGEN_COMP_MSVC && EIGEN_COMP_MSVC < 1900) || \
|
||||
(EIGEN_COMP_ICC && EIGEN_COMP_ICC < 1500) || \
|
||||
(EIGEN_COMP_NVCC && EIGEN_COMP_NVCC < 80000) || \
|
||||
(EIGEN_COMP_CLANG_STRICT && EIGEN_COMP_CLANG < 390) || \
|
||||
(EIGEN_COMP_CLANGAPPLE && EIGEN_COMP_CLANGAPPLE < 9000000) || \
|
||||
(EIGEN_COMP_GNUC_STRICT && EIGEN_COMP_GNUC < 510)
|
||||
#error This compiler appears to be too old to be supported by Eigen
|
||||
#endif
|
||||
|
||||
@ -719,9 +752,9 @@
|
||||
#ifndef EIGEN_HAS_CXX17_OVERALIGN
|
||||
#if EIGEN_MAX_CPP_VER>=17 && EIGEN_COMP_CXXVER>=17 && ( \
|
||||
(EIGEN_COMP_MSVC >= 1912) \
|
||||
|| (EIGEN_GNUC_AT_LEAST(7,0)) \
|
||||
|| ((!defined(__apple_build_version__)) && (EIGEN_COMP_CLANG>=500)) \
|
||||
|| (( defined(__apple_build_version__)) && (__apple_build_version__>=10000000)) \
|
||||
|| (EIGEN_GNUC_STRICT_AT_LEAST(7,0,0)) \
|
||||
|| (EIGEN_CLANG_STRICT_AT_LEAST(5,0,0)) \
|
||||
|| (EIGEN_COMP_CLANGAPPLE && EIGEN_COMP_CLANGAPPLE >= 10000000) \
|
||||
) && !EIGEN_COMP_ICC
|
||||
#define EIGEN_HAS_CXX17_OVERALIGN 1
|
||||
#else
|
||||
|
@ -957,7 +957,7 @@ public:
|
||||
|
||||
~aligned_allocator() {}
|
||||
|
||||
#if EIGEN_COMP_GNUC_STRICT && EIGEN_GNUC_AT_LEAST(7,0)
|
||||
#if EIGEN_COMP_GNUC_STRICT && EIGEN_GNUC_STRICT_AT_LEAST(7,0,0)
|
||||
// In gcc std::allocator::max_size() is bugged making gcc triggers a warning:
|
||||
// eigen/Eigen/src/Core/util/Memory.h:189:12: warning: argument 1 value '18446744073709551612' exceeds maximum object size 9223372036854775807
|
||||
// See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87544
|
||||
|
@ -232,7 +232,7 @@ template<typename T, std::size_t N> struct array_size<std::array<T,N> > {
|
||||
*
|
||||
* For C++20, this function just forwards to `std::ssize`, or any ADL discoverable `ssize` function.
|
||||
*/
|
||||
#if EIGEN_COMP_CXXVER < 20 || EIGEN_GNUC_AT_MOST(9,4)
|
||||
#if EIGEN_COMP_CXXVER < 20 || EIGEN_GNUC_STRICT_LESS_THAN(10,0,0)
|
||||
template <typename T>
|
||||
EIGEN_CONSTEXPR auto index_list_size(const T& x) {
|
||||
using R = std::common_type_t<std::ptrdiff_t, std::make_signed_t<decltype(x.size())>>;
|
||||
|
@ -13,7 +13,7 @@
|
||||
// for packet_traits<Packet*>
|
||||
// => The only workaround would be to wrap _m128 and the likes
|
||||
// within wrappers.
|
||||
#if EIGEN_GNUC_AT_LEAST(6,0)
|
||||
#if EIGEN_GNUC_STRICT_AT_LEAST(6,0,0)
|
||||
#pragma GCC diagnostic ignored "-Wignored-attributes"
|
||||
#endif
|
||||
|
||||
|
@ -139,7 +139,7 @@ struct complex_operators {
|
||||
out[out_idx++] = a / numext::real(b);
|
||||
out[out_idx++] = numext::real(a) / b;
|
||||
|
||||
#if !defined(EIGEN_COMP_MSVC)
|
||||
#if !EIGEN_COMP_MSVC
|
||||
out[out_idx] = a; out[out_idx++] += b;
|
||||
out[out_idx] = a; out[out_idx++] -= b;
|
||||
out[out_idx] = a; out[out_idx++] *= b;
|
||||
@ -191,7 +191,7 @@ struct complex_operators {
|
||||
res.segment(block_idx, size) = x1.real().array() / x2.array();
|
||||
block_idx += size;
|
||||
|
||||
#if !defined(EIGEN_COMP_MSVC)
|
||||
#if !EIGEN_COMP_MSVC
|
||||
res.segment(block_idx, size) = x1; res.segment(block_idx, size) += x2;
|
||||
block_idx += size;
|
||||
res.segment(block_idx, size) = x1; res.segment(block_idx, size) -= x2;
|
||||
|
@ -146,7 +146,7 @@ void ei_test_init_gpu()
|
||||
std::cout << " EIGEN_CUDA_SDK_VER: " << int(EIGEN_CUDA_SDK_VER) << "\n";
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_COMP_NVCC
|
||||
#if EIGEN_COMP_NVCC
|
||||
std::cout << " EIGEN_COMP_NVCC: " << int(EIGEN_COMP_NVCC) << "\n";
|
||||
#endif
|
||||
|
||||
|
@ -395,7 +395,7 @@ void print_gpu_device_info()
|
||||
std::cout << " EIGEN_CUDA_SDK_VER: " << int(EIGEN_CUDA_SDK_VER) << std::endl;
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_COMP_NVCC
|
||||
#if EIGEN_COMP_NVCC
|
||||
std::cout << " EIGEN_COMP_NVCC: " << int(EIGEN_COMP_NVCC) << std::endl;
|
||||
#endif
|
||||
|
||||
|
@ -86,8 +86,8 @@ EIGEN_DECLARE_TEST(meta)
|
||||
VERIFY(( check_is_convertible(A*B, A) ));
|
||||
}
|
||||
|
||||
#if (EIGEN_COMP_GNUC && EIGEN_COMP_GNUC <= 99) \
|
||||
|| (EIGEN_COMP_CLANG && EIGEN_COMP_CLANG <= 909) \
|
||||
#if (EIGEN_COMP_GNUC_STRICT && EIGEN_COMP_GNUC <= 990) \
|
||||
|| (EIGEN_COMP_CLANG_STRICT && EIGEN_COMP_CLANG <= 990) \
|
||||
|| (EIGEN_COMP_MSVC && EIGEN_COMP_MSVC <= 1914)
|
||||
// See http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1752,
|
||||
// basically, a fix in the c++ standard breaks our c++98 implementation
|
||||
|
@ -26,7 +26,7 @@
|
||||
// for packet_traits<Packet*>
|
||||
// => The only workaround would be to wrap _m128 and the likes
|
||||
// within wrappers.
|
||||
#if EIGEN_GNUC_AT_LEAST(6,0)
|
||||
#if EIGEN_GNUC_STRICT_AT_LEAST(6,0,0)
|
||||
#pragma GCC diagnostic ignored "-Wignored-attributes"
|
||||
#endif
|
||||
|
||||
|
@ -31,8 +31,7 @@
|
||||
#endif
|
||||
// Checks whether C++11's `thread_local` storage duration specifier is
|
||||
// supported.
|
||||
#if defined(__apple_build_version__) && \
|
||||
((__apple_build_version__ < 8000042) || \
|
||||
#if EIGEN_COMP_CLANGAPPLE && ((EIGEN_COMP_CLANGAPPLE < 8000042) || \
|
||||
(TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0))
|
||||
// Notes: Xcode's clang did not support `thread_local` until version
|
||||
// 8, and even then not for all iOS < 9.0.
|
||||
|
@ -15,7 +15,7 @@
|
||||
// Visual studio doesn't implement a rand_r() function since its
|
||||
// implementation of rand() is already thread safe
|
||||
int rand_reentrant(unsigned int* s) {
|
||||
#ifdef EIGEN_COMP_MSVC_STRICT
|
||||
#if EIGEN_COMP_MSVC_STRICT
|
||||
EIGEN_UNUSED_VARIABLE(s);
|
||||
return rand();
|
||||
#else
|
||||
|
@ -17,7 +17,7 @@
|
||||
// Visual studio doesn't implement a rand_r() function since its
|
||||
// implementation of rand() is already thread safe
|
||||
int rand_reentrant(unsigned int* s) {
|
||||
#ifdef EIGEN_COMP_MSVC_STRICT
|
||||
#if EIGEN_COMP_MSVC_STRICT
|
||||
EIGEN_UNUSED_VARIABLE(s);
|
||||
return rand();
|
||||
#else
|
||||
|
Loading…
x
Reference in New Issue
Block a user