Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/util/math.h')
-rw-r--r--intern/cycles/util/math.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/intern/cycles/util/math.h b/intern/cycles/util/math.h
index 2631304c84b..f6400cb879f 100644
--- a/intern/cycles/util/math.h
+++ b/intern/cycles/util/math.h
@@ -953,7 +953,11 @@ ccl_device_inline uint prev_power_of_two(uint x)
ccl_device_inline uint32_t reverse_integer_bits(uint32_t x)
{
/* Use a native instruction if it exists. */
-#if defined(__aarch64__) || defined(_M_ARM64)
+#if defined(__KERNEL_CUDA__)
+ return __brev(x);
+#elif defined(__KERNEL_METAL__)
+ return reverse_bits(x);
+#elif defined(__aarch64__) || defined(_M_ARM64)
/* Assume the rbit is always available on 64bit ARM architecture. */
__asm__("rbit %w0, %w1" : "=r"(x) : "r"(x));
return x;
@@ -962,10 +966,6 @@ ccl_device_inline uint32_t reverse_integer_bits(uint32_t x)
* This 32-bit Thumb instruction is available in ARMv6T2 and above. */
__asm__("rbit %0, %1" : "=r"(x) : "r"(x));
return x;
-#elif defined(__KERNEL_CUDA__)
- return __brev(x);
-#elif defined(__KERNEL_METAL__)
- return reverse_bits(x);
#elif __has_builtin(__builtin_bitreverse32)
return __builtin_bitreverse32(x);
#else