[Bf-blender-cvs] [3144ae2] master: Cycles: Slight modification to the previous commit

Sergey Sharybin noreply at git.blender.org
Mon Jun 16 21:02:48 CEST 2014


Commit: 3144ae2c341e06307e4ecab83e9c7bed7a061d37
Author: Sergey Sharybin
Date:   Tue Jun 17 01:00:43 2014 +0600
https://developer.blender.org/rB3144ae2c341e06307e4ecab83e9c7bed7a061d37

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.

===================================================================

M	intern/cycles/util/util_simd.cpp
M	intern/cycles/util/util_simd.h

===================================================================

diff --git a/intern/cycles/util/util_simd.cpp b/intern/cycles/util/util_simd.cpp
index 8f5e78d..0436823 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 b6d8f3d..9b86e8b 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 */




More information about the Bf-blender-cvs mailing list