This commit replaces the inline assembler code (for x86 platforms) and loop (for non-x86 platforms) in RADEONLog2 with a one-liner version based on clz (count leading zeroes). --- src/radeon.h | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/radeon.h b/src/radeon.h index 5797bed..23ecfeb 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -935,18 +935,7 @@ enum { static __inline__ int RADEONLog2(int val) { - int bits; -#if (defined __i386__ || defined __x86_64__) && (defined __GNUC__) - __asm volatile("bsrl %1, %0" - : "=r" (bits) - : "c" (val) - ); - return bits; -#else - for (bits = 0; val != 0; val >>= 1, ++bits) - ; - return bits - 1; -#endif + return (31 - __builtin_clz(val)); } #define RADEON_TILING_MASK 0xff -- 1.7.9.5 -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Calculate-log-base-2-in-radeon.h-based-on-clz-for-al.patch Type: text/x-patch Size: 1026 bytes Desc: not available URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20161202/1263cc10/attachment.bin>