From 3459fcfbc18a5aeef369f28f4c8131d4a4aa73a8 Mon Sep 17 00:00:00 2001 From: Christophe Date: Thu, 13 Feb 2014 21:02:11 +0100 Subject: [PATCH 1/2] Fixed instruction set detection on GCC --- glm/detail/intrinsic_geometric.inl | 2 +- glm/detail/setup.hpp | 26 ++++++++++++++------------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/glm/detail/intrinsic_geometric.inl b/glm/detail/intrinsic_geometric.inl index f46f140b..ad33571c 100644 --- a/glm/detail/intrinsic_geometric.inl +++ b/glm/detail/intrinsic_geometric.inl @@ -48,7 +48,7 @@ GLM_FUNC_QUALIFIER __m128 sse_dst_ps(__m128 p0, __m128 p1) //dot GLM_FUNC_QUALIFIER __m128 sse_dot_ps(__m128 v1, __m128 v2) { -# if((GLM_ARCH & GLM_ARCH_SSE4) == GLM_ARCH_SSE4) +# if((GLM_ARCH & GLM_ARCH_AVX) == GLM_ARCH_AVX) return _mm_dp_ps(v1, v2, 0xff); # else __m128 mul0 = _mm_mul_ps(v1, v2); diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index dfe71a8d..a0286018 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -550,9 +550,8 @@ #define GLM_ARCH_PURE 0x0000 #define GLM_ARCH_SSE2 0x0001 #define GLM_ARCH_SSE3 0x0002// | GLM_ARCH_SSE2 -#define GLM_ARCH_SSE4 0x0004// | GLM_ARCH_SSE3 | GLM_ARCH_SSE2 -#define GLM_ARCH_AVX 0x0008// | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2 -#define GLM_ARCH_AVX2 0x0010// | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2 +#define GLM_ARCH_AVX 0x0008// | GLM_ARCH_SSE3 | GLM_ARCH_SSE2 +#define GLM_ARCH_AVX2 0x0010// | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2 #if(defined(GLM_FORCE_PURE)) # define GLM_ARCH GLM_ARCH_PURE @@ -560,8 +559,6 @@ # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) #elif(defined(GLM_FORCE_AVX)) # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) -#elif(defined(GLM_FORCE_SSE4)) -# define GLM_ARCH (GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) #elif(defined(GLM_FORCE_SSE3)) # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2) #elif(defined(GLM_FORCE_SSE2)) @@ -572,17 +569,22 @@ # elif _M_IX86_FP == 2 # define GLM_ARCH (GLM_ARCH_SSE2) # else -# define GLM_ARCH GLM_ARCH_PURE +# define GLM_ARCH (GLM_ARCH_PURE) # endif #elif((GLM_PLATFORM & GLM_PLATFORM_APPLE) && (GLM_COMPILER & GLM_COMPILER_GCC)) # define GLM_ARCH GLM_ARCH_PURE #elif(((GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__))) || (GLM_COMPILER & GLM_COMPILER_LLVM_GCC)) -# define GLM_ARCH (GLM_ARCH_PURE \ -| (defined(__AVX2__) ? GLM_ARCH_AVX2 : 0) \ -| (defined(__AVX__) ? GLM_ARCH_AVX : 0) \ -| (defined(__SSE4__) ? GLM_ARCH_SSE4 : 0) \ -| (defined(__SSE3__) ? GLM_ARCH_SSE3 : 0) \ -| (defined(__SSE2__) ? GLM_ARCH_SSE2 : 0)) +# if defined(__AVX2__) +# define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) +# elif defined(__AVX__) +# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) +# elif defined(__SSE3__) +# define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2) +# elif defined(__SSE2__) +# define GLM_ARCH (GLM_ARCH_SSE2) +# else +# define GLM_ARCH (GLM_ARCH_PURE) +# endif #else # define GLM_ARCH GLM_ARCH_PURE #endif From 13920db617787da79525f095a32de9b3a5901aad Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 14 Feb 2014 01:37:35 +0100 Subject: [PATCH 2/2] Fixed instruction set detection with GCC --- glm/detail/setup.hpp | 2 +- readme.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index a0286018..958a323c 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -38,7 +38,7 @@ #define GLM_VERSION_MAJOR 0 #define GLM_VERSION_MINOR 9 #define GLM_VERSION_PATCH 5 -#define GLM_VERSION_REVISION 2 +#define GLM_VERSION_REVISION 3 /////////////////////////////////////////////////////////////////////////////////////////////////// // Platform diff --git a/readme.txt b/readme.txt index 12a397ec..6656ad32 100644 --- a/readme.txt +++ b/readme.txt @@ -41,6 +41,7 @@ GLM 0.9.5.3: 2014-0X-XX -------------------------------------------------------------------------------- - Added instruction set auto detection with Visual C++ using _M_IX86_FP - /arch compiler argument. +- Fixed GCC instruction set detection. ================================================================================ GLM 0.9.5.2: 2014-02-08