summaryrefslogtreecommitdiff
path: root/longlong.h
diff options
context:
space:
mode:
authorTorbjorn Granlund <tg@gmplib.org>2016-12-26 17:26:25 +0100
committerTorbjorn Granlund <tg@gmplib.org>2016-12-26 17:26:25 +0100
commit91fc986db8c107842ecb50c5328dff971dd02c6c (patch)
tree519f0bb368cffc9751dfac2bef6a3ce7ca9737c8 /longlong.h
parentecc649755bb3f873f5c877f157ac0f3ca69f8579 (diff)
downloadgmp-91fc986db8c107842ecb50c5328dff971dd02c6c.tar.gz
(x86_64 umul_ppmm): Add mulx variant (not automatically used).
Diffstat (limited to 'longlong.h')
-rw-r--r--longlong.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/longlong.h b/longlong.h
index f2dbfc41c..c810fce2d 100644
--- a/longlong.h
+++ b/longlong.h
@@ -1016,10 +1016,17 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
: "=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) \