mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-01-24 14:45:14 +08:00
Replace compiler's alignas/alignof extension by respective c++11 keywords when available. This also fix a compilation issue with gcc-4.7.
This commit is contained in:
parent
89c4001d6f
commit
9005f0111f
@ -340,11 +340,7 @@ Packet psincos_float(const Packet& _x)
|
||||
if(predux_any(huge_mask))
|
||||
{
|
||||
const int PacketSize = unpacket_traits<Packet>::size;
|
||||
#if EIGEN_HAS_CXX11
|
||||
alignas(Packet) float vals[PacketSize];
|
||||
#else
|
||||
EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float vals[PacketSize];
|
||||
#endif
|
||||
pstoreu(vals, _x);
|
||||
for(int k=0; k<PacketSize;++k) {
|
||||
float val = vals[k];
|
||||
|
@ -29,10 +29,15 @@
|
||||
*
|
||||
* If we made alignment depend on whether or not EIGEN_VECTORIZE is defined, it would be impossible to link
|
||||
* vectorized and non-vectorized code.
|
||||
*
|
||||
* FIXME: this code can be cleaned up once we switch to proper C++11 only.
|
||||
*/
|
||||
#if (defined EIGEN_CUDACC)
|
||||
#define EIGEN_ALIGN_TO_BOUNDARY(n) __align__(n)
|
||||
#define EIGEN_ALIGNOF(x) __alignof(x)
|
||||
#elif EIGEN_HAS_ALIGNAS
|
||||
#define EIGEN_ALIGN_TO_BOUNDARY(n) alignas(n)
|
||||
#define EIGEN_ALIGNOF(x) alignof(x)
|
||||
#elif EIGEN_COMP_GNUC || EIGEN_COMP_PGI || EIGEN_COMP_IBM || EIGEN_COMP_ARM
|
||||
#define EIGEN_ALIGN_TO_BOUNDARY(n) __attribute__((aligned(n)))
|
||||
#define EIGEN_ALIGNOF(x) __alignof(x)
|
||||
@ -44,7 +49,7 @@
|
||||
#define EIGEN_ALIGN_TO_BOUNDARY(n) __attribute__((aligned(n)))
|
||||
#define EIGEN_ALIGNOF(x) __alignof(x)
|
||||
#else
|
||||
#error Please tell me what is the equivalent of __attribute__((aligned(n))) and __alignof(x) for your compiler
|
||||
#error Please tell me what is the equivalent of alignas(n) and alignof(x) for your compiler
|
||||
#endif
|
||||
|
||||
// If the user explicitly disable vectorization, then we also disable alignment
|
||||
|
@ -129,16 +129,21 @@
|
||||
#define EIGEN_COMP_MSVC_STRICT 0
|
||||
#endif
|
||||
|
||||
/// \internal EIGEN_COMP_IBM set to 1 if the compiler is IBM XL C++
|
||||
#if defined(__IBMCPP__) || defined(__xlc__)
|
||||
#define EIGEN_COMP_IBM 1
|
||||
/// \internal EIGEN_COMP_IBM set to xlc version if the compiler is IBM XL C++
|
||||
// XLC version
|
||||
// 3.1 0x0301
|
||||
// 4.5 0x0405
|
||||
// 5.0 0x0500
|
||||
// 12.1 0x0C01
|
||||
#if defined(__IBMCPP__) || defined(__xlc__) || defined(__ibmxl__)
|
||||
#define EIGEN_COMP_IBM __xlC__
|
||||
#else
|
||||
#define EIGEN_COMP_IBM 0
|
||||
#endif
|
||||
|
||||
/// \internal EIGEN_COMP_PGI set to 1 if the compiler is Portland Group Compiler
|
||||
/// \internal EIGEN_COMP_PGI set to PGI version if the compiler is Portland Group Compiler
|
||||
#if defined(__PGI)
|
||||
#define EIGEN_COMP_PGI 1
|
||||
#define EIGEN_COMP_PGI (__PGIC__*100+__PGIC_MINOR__)
|
||||
#else
|
||||
#define EIGEN_COMP_PGI 0
|
||||
#endif
|
||||
@ -347,9 +352,17 @@
|
||||
#define EIGEN_OS_WIN_STRICT 0
|
||||
#endif
|
||||
|
||||
/// \internal EIGEN_OS_SUN set to 1 if the OS is SUN
|
||||
/// \internal EIGEN_OS_SUN set to __SUNPRO_C if the OS is SUN
|
||||
// compiler solaris __SUNPRO_C
|
||||
// version studio
|
||||
// 5.7 10 0x570
|
||||
// 5.8 11 0x580
|
||||
// 5.9 12 0x590
|
||||
// 5.10 12.1 0x5100
|
||||
// 5.11 12.2 0x5110
|
||||
// 5.12 12.3 0x5120
|
||||
#if (defined(sun) || defined(__sun)) && !(defined(__SVR4) || defined(__svr4__))
|
||||
#define EIGEN_OS_SUN 1
|
||||
#define EIGEN_OS_SUN __SUNPRO_C
|
||||
#else
|
||||
#define EIGEN_OS_SUN 0
|
||||
#endif
|
||||
@ -546,6 +559,22 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef EIGEN_HAS_ALIGNAS
|
||||
#if EIGEN_MAX_CPP_VER>=11 && EIGEN_HAS_CXX11 && \
|
||||
( __has_feature(cxx_alignas) \
|
||||
|| EIGEN_HAS_CXX14 \
|
||||
|| (EIGEN_COMP_MSVC >= 1800) \
|
||||
|| (EIGEN_GNUC_AT_LEAST(4,8)) \
|
||||
|| (EIGEN_COMP_CLANG>=305) \
|
||||
|| (EIGEN_COMP_ICC>=1500) \
|
||||
|| (EIGEN_COMP_PGI>=1500) \
|
||||
|| (EIGEN_COMP_SUN>=0x5130))
|
||||
#define EIGEN_HAS_ALIGNAS 1
|
||||
#else
|
||||
#define EIGEN_HAS_ALIGNAS 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Does the compiler support type_traits?
|
||||
// - full support of type traits was added only to GCC 5.1.0.
|
||||
// - 20150626 corresponds to the last release of 4.x libstdc++
|
||||
|
Loading…
Reference in New Issue
Block a user