diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-06-16 23:00:43 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-06-16 23:00:43 +0400 |
commit | 3144ae2c341e06307e4ecab83e9c7bed7a061d37 (patch) | |
tree | 94cfeff0500af6c0affaf9b8371ce336a9fe2717 /intern | |
parent | 2f527a88b66845a50f686ce255a02d5e04ef3937 (diff) |
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.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/util/util_simd.cpp | 9 | ||||
-rw-r--r-- | intern/cycles/util/util_simd.h | 6 |
2 files changed, 9 insertions, 6 deletions
diff --git a/intern/cycles/util/util_simd.cpp b/intern/cycles/util/util_simd.cpp index 8f5e78d9fbd..0436823e62a 100644 --- a/intern/cycles/util/util_simd.cpp +++ b/intern/cycles/util/util_simd.cpp @@ -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 diff --git a/intern/cycles/util/util_simd.h b/intern/cycles/util/util_simd.h index b6d8f3d25f0..9b86e8be72e 100644 --- a/intern/cycles/util/util_simd.h +++ b/intern/cycles/util/util_simd.h @@ -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 */ |