From ae8e3cfbca31cddac5a891b1d5606399dd4fefe0 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Tue, 6 Aug 2013 19:45:27 +0000 Subject: [PATCH] Use gnu style builtins in MathExtras.h with clang on Windows Clang does not provide BitScan* intrinsic implementations yet. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187813 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/MathExtras.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/llvm/Support/MathExtras.h b/include/llvm/Support/MathExtras.h index 7742e32737a..00c6ad70d43 100644 --- a/include/llvm/Support/MathExtras.h +++ b/include/llvm/Support/MathExtras.h @@ -80,7 +80,7 @@ inline std::size_t countTrailingZeros(uint32_t Val, ZeroBehavior ZB) { if (ZB != ZB_Undefined && Val == 0) return 32; -#if __GNUC__ >= 4 +#if __has_builtin(__builtin_ctz) || __GNUC_PREREQ(4, 0) return __builtin_ctz(Val); #elif _MSC_VER unsigned long Index; @@ -95,7 +95,7 @@ inline std::size_t countTrailingZeros(uint64_t Val, ZeroBehavior ZB) { if (ZB != ZB_Undefined && Val == 0) return 64; -#if __GNUC__ >= 4 +#if __has_builtin(__builtin_ctzll) || __GNUC_PREREQ(4, 0) return __builtin_ctzll(Val); #elif _MSC_VER unsigned long Index; @@ -146,7 +146,7 @@ inline std::size_t countLeadingZeros(uint32_t Val, ZeroBehavior ZB) { if (ZB != ZB_Undefined && Val == 0) return 32; -#if __GNUC__ >= 4 +#if __has_builtin(__builtin_clz) || __GNUC_PREREQ(4, 0) return __builtin_clz(Val); #elif _MSC_VER unsigned long Index; @@ -161,7 +161,7 @@ inline std::size_t countLeadingZeros(uint64_t Val, ZeroBehavior ZB) { if (ZB != ZB_Undefined && Val == 0) return 64; -#if __GNUC__ >= 4 +#if __has_builtin(__builtin_clzll) || __GNUC_PREREQ(4, 0) return __builtin_clzll(Val); #elif _MSC_VER unsigned long Index;