[PATCH] D13694: Define __builtin_clzll for x86 on MSVC
angelsl via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 13 04:24:06 PDT 2015
angelsl created this revision.
angelsl added a reviewer: compnerd.
angelsl added subscribers: compnerd, llvm-commits.
http://reviews.llvm.org/D13694
Files:
lib/builtins/int_lib.h
Index: lib/builtins/int_lib.h
===================================================================
--- lib/builtins/int_lib.h
+++ lib/builtins/int_lib.h
@@ -115,9 +115,18 @@
return 63 - leading_zero;
return 64;
}
-
-#define __builtin_clzl __builtin_clzll
-#endif
+#else
+uint32_t __inline __builtin_clzll(uint64_t value) {
+ if (value == 0)
+ return 64;
+ uint32_t msh = (uint32_t)(value >> 32);
+ uint32_t lsh = (uint32_t)(value & 0xFFFFFFFF);
+ if (msh != 0)
+ return __builtin_clz(msh);
+ return 32 + __builtin_clz(lsh);
+}
#endif
+#define __builtin_clzl __builtin_clzll
+#endif // defined(_MSC_VER) && !defined(__clang__)
#endif /* INT_LIB_H */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13694.37234.patch
Type: text/x-patch
Size: 672 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151013/698241e4/attachment.bin>
More information about the llvm-commits
mailing list