Updated architechture detection and checking

This commit is contained in:
Christophe Riccio 2011-01-20 14:06:56 +00:00
parent 53b7a7c64b
commit dc979ddfaf
3 changed files with 31 additions and 27 deletions

View File

@ -16,6 +16,11 @@
// Dependency: // Dependency:
#include "../glm.hpp" #include "../glm.hpp"
#if(!(GLM_ARCH & GLM_ARCH_SSE2))
#error "GLM: GLM_GTX_simd_mat4 requires compiler support of SSE2 through intrinsics"
#endif
#include "../core/intrinsic_matrix.hpp" #include "../core/intrinsic_matrix.hpp"
#include "../gtx/simd_vec4.hpp" #include "../gtx/simd_vec4.hpp"

View File

@ -16,6 +16,11 @@
// Dependency: // Dependency:
#include "../glm.hpp" #include "../glm.hpp"
#if(!(GLM_ARCH & GLM_ARCH_SSE2))
#error "GLM: GLM_GTX_simd_vec4 requires compiler support of SSE2 through intrinsics"
#endif
#include "../core/intrinsic_common.hpp" #include "../core/intrinsic_common.hpp"
#include "../core/intrinsic_geometric.hpp" #include "../core/intrinsic_geometric.hpp"

View File

@ -254,54 +254,48 @@
///////////////// /////////////////
// Platform // Platform
#define GLM_SUPPORT_PURE 0 #define GLM_ARCH_PURE 0x0000
#define GLM_SUPPORT_SSE2 1 #define GLM_ARCH_SSE2 0x0001
#define GLM_SUPPORT_SSE3 2 #define GLM_ARCH_SSE3 0x0002 | GLM_ARCH_SSE2
#define GLM_SUPPORT_AVX 3 #define GLM_ARCH_AVX 0x0004 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2
#if((GLM_COMPILER & GLM_COMPILER_VC) && defined(_M_IX86)) #if((GLM_COMPILER & GLM_COMPILER_VC) && defined(_M_IX86))
# if(GLM_COMPILER >= GLM_COMPILER_VC2010) # if(GLM_COMPILER >= GLM_COMPILER_VC2010)
# if(_M_IX86_FP == 3) //AVX # if(_M_IX86_FP == 3) //AVX
# define GLM_SUPPORT GLM_SUPPORT_AVX //GLM_SUPPORT_AVX (Require SP1) # define GLM_ARCH GLM_ARCH_AVX //GLM_ARCH_AVX (Require SP1)
# else # else
# define GLM_SUPPORT GLM_SUPPORT_SSE3 # define GLM_ARCH GLM_ARCH_SSE3
# endif # endif
# elif(GLM_COMPILER >= GLM_COMPILER_VC2008) # elif(GLM_COMPILER >= GLM_COMPILER_VC2008)
# define GLM_SUPPORT GLM_SUPPORT_SSE3 # define GLM_ARCH GLM_ARCH_SSE3
# elif(GLM_COMPILER >= GLM_COMPILER_VC2005) # elif(GLM_COMPILER >= GLM_COMPILER_VC2005)
# define GLM_SUPPORT GLM_SUPPORT_SSE2 # define GLM_ARCH GLM_ARCH_SSE2
# else # else
# define GLM_SUPPORT GLM_SUPPORT_PURE # define GLM_ARCH GLM_ARCH_PURE
# endif # endif
#elif((GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__))) #elif((GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__)))
# if(GLM_COMPILER >= GLM_COMPILER_GCC44) # if(GLM_COMPILER >= GLM_COMPILER_GCC44)
# define GLM_SUPPORT GLM_SUPPORT_AVX # define GLM_ARCH GLM_ARCH_AVX
# elif(GLM_COMPILER >= GLM_COMPILER_GCC40) # elif(GLM_COMPILER >= GLM_COMPILER_GCC40)
# define GLM_SUPPORT GLM_SUPPORT_SSE3 # define GLM_ARCH GLM_ARCH_SSE3
# else # else
# define GLM_SUPPORT GLM_SUPPORT_PURE # define GLM_ARCH GLM_ARCH_PURE
# endif # endif
#else #else
# define GLM_SUPPORT GLM_SUPPORT_PURE # define GLM_ARCH GLM_ARCH_PURE
#endif #endif
#define GLM_ARCH_PURE 0 #if(GLM_ARCH != GLM_ARCH_PURE)
#define GLM_ARCH_SSE2 1 #if(GLM_ARCH & GLM_ARCH_AVX)
#define GLM_ARCH_SSE3 2
#define GLM_ARCH_AVX 3
#if(GLM_SUPPORT == GLM_SUPPORT_AVX)
# include <immintrin.h> # include <immintrin.h>
# define GLM_ARCH GLM_ARCH_AVX #endif//GLM_ARCH
#elif(GLM_SUPPORT == GLM_SUPPORT_SSE3) #if(GLM_ARCH & GLM_ARCH_SSE3)
# include <pmmintrin.h> # include <pmmintrin.h>
# define GLM_ARCH GLM_ARCH_SSE3 #endif//GLM_ARCH
#elif((GLM_SUPPORT == GLM_SUPPORT_SSE2) || (GLM_MODEL == GLM_MODEL_64)) #if(GLM_ARCH & GLM_ARCH_SSE2)
# include <emmintrin.h> # include <emmintrin.h>
# define GLM_ARCH GLM_ARCH_SSE2 #endif//GLM_ARCH
#else #endif//(GLM_ARCH != GLM_ARCH_PURE)
# define GLM_ARCH GLM_ARCH_PURE
#endif//GLM_SUPPORT
#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_ARCH_DISPLAYED)) #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_ARCH_DISPLAYED))
# define GLM_MESSAGE_ARCH_DISPLAYED # define GLM_MESSAGE_ARCH_DISPLAYED