summaryrefslogtreecommitdiff
path: root/longlong.h
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2001-01-18 22:23:26 +0100
committerKevin Ryde <user42@zip.com.au>2001-01-18 22:23:26 +0100
commite92dae8cfb78de5a3ac49a8f2763f8540adbeff6 (patch)
tree9240fd7831c37ffd9057797cc274f705dbaa782c /longlong.h
parentcc46cc009fd37e3ed95409b4b635975a89806f6a (diff)
downloadgmp-e92dae8cfb78de5a3ac49a8f2763f8540adbeff6.tar.gz
(pentium count_trailing_zeros): Use count_leading_zeros.
Diffstat (limited to 'longlong.h')
-rw-r--r--longlong.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/longlong.h b/longlong.h
index 93f708d6a..a5a9b7d60 100644
--- a/longlong.h
+++ b/longlong.h
@@ -538,6 +538,11 @@ extern USItype __MPN(udiv_qrnnd) _PROTO ((USItype *, USItype, USItype, USItype))
#define COUNT_LEADING_ZEROS_NEED_CLZ_TAB
#define COUNT_LEADING_ZEROS_0 31 /* n==0 indistinguishable from n==1 */
+/* count_trailing_zeros for pentium is done by the generic code below using
+ count_leading_zeros. This should be a fixed 15 or 16 cycles, possibly
+ plus an L1 miss. P5 "bsfl" on the other hand takes between 18 and 42
+ depending where the least significant 1 bit is. */
+
#else
#define count_leading_zeros(count, x) \
do { \
@@ -546,13 +551,12 @@ extern USItype __MPN(udiv_qrnnd) _PROTO ((USItype *, USItype, USItype, USItype))
__asm__ ("bsrl %1,%0" : "=r" (__cbtmp) : "rm" ((USItype)(x))); \
(count) = __cbtmp ^ 31; \
} while (0)
-#endif
-
#define count_trailing_zeros(count, x) \
do { \
ASSERT ((x) != 0); \
__asm__ ("bsfl %1,%0" : "=r" (count) : "rm" ((USItype)(x))); \
} while (0)
+#endif
#ifndef UMUL_TIME
#define UMUL_TIME 10