Commit b799d1bc authored by Jesper Storm Bache's avatar Jesper Storm Bache Committed by Evan Nemerson

align: allow alignment > 8 on MSVC ≥ 19.16 (VS 2017)

Fixes #695
parent 7e2ccdbd
...@@ -151,8 +151,8 @@ ...@@ -151,8 +151,8 @@
* *
* Most compilers are okay with types which are aligned beyond what * Most compilers are okay with types which are aligned beyond what
* they think is the maximum, as long as the alignment is a power * they think is the maximum, as long as the alignment is a power
* of two. MSVC is the exception (of course), so we need to cap the * of two. Older versions of MSVC is the exception, so we need to cap
* alignment requests at values that the implementation supports. * the alignment requests at values that the implementation supports.
* *
* XL C/C++ will accept values larger than 16 (which is the alignment * XL C/C++ will accept values larger than 16 (which is the alignment
* of an AltiVec vector), but will not reliably align to the larger * of an AltiVec vector), but will not reliably align to the larger
...@@ -163,18 +163,22 @@ ...@@ -163,18 +163,22 @@
* macro will just return the value passed to it. */ * macro will just return the value passed to it. */
#if !defined(SIMDE_ALIGN_MAXIMUM) #if !defined(SIMDE_ALIGN_MAXIMUM)
#if defined(HEDLEY_MSVC_VERSION) #if defined(HEDLEY_MSVC_VERSION)
#if defined(_M_IX86) || defined(_M_AMD64) #if HEDLEY_MSVC_VERSION_CHECK(19, 16, 0)
#if HEDLEY_MSVC_VERSION_CHECK(19,14,0) // Visual studio 2017 and newer does not need a max
#define SIMDE_ALIGN_PLATFORM_MAXIMUM 64 #else
#elif HEDLEY_MSVC_VERSION_CHECK(16,0,0) #if defined(_M_IX86) || defined(_M_AMD64)
/* VS 2010 is really a guess based on Wikipedia; if anyone can #if HEDLEY_MSVC_VERSION_CHECK(19,14,0)
* test with old VS versions I'd really appreciate it. */ #define SIMDE_ALIGN_PLATFORM_MAXIMUM 64
#define SIMDE_ALIGN_PLATFORM_MAXIMUM 32 #elif HEDLEY_MSVC_VERSION_CHECK(16,0,0)
#else /* VS 2010 is really a guess based on Wikipedia; if anyone can
#define SIMDE_ALIGN_PLATFORM_MAXIMUM 16 * test with old VS versions I'd really appreciate it. */
#define SIMDE_ALIGN_PLATFORM_MAXIMUM 32
#else
#define SIMDE_ALIGN_PLATFORM_MAXIMUM 16
#endif
#elif defined(_M_ARM) || defined(_M_ARM64)
#define SIMDE_ALIGN_PLATFORM_MAXIMUM 8
#endif #endif
#elif defined(_M_ARM) || defined(_M_ARM64)
#define SIMDE_ALIGN_PLATFORM_MAXIMUM 8
#endif #endif
#elif defined(HEDLEY_IBM_VERSION) #elif defined(HEDLEY_IBM_VERSION)
#define SIMDE_ALIGN_PLATFORM_MAXIMUM 16 #define SIMDE_ALIGN_PLATFORM_MAXIMUM 16
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment