diff options
author | Tom Rondeau <trondeau@vt.edu> | 2010-12-17 22:58:40 -0600 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2010-12-17 22:58:40 -0600 |
commit | ed78ba5d9999bbe50507373a1aa2877ef0da64c6 (patch) | |
tree | 92ac6dcae30adbdbf3617402352dc78ebf048f30 /volk/include | |
parent | a89f5dd45263209c535c272b56abb99133a4d6c7 (diff) |
volk: Fix for popcnt's 64/32-bit issues.
Diffstat (limited to 'volk/include')
-rw-r--r-- | volk/include/volk/volk_64u_popcnt_aligned16.h | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/volk/include/volk/volk_64u_popcnt_aligned16.h b/volk/include/volk/volk_64u_popcnt_aligned16.h index e8e1396e7c..4d62f93754 100644 --- a/volk/include/volk/volk_64u_popcnt_aligned16.h +++ b/volk/include/volk/volk_64u_popcnt_aligned16.h @@ -36,37 +36,13 @@ static inline void volk_64u_popcnt_aligned16_generic(uint64_t* ret, const uint64 #endif /*LV_HAVE_GENERIC*/ -#if LV_HAVE_SSE4_2 +#if LV_HAVE_SSE4_2 && LV_HAVE_64 #include <nmmintrin.h> static inline void volk_64u_popcnt_aligned16_sse4_2(uint64_t* ret, const uint64_t value) { -#if LV_64 *ret = _mm_popcnt_u64(value); -#else - const uint32_t* valueVector = (const uint32_t*)&value; - - // This is faster than a lookup table - uint32_t retVal = valueVector[0]; - - retVal = (retVal & 0x55555555) + (retVal >> 1 & 0x55555555); - retVal = (retVal & 0x33333333) + (retVal >> 2 & 0x33333333); - retVal = (retVal + (retVal >> 4)) & 0x0F0F0F0F; - retVal = (retVal + (retVal >> 8)); - retVal = (retVal + (retVal >> 16)) & 0x0000003F; - uint64_t retVal64 = retVal; - - retVal = valueVector[1]; - retVal = (retVal & 0x55555555) + (retVal >> 1 & 0x55555555); - retVal = (retVal & 0x33333333) + (retVal >> 2 & 0x33333333); - retVal = (retVal + (retVal >> 4)) & 0x0F0F0F0F; - retVal = (retVal + (retVal >> 8)); - retVal = (retVal + (retVal >> 16)) & 0x0000003F; - retVal64 += retVal; - - *ret = retVal64; -#endif } #endif /*LV_HAVE_SSE4_2*/ |