[Gmp-commit] /var/hg/gmp: (x86_64 umul_ppmm): Add mulx variant (not automatic...

mercurial at gmplib.org mercurial at gmplib.org
Mon Dec 26 17:04:12 UTC 2016


details:   /var/hg/gmp/rev/39a04e4e90b0
changeset: 17167:39a04e4e90b0
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Mon Dec 26 17:26:25 2016 +0100
description:
(x86_64 umul_ppmm): Add mulx variant (not automatically used).

diffstat:

 longlong.h |  9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diffs (22 lines):

diff -r 1cdb2f2d864b -r 39a04e4e90b0 longlong.h
--- a/longlong.h	Sun Dec 18 09:19:44 2016 +0100
+++ b/longlong.h	Mon Dec 26 17:26:25 2016 +0100
@@ -1016,10 +1016,17 @@
 	   : "=r" (sh), "=&r" (sl)					\
 	   : "0" ((UDItype)(ah)), "rme" ((UDItype)(bh)),		\
 	     "1" ((UDItype)(al)), "rme" ((UDItype)(bl)))
+#if defined (HAVE_MULX)
 #define umul_ppmm(w1, w0, u, v) \
-  __asm__ ("mulq %3"							\
+  __asm__ ("mulx	%3, %0, %1"					\
+	   : "=r" (w0), "=r" (w1)					\
+	   : "%d" ((UDItype)(u)), "rm" ((UDItype)(v)))
+#else
+#define umul_ppmm(w1, w0, u, v) \
+  __asm__ ("mulq	%3"						\
 	   : "=a" (w0), "=d" (w1)					\
 	   : "%0" ((UDItype)(u)), "rm" ((UDItype)(v)))
+#endif
 #define udiv_qrnnd(q, r, n1, n0, dx) /* d renamed to dx avoiding "=d" */\
   __asm__ ("divq %4"		     /* stringification in K&R C */	\
 	   : "=a" (q), "=d" (r)						\


More information about the gmp-commit mailing list