On 01/06/2015 08:51 AM, Paul Eggert wrote:
-# pragma intrinsic _BitReverse
-# pragma intrinsic _BitReverse64
+# pragma intrinsic _BitScanReverse
+# pragma intrinsic _BitScanReverse64


Come to think of it, now that this typo is fixed, we should be able to revert the "avoid 64-bit intrinsics on 32-bit Windows" patch, right? That patch added complexity that I'd rather avoid. I think the previous diagnosis that the intrinsic is missing on 32-bit Windows is incorrect.

If we really need something like that patch, let's put it into the "#elif _MSC_VER" section so that it's more easily separable from the mainline code. For now I reverted it by using the attached.
>From cf36174c00c72af596d4f6166a16f42d7b6a5a79 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Tue, 6 Jan 2015 09:05:22 -0800
Subject: [PATCH] count-leading-zeros: use 64-bit intrinsics on 32-bit Windows

This reverts the last patch but one, as it shouldn't be needed now
that the typo is fixed.
* lib/count-leading-zeros.h (count_leading_zeros_ll):
* lib/count-trailing-zeros.h:
* lib/count-one-bits.h:
Go back to using 64-bit intrinsics.
---
 ChangeLog                  | 8 ++++++++
 lib/count-leading-zeros.h  | 5 -----
 lib/count-one-bits.h       | 4 ----
 lib/count-trailing-zeros.h | 5 -----
 4 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 79370de..79787f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2015-01-06  Paul Eggert  <egg...@cs.ucla.edu>
 
+	count-leading-zeros: use 64-bit intrinsics on 32-bit Windows
+	This reverts the last patch but one, as it shouldn't be needed now
+	that the typo is fixed.
+	* lib/count-leading-zeros.h (count_leading_zeros_ll):
+	* lib/count-trailing-zeros.h:
+	* lib/count-one-bits.h:
+	Go back to using 64-bit intrinsics.
+
 	count-leading-zeros: fix pragma typos
 	* lib/count-leading-zeros.h (_BitScanReverse, _BitScanReverse64):
 	Fix typos in declaration of intrinsics when _MSC_VER.
diff --git a/lib/count-leading-zeros.h b/lib/count-leading-zeros.h
index 166309a..5904eb7 100644
--- a/lib/count-leading-zeros.h
+++ b/lib/count-leading-zeros.h
@@ -104,13 +104,8 @@ count_leading_zeros_l (unsigned long int x)
 COUNT_LEADING_ZEROS_INLINE int
 count_leading_zeros_ll (unsigned long long int x)
 {
-# if _MSC_VER && ! defined _M_X64
-  int count = count_leading_zeros (x >> 31 >> 1);
-  return count < 32 ? count : 32 + count_leading_zeros (x);
-# else
   COUNT_LEADING_ZEROS (__builtin_clzll, _BitScanReverse64,
                        unsigned long long int);
-# endif
 }
 #endif
 
diff --git a/lib/count-one-bits.h b/lib/count-one-bits.h
index bd79fc5..d54397f 100644
--- a/lib/count-one-bits.h
+++ b/lib/count-one-bits.h
@@ -127,11 +127,7 @@ count_one_bits_l (unsigned long int x)
 COUNT_ONE_BITS_INLINE int
 count_one_bits_ll (unsigned long long int x)
 {
-# if _MSC_VER && ! defined _M_X64
-  return count_one_bits (x >> 31 >> 1) + count_one_bits (x);
-# else
   COUNT_ONE_BITS (__builtin_popcountll, __popcnt64, unsigned long long int);
-# endif
 }
 #endif
 
diff --git a/lib/count-trailing-zeros.h b/lib/count-trailing-zeros.h
index 1e71977..83ce2fb 100644
--- a/lib/count-trailing-zeros.h
+++ b/lib/count-trailing-zeros.h
@@ -96,13 +96,8 @@ count_trailing_zeros_l (unsigned long int x)
 COUNT_TRAILING_ZEROS_INLINE int
 count_trailing_zeros_ll (unsigned long long int x)
 {
-# if _MSC_VER && ! defined _M_X64
-  int count = count_trailing_zeros (x);
-  return count < 32 ? count : 32 + count_trailing_zeros (x >> 31 >> 1);
-# else
   COUNT_TRAILING_ZEROS (__builtin_ctzll, _BitScanForward64,
                         unsigned long long int);
-# endif
 }
 #endif
 
-- 
2.1.0

Reply via email to