[Bf-blender-cvs] [65b375e] master: Cycles: Move non-vectorized bitscan() to util
Sergey Sharybin
noreply at git.blender.org
Thu Mar 31 10:23:23 CEST 2016
Commit: 65b375e798f9b6f48acf1e1bd14801d357a5b9da
Author: Sergey Sharybin
Date: Sun Feb 21 15:13:09 2016 +0100
Branches: master
https://developer.blender.org/rB65b375e798f9b6f48acf1e1bd14801d357a5b9da
Cycles: Move non-vectorized bitscan() to util
This way we can use bitscan() from both vectorized and non-vectorized
code, which applies to both kernel and host code.
===================================================================
M intern/cycles/bvh/bvh_build.cpp
M intern/cycles/util/util_simd.h
===================================================================
diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp
index a8b9fe0..84d036b 100644
--- a/intern/cycles/bvh/bvh_build.cpp
+++ b/intern/cycles/bvh/bvh_build.cpp
@@ -34,21 +34,6 @@
CCL_NAMESPACE_BEGIN
-#if !defined(__KERNEL_SSE2__)
-/* TODO(sergey): Move to some generic header so all code
- * can use bitscan on non-SSE processors.
- */
-ccl_device_inline int bitscan(int value)
-{
- assert(value != 0);
- int bit = 0;
- while(value >>= 1) {
- ++bit;
- }
- return bit;
-}
-#endif
-
/* BVH Build Task */
class BVHBuildTask : public Task {
diff --git a/intern/cycles/util/util_simd.h b/intern/cycles/util/util_simd.h
index a1c35b7..36da155 100644
--- a/intern/cycles/util/util_simd.h
+++ b/intern/cycles/util/util_simd.h
@@ -430,6 +430,23 @@ __forceinline __int64 _mm_extract_epi64( __m128i input, const int index ) {
#endif
+#else /* __KERNEL_SSE2__ */
+
+/* This section is for utility functions which operates on non-register data
+ * which might be used from a non-vectorized code.
+ */
+
+ccl_device_inline int bitscan(int value)
+{
+ assert(value != 0);
+ int bit = 0;
+ while(value >>= 1) {
+ ++bit;
+ }
+ return bit;
+}
+
+
#endif /* __KERNEL_SSE2__ */
CCL_NAMESPACE_END
More information about the Bf-blender-cvs
mailing list