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

mercurial at gmplib.org mercurial at gmplib.org
Wed Sep 4 04:18:33 UTC 2019


details:   /var/hg/gmp/rev/37fe7ccf8be9
changeset: 17861:37fe7ccf8be9
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Wed Sep 04 06:16:30 2019 +0200
description:
mpn/generic/div_qr_2.c (udiv_qr_4by2): Rearrange operations.

details:   /var/hg/gmp/rev/b1ea8c11ae1e
changeset: 17862:b1ea8c11ae1e
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Wed Sep 04 06:18:08 2019 +0200
description:
mpn/generic/div_qr_1[nu]_pi2.c: Remove old comments.

diffstat:

 mpn/generic/div_qr_1n_pi2.c |   2 --
 mpn/generic/div_qr_1u_pi2.c |   2 --
 mpn/generic/div_qr_2.c      |  18 ++++++++----------
 3 files changed, 8 insertions(+), 14 deletions(-)

diffs (56 lines):

diff -r 5b9461face51 -r b1ea8c11ae1e mpn/generic/div_qr_1n_pi2.c
--- a/mpn/generic/div_qr_1n_pi2.c	Wed Sep 04 01:30:18 2019 +0200
+++ b/mpn/generic/div_qr_1n_pi2.c	Wed Sep 04 06:18:08 2019 +0200
@@ -48,8 +48,6 @@
 /* Define some longlong.h-style macros, but for wider operations.
    * add_sssaaaa is like longlong.h's add_ssaaaa but propagating carry-out into
      an additional sum operand.
-   * add_csaac accepts two addends and a carry in, and generates a sum and a
-     carry out.  A little like a "full adder".
 */
 #if defined (__GNUC__)  && ! defined (__INTEL_COMPILER) && ! defined (NO_ASM)
 
diff -r 5b9461face51 -r b1ea8c11ae1e mpn/generic/div_qr_1u_pi2.c
--- a/mpn/generic/div_qr_1u_pi2.c	Wed Sep 04 01:30:18 2019 +0200
+++ b/mpn/generic/div_qr_1u_pi2.c	Wed Sep 04 06:18:08 2019 +0200
@@ -48,8 +48,6 @@
 /* Define some longlong.h-style macros, but for wider operations.
    * add_sssaaaa is like longlong.h's add_ssaaaa but propagating carry-out into
      an additional sum operand.
-   * add_csaac accepts two addends and a carry in, and generates a sum and a
-     carry out.  A little like a "full adder".
 */
 #if defined (__GNUC__)  && ! defined (__INTEL_COMPILER) && ! defined (NO_ASM)
 
diff -r 5b9461face51 -r b1ea8c11ae1e mpn/generic/div_qr_2.c
--- a/mpn/generic/div_qr_2.c	Wed Sep 04 01:30:18 2019 +0200
+++ b/mpn/generic/div_qr_2.c	Wed Sep 04 06:18:08 2019 +0200
@@ -114,20 +114,18 @@
   do {									\
     mp_limb_t _q3, _q2a, _q2, _q1, _q2c, _q1c, _q1d, _q0;		\
     mp_limb_t _t1, _t0;							\
-    mp_limb_t _c, _mask;						\
+    mp_limb_t _mask;							\
 									\
+    /* [q3,q2,q1,q0] = [n3,n2]*[di1,di0] + [n3,n2,n1,n0] + [0,1,0,0] */	\
+    umul_ppmm (_q2,_q1, n2, di1);					\
     umul_ppmm (_q3,_q2a, n3, di1);					\
-    umul_ppmm (_q2,_q1, n2, di1);					\
+    ++_q2;	/* _q2 cannot overflow */				\
+    add_ssaaaa (_q3,_q2, _q3,_q2, n3,_q2a);				\
     umul_ppmm (_q2c,_q1c, n3, di0);					\
-    add_sssaaaa (_q3,_q2,_q1, _q2,_q1, _q2c,_q1c);			\
+    add_sssaaaa (_q3,_q2,_q1, _q2,_q1, n2,_q1c);			\
     umul_ppmm (_q1d,_q0, n2, di0);					\
-    add_sssaaaa (_q3,_q2,_q1, _q2,_q1, _q2a,_q1d);			\
-									\
-    /* [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);		\
+    add_sssaaaa (_q2c,_q1d,_q0, _q1d,_q0, n1,n0); /* _q2c cannot overflow */ \
+    add_sssaaaa (_q3,_q2,_q1, _q2,_q1, _q2c,_q1d);			\
 									\
     umul_ppmm (_t1,_t0, _q2, d0);					\
     _t1 += _q2 * d1 + _q3 * d0;						\


More information about the gmp-commit mailing list