[Gmp-commit] /var/hg/gmp: On arm64, use __builtin_c[lt]zl, fix typo in umul_p...

mercurial at gmplib.org mercurial at gmplib.org
Wed Sep 24 17:40:44 UTC 2014


details:   /var/hg/gmp/rev/0a45369a0c1b
changeset: 16497:0a45369a0c1b
user:      Marc Glisse <marc.glisse at inria.fr>
date:      Wed Sep 24 19:40:36 2014 +0200
description:
On arm64, use __builtin_c[lt]zl, fix typo in umul_ppmm.

diffstat:

 ChangeLog  |  6 ++++++
 longlong.h |  8 +++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

diffs (33 lines):

diff -r bc6d13bef980 -r 0a45369a0c1b ChangeLog
--- a/ChangeLog	Mon Sep 22 22:09:03 2014 +0200
+++ b/ChangeLog	Wed Sep 24 19:40:36 2014 +0200
@@ -1,3 +1,9 @@
+2014-09-24  Marc Glisse  <marc.glisse at inria.fr>
+
+	* longlong.h (arm64 count_trailing_zeros, count_leading_zeros): Use
+	gcc's builtins.
+	(arm64 umul_ppmm): Use macro arguments only once.
+
 2014-09-22  Marc Glisse  <marc.glisse at inria.fr>
 
 	* mpn/arm64/lshift.asm: Avoid negative immediates.
diff -r bc6d13bef980 -r 0a45369a0c1b longlong.h
--- a/longlong.h	Mon Sep 22 22:09:03 2014 +0200
+++ b/longlong.h	Wed Sep 24 19:40:36 2014 +0200
@@ -556,13 +556,11 @@
 #define umul_ppmm(ph, pl, m0, m1) \
   do {									\
     UDItype __m0 = (m0), __m1 = (m1);					\
-    __asm__ ("umulh\t%0, %1, %2" : "=r" (ph) : "r" (m0), "r" (m1));	\
+    __asm__ ("umulh\t%0, %1, %2" : "=r" (ph) : "r" (__m0), "r" (__m1));	\
     (pl) = __m0 * __m1;							\
   } while (0)
-#define count_leading_zeros(count, x) \
-  __asm__ ("clz\t%0, %1" : "=r" (count) : "r" (x))
-#define count_trailing_zeros(count, x) \
-  __asm__ ("rbit\t%0, %1\n\tclz\t%0, %0" : "=r" (count) : "r" (x))
+#define count_leading_zeros(count, x)  count_leading_zeros_gcc_clz(count, x)
+#define count_trailing_zeros(count, x)  count_trailing_zeros_gcc_ctz(count, x)
 #define COUNT_LEADING_ZEROS_0 64
 #endif /* __aarch64__ */
 


More information about the gmp-commit mailing list