Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/util/math.h
| Context not available. | |||||
| ccl_device_inline uint32_t reverse_integer_bits(uint32_t x) | ccl_device_inline uint32_t reverse_integer_bits(uint32_t x) | ||||
| { | { | ||||
| /* Use a native instruction if it exists. */ | /* 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. */ | /* Assume the rbit is always available on 64bit ARM architecture. */ | ||||
| __asm__("rbit %w0, %w1" : "=r"(x) : "r"(x)); | __asm__("rbit %w0, %w1" : "=r"(x) : "r"(x)); | ||||
| return x; | return x; | ||||
| Context not available. | |||||
| * This 32-bit Thumb 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)); | __asm__("rbit %0, %1" : "=r"(x) : "r"(x)); | ||||
| return x; | return x; | ||||
| #elif defined(__KERNEL_CUDA__) | |||||
| return __brev(x); | |||||
| #elif defined(__KERNEL_METAL__) | |||||
| return reverse_bits(x); | |||||
| #elif __has_builtin(__builtin_bitreverse32) | #elif __has_builtin(__builtin_bitreverse32) | ||||
| return __builtin_bitreverse32(x); | return __builtin_bitreverse32(x); | ||||
| #else | #else | ||||
| Context not available. | |||||