mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 19:59:05 +08:00
Make the GCC workaround for sqrt GCC-only; detect Emscripten as non-GCC
This commit is contained in:
parent
2ac59e5d36
commit
e6ee18d6b4
@ -531,7 +531,9 @@ template<>
|
|||||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
|
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
|
||||||
double sqrt(const double &x)
|
double sqrt(const double &x)
|
||||||
{
|
{
|
||||||
#if EIGEN_COMP_GNUC && !defined(EMSCRIPTEN)
|
#if EIGEN_COMP_GNUC_STRICT
|
||||||
|
// This works around a GCC bug generating poor code for _mm_sqrt_pd
|
||||||
|
// See https://bitbucket.org/eigen/eigen/commits/14f468dba4d350d7c19c9b93072e19f7b3df563b
|
||||||
return internal::pfirst(internal::Packet2d(__builtin_ia32_sqrtsd(_mm_set_sd(x))));
|
return internal::pfirst(internal::Packet2d(__builtin_ia32_sqrtsd(_mm_set_sd(x))));
|
||||||
#else
|
#else
|
||||||
return internal::pfirst(internal::Packet2d(_mm_sqrt_pd(_mm_set_sd(x))));
|
return internal::pfirst(internal::Packet2d(_mm_sqrt_pd(_mm_set_sd(x))));
|
||||||
|
@ -99,9 +99,16 @@
|
|||||||
#define EIGEN_COMP_ARM 0
|
#define EIGEN_COMP_ARM 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/// \internal EIGEN_COMP_ARM set to 1 if the compiler is ARM Compiler
|
||||||
|
#if defined(EMSCRIPTEN)
|
||||||
|
#define EIGEN_COMP_EMSCRIPTEN 1
|
||||||
|
#else
|
||||||
|
#define EIGEN_COMP_EMSCRIPTEN 0
|
||||||
|
#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_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_MINGW || EIGEN_COMP_PGI || EIGEN_COMP_IBM || EIGEN_COMP_ARM )
|
#if EIGEN_COMP_GNUC && !(EIGEN_COMP_CLANG || EIGEN_COMP_ICC || EIGEN_COMP_MINGW || EIGEN_COMP_PGI || EIGEN_COMP_IBM || EIGEN_COMP_ARM || EIGEN_COMP_EMSCRIPTEN)
|
||||||
#define EIGEN_COMP_GNUC_STRICT 1
|
#define EIGEN_COMP_GNUC_STRICT 1
|
||||||
#else
|
#else
|
||||||
#define EIGEN_COMP_GNUC_STRICT 0
|
#define EIGEN_COMP_GNUC_STRICT 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user