mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-14 20:56:00 +08:00
bug #871: fix compilation on ARM/Neon regarding __has_builtin usage (backport)
This commit is contained in:
parent
05fb735d1d
commit
5daebe0a27
@ -48,9 +48,18 @@ typedef uint32x4_t Packet4ui;
|
|||||||
#define EIGEN_INIT_NEON_PACKET2(X, Y) {X, Y}
|
#define EIGEN_INIT_NEON_PACKET2(X, Y) {X, Y}
|
||||||
#define EIGEN_INIT_NEON_PACKET4(X, Y, Z, W) {X, Y, Z, W}
|
#define EIGEN_INIT_NEON_PACKET4(X, Y, Z, W) {X, Y, Z, W}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __pld
|
// arm64 does have the pld instruction. If available, let's trust the __builtin_prefetch built-in function
|
||||||
#define __pld(x) asm volatile ( " pld [%[addr]]\n" :: [addr] "r" (x) : "cc" );
|
// which available on LLVM and GCC (at least)
|
||||||
|
#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)
|
||||||
|
#elif !defined(__aarch64__)
|
||||||
|
#define EIGEN_ARM_PREFETCH(ADDR) asm volatile ( " pld [%[addr]]\n" :: [addr] "r" (ADDR) : "cc" );
|
||||||
|
#else
|
||||||
|
// by default no explicit prefetching
|
||||||
|
#define EIGEN_ARM_PREFETCH(ADDR)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template<> struct packet_traits<float> : default_packet_traits
|
template<> struct packet_traits<float> : default_packet_traits
|
||||||
|
@ -96,6 +96,13 @@
|
|||||||
#define EIGEN_DEFAULT_DENSE_INDEX_TYPE std::ptrdiff_t
|
#define EIGEN_DEFAULT_DENSE_INDEX_TYPE std::ptrdiff_t
|
||||||
#endif
|
#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
|
||||||
|
|
||||||
/** Allows to disable some optimizations which might affect the accuracy of the result.
|
/** Allows to disable some optimizations which might affect the accuracy of the result.
|
||||||
* Such optimization are enabled by default, and set EIGEN_FAST_MATH to 0 to disable them.
|
* Such optimization are enabled by default, and set EIGEN_FAST_MATH to 0 to disable them.
|
||||||
* They currently include:
|
* They currently include:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user