From b862cf0b9fc72a9f2b154bce0163558f577e3f58 Mon Sep 17 00:00:00 2001 From: Tianhao Chai Date: Fri, 29 Jul 2022 14:48:52 +0200 Subject: Fix Cycles build error with CUDA on arm64 Checking arm64 assembly support before CUDA/Metal would cause NVCC to generate inline arm64 assembly. Differential Revision: https://developer.blender.org/D15569 --- intern/cycles/util/math.h | 10 +++++----- 1 file 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 -- cgit v1.2.3