[Gmp-commit] /var/hg/gmp: 2 new changesets

mercurial at gmplib.org mercurial at gmplib.org
Fri Mar 10 17:52:57 UTC 2017


details:   /var/hg/gmp/rev/53a16d7f8d62
changeset: 17329:53a16d7f8d62
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Fri Mar 10 18:48:41 2017 +0100
description:
mpn/generic/div_qr_2.c (udiv_qr_4by2): Replace add_csaac with add_sssaaaa

details:   /var/hg/gmp/rev/dceb954ec962
changeset: 17330:dceb954ec962
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Fri Mar 10 18:52:49 2017 +0100
description:
Changelog

diffstat:

 ChangeLog              |   6 ++++++
 mpn/generic/div_qr_2.c |  34 +++++-----------------------------
 2 files changed, 11 insertions(+), 29 deletions(-)

diffs (78 lines):

diff -r 4d29c2332f7e -r dceb954ec962 ChangeLog
--- a/ChangeLog	Fri Mar 10 01:38:35 2017 +0100
+++ b/ChangeLog	Fri Mar 10 18:52:49 2017 +0100
@@ -1,3 +1,9 @@
+2017-03-08 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	* mpn/generic/sqrtrem.c: Direct use of sqrtrem2 when n==2.
+
+	* mpn/generic/div_qr_2.c (udiv_qr_4by2): Replace add_csaac with add_sssaaaa.
+
 2017-02-26 Marco Bodrato <bodrato at mail.dm.unipi.it>
 
 	* mpn/generic/pow_1.c: Use umul_ppmm for a single limb.
diff -r 4d29c2332f7e -r dceb954ec962 mpn/generic/div_qr_2.c
--- a/mpn/generic/div_qr_2.c	Fri Mar 10 01:38:35 2017 +0100
+++ b/mpn/generic/div_qr_2.c	Fri Mar 10 18:52:49 2017 +0100
@@ -63,11 +63,6 @@
 	   : "0"  ((USItype)(s2)),					\
 	     "1"  ((USItype)(a1)), "g" ((USItype)(b1)),			\
 	     "%2" ((USItype)(a0)), "g" ((USItype)(b0)))
-#define add_csaac(co, s, a, b, ci)					\
-  __asm__ ("bt\t$0, %2\n\tadc\t%5, %k1\n\tadc\t%k0, %k0"		\
-	   : "=r" (co), "=r" (s)					\
-	   : "rm"  ((USItype)(ci)), "0" (CNST_LIMB(0)),			\
-	     "%1" ((USItype)(a)), "g" ((USItype)(b)))
 #endif
 
 #if defined (__amd64__) && W_TYPE_SIZE == 64
@@ -77,11 +72,6 @@
 	   : "0"  ((UDItype)(s2)),					\
 	     "1"  ((UDItype)(a1)), "rme" ((UDItype)(b1)),		\
 	     "%2" ((UDItype)(a0)), "rme" ((UDItype)(b0)))
-#define add_csaac(co, s, a, b, ci)					\
-  __asm__ ("bt\t$0, %2\n\tadc\t%5, %q1\n\tadc\t%q0, %q0"		\
-	   : "=r" (co), "=r" (s)					\
-	   : "rm"  ((UDItype)(ci)), "0" (CNST_LIMB(0)),			\
-	     "%1" ((UDItype)(a)), "g" ((UDItype)(b)))
 #endif
 
 #if defined (__aarch64__) && W_TYPE_SIZE == 64
@@ -118,18 +108,6 @@
   } while (0)
 #endif
 
-#ifndef add_csaac
-#define add_csaac(co, s, a, b, ci)					\
-  do {									\
-    UWtype __s, __c;							\
-    __s = (a) + (b);							\
-    __c = __s < (a);							\
-    __s = __s + (ci);							\
-    (s) = __s;								\
-    (co) = __c + (__s < (ci));						\
-  } while (0)
-#endif
-
 /* Typically used with r1, r0 same as n3, n2. Other types of overlap
    between inputs and outputs are not supported. */
 #define udiv_qr_4by2(q1,q0, r1,r0, n3,n2,n1,n0, d1,d0, di1,di0)		\
@@ -145,13 +123,11 @@
     umul_ppmm (_q1d,_q0, n2, di0);					\
     add_sssaaaa (_q3,_q2,_q1, _q2,_q1, _q2a,_q1d);			\
 									\
-    add_ssaaaa (r1, r0, n3, n2, CNST_LIMB(0), CNST_LIMB(1));		\
-									\
-    /* [q3,q2,q1,q0] += [n3,n3,n1,n0] */				\
-    add_csaac (_c, _q0, _q0, n0, CNST_LIMB(0));				\
-    add_csaac (_c, _q1, _q1, n1, _c);					\
-    add_csaac (_c, _q2, _q2, r0, _c);					\
-    _q3 = _q3 + r1 + _c;						\
+    /* [q3,q2,q1,q0] += [n3,n2,n1,n0] + [ 0, 1, 0, 0] */		\
+    _q3 += n3;								\
+    _q0 += n0; _c = n0 > _q0;						\
+    add_sssaaaa (_q3,_q2,_q1, _q2,_q1, n2, _c);				\
+    add_sssaaaa (_q3,_q2,_q1, _q2,_q1, CNST_LIMB(1), n1);		\
 									\
     umul_ppmm (_t1,_t0, _q2, d0);					\
     _t1 += _q2 * d1 + _q3 * d0;						\


More information about the gmp-commit mailing list