From 94641c83a0ef06a5c3d901f66b336631a5c8f9d7 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 28 Dec 2016 19:18:21 +0100 Subject: [PATCH] linmath: use correct 32-byte alignment when compiling Eigen with AVX --- dtool/src/dtoolbase/dtoolbase.h | 5 +++++ panda/src/linmath/lsimpleMatrix.h | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dtool/src/dtoolbase/dtoolbase.h b/dtool/src/dtoolbase/dtoolbase.h index 27add7c84d..825592a0d7 100644 --- a/dtool/src/dtoolbase/dtoolbase.h +++ b/dtool/src/dtoolbase/dtoolbase.h @@ -336,21 +336,26 @@ #define ALIGN_4BYTE #define ALIGN_8BYTE #define ALIGN_16BYTE +#define ALIGN_32BYTE #define ALIGN_64BYTE #elif defined(_MSC_VER) #define ALIGN_4BYTE __declspec(align(4)) #define ALIGN_8BYTE __declspec(align(8)) #define ALIGN_16BYTE __declspec(align(16)) +#define ALIGN_32BYTE __declspec(align(32)) #define ALIGN_64BYTE __declspec(align(64)) #elif defined(__GNUC__) #define ALIGN_4BYTE __attribute__ ((aligned (4))) #define ALIGN_8BYTE __attribute__ ((aligned (8))) #define ALIGN_16BYTE __attribute__ ((aligned (16))) +#define ALIGN_32BYTE __attribute__ ((aligned (32))) #define ALIGN_64BYTE __attribute__ ((aligned (64))) #else #define ALIGN_4BYTE #define ALIGN_8BYTE #define ALIGN_16BYTE +#define ALIGN_32BYTE +#define ALIGN_64BYTE #endif // Do we need to implement memory-alignment enforcement within the diff --git a/panda/src/linmath/lsimpleMatrix.h b/panda/src/linmath/lsimpleMatrix.h index 310dd23d03..ce84b64240 100644 --- a/panda/src/linmath/lsimpleMatrix.h +++ b/panda/src/linmath/lsimpleMatrix.h @@ -61,7 +61,9 @@ private: #endif // HAVE_EIGEN // This is as good a place as any to define this alignment macro. -#ifdef LINMATH_ALIGN +#if defined(LINMATH_ALIGN) && defined(HAVE_EIGEN) && defined(__AVX__) +#define ALIGN_LINMATH ALIGN_32BYTE +#elif defined(LINMATH_ALIGN) #define ALIGN_LINMATH ALIGN_16BYTE #else #define ALIGN_LINMATH