From 1bbc2935a2a1d7dd6999b84089e47945c36521a1 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 30 May 2016 14:39:43 +0200 Subject: [PATCH] Added AVX bitCount optimization --- glm/detail/func_integer_simd.inl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/glm/detail/func_integer_simd.inl b/glm/detail/func_integer_simd.inl index bf393056..fe3a37df 100644 --- a/glm/detail/func_integer_simd.inl +++ b/glm/detail/func_integer_simd.inl @@ -1,9 +1,30 @@ /// @ref core /// @file glm/detail/func_integer_simd.inl +#include "../simd/integer.h" + +#if GLM_ARCH & GLM_ARCH_SSE2_BIT + namespace glm{ namespace detail { }//namespace detail + +# if GLM_ARCH & GLM_ARCH_AVX_BIT + template <> + GLM_FUNC_QUALIFIER int bitCount(uint32 x) + { + return _mm_popcnt_u32(x); + } + + template <> + GLM_FUNC_QUALIFIER int bitCount(uint64 x) + { + return _mm_popcnt_u64(x); + } +# endif + }//namespace glm + +#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT