From d7755485c8842715922268af0117e9379369f1bf Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 10 Jan 2011 20:10:35 +0000 Subject: [PATCH] Updated SSE setup --- glm/core/intrinsic_common.hpp | 7 +++---- glm/gtx/simd_vec4.hpp | 4 ++++ glm/gtx/simd_vec4.inl | 21 +++++++++++++++++++-- glm/setup.hpp | 14 +++++++++++--- 4 files changed, 37 insertions(+), 9 deletions(-) diff --git a/glm/core/intrinsic_common.hpp b/glm/core/intrinsic_common.hpp index efeee071..8e7c9562 100644 --- a/glm/core/intrinsic_common.hpp +++ b/glm/core/intrinsic_common.hpp @@ -12,11 +12,10 @@ #include "../setup.hpp" -#if(GLM_ARCH != GLM_ARCH_PURE) +#if(GLM_ARCH >= GLM_ARCH_SSE2) namespace glm{ -namespace detail -{ +namespace detail{ __m128 sse_abs_ps(__m128 x); __m128 sse_sgn_ps(__m128 x); @@ -62,5 +61,5 @@ namespace detail #include "intrinsic_common.inl" -#endif//(GLM_ARCH != GLM_ARCH_PURE) +#endif//(GLM_ARCH >= GLM_ARCH_SSE2) #endif//glm_detail_intrinsic_common diff --git a/glm/gtx/simd_vec4.hpp b/glm/gtx/simd_vec4.hpp index f042c1e4..795a9598 100644 --- a/glm/gtx/simd_vec4.hpp +++ b/glm/gtx/simd_vec4.hpp @@ -110,6 +110,10 @@ namespace glm { typedef detail::fvec4SIMD simd_vec4; + detail::fvec4SIMD cross( + detail::fvec4SIMD const & a, + detail::fvec4SIMD const & b); + }//namespace simd_vec4 }//namespace gtx }//namespace glm diff --git a/glm/gtx/simd_vec4.inl b/glm/gtx/simd_vec4.inl index 87702ff2..8011ab78 100644 --- a/glm/gtx/simd_vec4.inl +++ b/glm/gtx/simd_vec4.inl @@ -266,8 +266,25 @@ namespace glm namespace gtx{ namespace simd_vec4 { - - +# if(GLM_INSTRUCTION_SET & GLM_INSTRUCTION_SET_SSE) + inline detail::fvec4SIMD cross + ( + detail::fvec4SIMD const & a, + detail::fvec4SIMD const & b + ) + { + return _mm_xpd_ps(a.Data, b.Data); + } +# else//(GLM_INSTRUCTION_SET & GLM_INSTRUCTION_SET_PURE) + inline detail::fvec4SIMD cross + ( + detail::fvec4SIMD const & a, + detail::fvec4SIMD const & b + ) + { + return glm::cross(a, b); + } +# endif }//namespace simd_vec4 }//namespace gtx }//namespace glm diff --git a/glm/setup.hpp b/glm/setup.hpp index e2ba5cf1..4a0c3daa 100644 --- a/glm/setup.hpp +++ b/glm/setup.hpp @@ -241,10 +241,18 @@ #if(defined(GLM_COMPILER) && (GLM_COMPILER & GLM_COMPILER_GCC)) # define GLM_INSTRUCTION_SET GLM_INSTRUCTION_SET_NULL #elif(defined(GLM_COMPILER) && (GLM_COMPILER & GLM_COMPILER_VC)) -# ifdef _M_CEE_PURE -# define GLM_INSTRUCTION_SET GLM_INSTRUCTION_SET_PURE +# if(GLM_MODEL == GLM_MODEL_64) +# ifdef _M_CEE_PURE +# define GLM_INSTRUCTION_SET GLM_INSTRUCTION_SET_PURE +# else +# define GLM_INSTRUCTION_SET GLM_INSTRUCTION_SET_MMX | GLM_INSTRUCTION_SET_SSE +# endif # else -# define GLM_INSTRUCTION_SET GLM_INSTRUCTION_SET_NULL +# ifdef _M_CEE_PURE +# define GLM_INSTRUCTION_SET GLM_INSTRUCTION_SET_PURE +# else +# define GLM_INSTRUCTION_SET GLM_INSTRUCTION_SET_NULL +# endif # endif #else # define GLM_INSTRUCTION_SET GLM_INSTRUCTION_SET_PURE