[PATCH] D13414: Define GNU clz builtins equivalents for MSVC

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 4 11:33:43 PDT 2015


compnerd added a comment.

Why is it insufficient to do this?

  #if defined(_MSC_VER) && !defined(__clang__)
  #define __builtin_clz __builtin_clzl
  #define __builtin_ctz __builtin_ctzl
  #define __builtin_clzl __builtin_ctzll
  #endif

I don't understand the definition of `__builtin_clzll`.  `_BitScanReverse64` it is implemented in terms of `__builtin_clzll` for clang.


================
Comment at: lib/builtins/int_lib.h:82
@@ +81,3 @@
+/* Definitions for builtins unavailable on MSVC */
+#ifdef _MSC_VER
+#include <intrin.h>
----------------
This should be:

    #if defined(_MSC_VER) && !defined(__clang__)


http://reviews.llvm.org/D13414





More information about the llvm-commits mailing list