Cycles: Slight modification to the previous commit

This way util_simd.cpp would not require modifications
if/when SSE2 is suddenly supported on 32bit platforms.

This also allowed to unleash some issues with util_simd.h
related on the fact that there size_t and int are actually
the same types.
This commit is contained in:
Sergey Sharybin 2014-06-17 01:00:43 +06:00
parent 2f527a88b6
commit 3144ae2c34
2 changed files with 9 additions and 6 deletions

View File

@ -15,15 +15,13 @@
* limitations under the License
*/
/* SSE optimization disabled for now on 32 bit, see bug #36316 */
#if !(defined(__GNUC__) && (defined(i386) || defined(_M_IX86)))
#ifdef WITH_KERNEL_SSE2
#define __KERNEL_SSE2__
#include "util_simd.h"
CCL_NAMESPACE_BEGIN
#ifdef WITH_KERNEL_SSE2
const __m128 _mm_lookupmask_ps[16] = {
_mm_castsi128_ps(_mm_set_epi32( 0, 0, 0, 0)),
_mm_castsi128_ps(_mm_set_epi32( 0, 0, 0,-1)),
@ -43,8 +41,7 @@ const __m128 _mm_lookupmask_ps[16] = {
_mm_castsi128_ps(_mm_set_epi32(-1,-1,-1,-1))
};
#endif // WITH_KERNEL_SSE2
CCL_NAMESPACE_END
#endif
#endif // WITH_KERNEL_SSE2

View File

@ -225,9 +225,11 @@ __forceinline int __btr(int v, int i) {
int r = 0; asm ("btr %1,%0" : "=r"(r) : "r"(i), "0"(v) : "flags"); return r;
}
#if defined(__KERNEL_64_BIT__)
__forceinline size_t __bsf(size_t v) {
size_t r = 0; asm ("bsf %1,%0" : "=r"(r) : "r"(v)); return r;
}
#endif
__forceinline unsigned int __bsf(unsigned int v) {
unsigned int r = 0; asm ("bsf %1,%0" : "=r"(r) : "r"(v)); return r;
@ -265,6 +267,7 @@ __forceinline unsigned int bitscan(unsigned int v) {
#endif
}
#if defined(__KERNEL_64_BIT__)
__forceinline size_t bitscan(size_t v) {
#if defined(__KERNEL_AVX2__)
#if defined(__KERNEL_64_BIT__)
@ -276,6 +279,7 @@ __forceinline size_t bitscan(size_t v) {
return __bsf(v);
#endif
}
#endif
__forceinline int clz(const int x)
{
@ -305,6 +309,7 @@ __forceinline unsigned int __bscf(unsigned int& v)
return i;
}
#if defined(__KERNEL_64_BIT__)
__forceinline size_t __bscf(size_t& v)
{
size_t i = bitscan(v);
@ -315,6 +320,7 @@ __forceinline size_t __bscf(size_t& v)
#endif
return i;
}
#endif
#endif /* _WIN32 */