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
path: root/intern
diff options
context:
space:
mode:
authorSergey Sharybin <sergey@blender.org>2022-02-09 12:44:03 +0300
committerSergey Sharybin <sergey@blender.org>2022-02-11 17:27:29 +0300
commit9ac1735205632589b49d87b6fb6c376dc603955b (patch)
tree1ee63d3099edff337b5e2eec4304c71e2f02f121 /intern
parent6ec83afb1db8a67d2a03931bfb7407c7e253718f (diff)
Fix Cycles compilation on 32bit ARM platform
The rbit instruction is only available starting with ARMv6T2 and the register prefix is different from what AARCH64 uses. Separate the 32 and 64 bit ARM branches, add missing ISA checks. Made sure the code works as intended on macMini with Apple silicon, and on Raspberry Pi 4 B running 32bit Raspbian OS. Differential Revision: https://developer.blender.org/D14056
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/util/math.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/intern/cycles/util/math.h b/intern/cycles/util/math.h
index 2bfd4ba19b6..5f047f6f3f4 100644
--- a/intern/cycles/util/math.h
+++ b/intern/cycles/util/math.h
@@ -935,9 +935,15 @@ 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(__arm__) || defined(__aarch64__)
+#if 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;
+#elif defined(__arm__) && ((__ARM_ARCH > 7) || __ARM_ARCH == 6 && __ARM_ARCH_ISA_THUMB >= 2)
+ /* This ARM instruction is available in ARMv6T2 and above.
+ * 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__)