mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-10-18 02:51:30 +08:00
Fix EIGEN_OPTIMIZATION_BARRIER for clang-cl
This commit is contained in:
parent
f5ead2d34c
commit
e4493233e8
@ -993,8 +993,9 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void ignore_unused_variable(cons
|
||||
#endif
|
||||
|
||||
#if !defined(EIGEN_OPTIMIZATION_BARRIER)
|
||||
#if EIGEN_COMP_GNUC
|
||||
// According to https://gcc.gnu.org/onlinedocs/gcc/Constraints.html:
|
||||
// Implement the barrier on GNUC compilers or clang-cl.
|
||||
#if EIGEN_COMP_GNUC || (defined(__clang__) && defined(_MSC_VER))
|
||||
// According to https://gcc.gnu.org/onlinedocs/gcc/Constraints.html:
|
||||
// X: Any operand whatsoever.
|
||||
// r: A register operand is allowed provided that it is in a general
|
||||
// register.
|
||||
@ -1027,37 +1028,37 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void ignore_unused_variable(cons
|
||||
// directly for std::complex<T>, Eigen::half, Eigen::bfloat16. For these,
|
||||
// you will need to apply to the underlying POD type.
|
||||
#if EIGEN_ARCH_PPC && EIGEN_COMP_GNUC_STRICT
|
||||
// This seems to be broken on clang. Packet4f is loaded into a single
|
||||
// This seems to be broken on clang. Packet4f is loaded into a single
|
||||
// register rather than a vector, zeroing out some entries. Integer
|
||||
// types also generate a compile error.
|
||||
#if EIGEN_OS_MAC
|
||||
// General, Altivec for Apple (VSX were added in ISA v2.06):
|
||||
// General, Altivec for Apple (VSX were added in ISA v2.06):
|
||||
#define EIGEN_OPTIMIZATION_BARRIER(X) __asm__("" : "+r,v"(X));
|
||||
#else
|
||||
// General, Altivec, VSX otherwise:
|
||||
// General, Altivec, VSX otherwise:
|
||||
#define EIGEN_OPTIMIZATION_BARRIER(X) __asm__("" : "+r,v,wa"(X));
|
||||
#endif
|
||||
#elif EIGEN_ARCH_ARM_OR_ARM64
|
||||
#ifdef __ARM_FP
|
||||
// General, VFP or NEON.
|
||||
// General, VFP or NEON.
|
||||
// Clang doesn't like "r",
|
||||
// error: non-trivial scalar-to-vector conversion, possible invalid
|
||||
// constraint for vector typ
|
||||
#define EIGEN_OPTIMIZATION_BARRIER(X) __asm__("" : "+g,w"(X));
|
||||
#else
|
||||
// Arm without VFP or NEON.
|
||||
// Arm without VFP or NEON.
|
||||
// "w" constraint will not compile.
|
||||
#define EIGEN_OPTIMIZATION_BARRIER(X) __asm__("" : "+g"(X));
|
||||
#endif
|
||||
#elif EIGEN_ARCH_i386_OR_x86_64
|
||||
// General, SSE.
|
||||
// General, SSE.
|
||||
#define EIGEN_OPTIMIZATION_BARRIER(X) __asm__("" : "+g,x"(X));
|
||||
#else
|
||||
// Not implemented for other architectures.
|
||||
// Not implemented for other architectures.
|
||||
#define EIGEN_OPTIMIZATION_BARRIER(X)
|
||||
#endif
|
||||
#else
|
||||
// Not implemented for other compilers.
|
||||
// Not implemented for other compilers.
|
||||
#define EIGEN_OPTIMIZATION_BARRIER(X)
|
||||
#endif
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user