diff options
author | Gael Guennebaud <g.gael@free.fr> | 2014-09-01 10:52:58 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2014-09-01 10:52:58 +0200 |
commit | 0369db12af70fe5e63416a18c8236d419b0597c4 (patch) | |
tree | 8a88b5d6b7d6458ca99621d9318ca9885b8505ed /Eigen | |
parent | 01f3ca3e8d58394f1d42155d5499b7566050c8e7 (diff) |
bug #871: fix compilation on ARM/Neon regarding __has_builtin usage
Diffstat (limited to 'Eigen')
-rw-r--r-- | Eigen/src/Core/arch/NEON/PacketMath.h | 2 | ||||
-rw-r--r-- | Eigen/src/Core/util/Macros.h | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/Eigen/src/Core/arch/NEON/PacketMath.h b/Eigen/src/Core/arch/NEON/PacketMath.h index 380b76ae9..7c4509585 100644 --- a/Eigen/src/Core/arch/NEON/PacketMath.h +++ b/Eigen/src/Core/arch/NEON/PacketMath.h @@ -52,7 +52,7 @@ typedef uint32x4_t Packet4ui; // arm64 does have the pld instruction. If available, let's trust the __builtin_prefetch built-in function // which available on LLVM and GCC (at least) -#if (defined(__has_builtin) && __has_builtin(__builtin_prefetch)) || defined(__GNUC__) +#if EIGEN_HAS_BUILTIN(__builtin_prefetch) || defined(__GNUC__) #define EIGEN_ARM_PREFETCH(ADDR) __builtin_prefetch(ADDR); #elif defined __pld #define EIGEN_ARM_PREFETCH(ADDR) __pld(ADDR) diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h index 5e9b0a112..99e682653 100644 --- a/Eigen/src/Core/util/Macros.h +++ b/Eigen/src/Core/util/Macros.h @@ -107,6 +107,13 @@ #define EIGEN_DEFAULT_DENSE_INDEX_TYPE std::ptrdiff_t #endif +// Cross compiler wrapper around LLVM's __has_builtin +#ifdef __has_builtin +# define EIGEN_HAS_BUILTIN(x) __has_builtin(x) +#else +# define EIGEN_HAS_BUILTIN(x) 0 +#endif + // A Clang feature extension to determine compiler features. // We use it to determine 'cxx_rvalue_references' #ifndef __has_feature |