[Gmp-commit] /home/hgfiles/gmp: 5 new changesets

mercurial at gmplib.org mercurial at gmplib.org
Thu Jan 7 17:09:35 CET 2010


details:   /home/hgfiles/gmp/rev/dab82ee4fecb
changeset: 13352:dab82ee4fecb
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Thu Jan 07 16:15:49 2010 +0100
description:
Retune.

details:   /home/hgfiles/gmp/rev/1676a6539c7f
changeset: 13353:1676a6539c7f
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Thu Jan 07 16:16:15 2010 +0100
description:
Remove a comment.

details:   /home/hgfiles/gmp/rev/644ecdd14d63
changeset: 13354:644ecdd14d63
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Thu Jan 07 16:59:02 2010 +0100
description:
Update mpn_neg and mpn_com names.

details:   /home/hgfiles/gmp/rev/46757a4e7879
changeset: 13355:46757a4e7879
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Thu Jan 07 17:05:15 2010 +0100
description:
Move a random call for debugability.

details:   /home/hgfiles/gmp/rev/db54118ab8e5
changeset: 13356:db54118ab8e5
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Thu Jan 07 17:09:30 2010 +0100
description:
Handle mpn_preinv_mu_divappr_q returning a high limb.

diffstat:

 ChangeLog              |   6 ++++++
 Makefile.am            |   2 +-
 doc/gmp.texi           |   4 ++--
 mpn/arm/gmp-mparam.h   |   2 +-
 mpn/generic/mu_div_q.c |  13 ++++++++++++-
 tests/mpn/t-bdiv.c     |   4 ++--
 tests/mpn/t-div.c      |   5 +++--
 7 files changed, 27 insertions(+), 9 deletions(-)

diffs (134 lines):

diff -r 03ff49efb568 -r db54118ab8e5 ChangeLog
--- a/ChangeLog	Thu Jan 07 16:06:45 2010 +0100
+++ b/ChangeLog	Thu Jan 07 17:09:30 2010 +0100
@@ -2,6 +2,12 @@
 
 	* Version 5.0.0 released.
 
+	* mpn/generic/mu_div_q.c: Handle mpn_preinv_mu_divappr_q returning a
+	high limb.
+
+	* tests/mpn/t-bdiv.c: Move a random call for debugability.
+	* tests/mpn/t-div.c: Likewise.
+
 	* mpn/generic/mu_divappr_q.c: Rewrite quotient round-up code.
 
 	* mpn/generic/mu_div_qr.c: Handle carry-out from a carry propagation
diff -r 03ff49efb568 -r db54118ab8e5 Makefile.am
--- a/Makefile.am	Thu Jan 07 16:06:45 2010 +0100
+++ b/Makefile.am	Thu Jan 07 17:09:30 2010 +0100
@@ -65,7 +65,7 @@
 #        4.3.0    8:0:5    5:0:1   4:14:1
 #        4.3.1    8:1:5    5:1:1   4:15:1	WRONG Really used same as 4.3.0
 #        4.3.2    8:2:5    5:2:1   4:16:1
-#        5.0.0    9:0:6    6:0:2   4:20:1	PRELIMINARY
+#        5.0.0    9:0:6    6:0:2   4:20:1
 #
 # Starting at 3:0:0 is a slight abuse of the versioning system, but it
 # ensures we're past soname libgmp.so.2, which was used on Debian GNU/Linux
diff -r 03ff49efb568 -r db54118ab8e5 doc/gmp.texi
--- a/doc/gmp.texi	Thu Jan 07 16:06:45 2010 +0100
+++ b/doc/gmp.texi	Thu Jan 07 17:09:30 2010 +0100
@@ -5167,7 +5167,7 @@
 @var{s2n}.
 @end deftypefun
 
- at deftypefun void mpn_neg_n (mp_limb_t *@var{rp}, const mp_limb_t *@var{sp}, mp_size_t @var{n})
+ at deftypefun void mpn_neg (mp_limb_t *@var{rp}, const mp_limb_t *@var{sp}, mp_size_t @var{n})
 Perform the negation of @{@var{sp}, @var{n}@}, and write the result to
 @{@var{rp}, @var{n}@}.  Return carry-out.
 @end deftypefun
@@ -5537,7 +5537,7 @@
 @{@var{rp}, @var{n}@}.
 @end deftypefun
 
- at deftypefun void mpn_com_n (mp_limb_t *@var{rp}, const mp_limb_t *@var{sp}, mp_size_t @var{n})
+ at deftypefun void mpn_com (mp_limb_t *@var{rp}, const mp_limb_t *@var{sp}, mp_size_t @var{n})
 Perform the bitwise complement of @{@var{sp}, @var{n}@}, and write the result
 to @{@var{rp}, @var{n}@}.
 @end deftypefun
diff -r 03ff49efb568 -r db54118ab8e5 mpn/arm/gmp-mparam.h
--- a/mpn/arm/gmp-mparam.h	Thu Jan 07 16:06:45 2010 +0100
+++ b/mpn/arm/gmp-mparam.h	Thu Jan 07 17:09:30 2010 +0100
@@ -68,7 +68,7 @@
 
 #define MULLO_BASECASE_THRESHOLD             0  /* always */
 #define MULLO_DC_THRESHOLD                 120
-#define MULLO_MUL_N_THRESHOLD            15203
+#define MULLO_MUL_N_THRESHOLD             3000
 
 #define DC_DIV_QR_THRESHOLD                134
 #define DC_DIVAPPR_Q_THRESHOLD             442
diff -r 03ff49efb568 -r db54118ab8e5 mpn/generic/mu_div_q.c
--- a/mpn/generic/mu_div_q.c	Thu Jan 07 16:06:45 2010 +0100
+++ b/mpn/generic/mu_div_q.c	Thu Jan 07 17:09:30 2010 +0100
@@ -123,7 +123,18 @@
       rp[0] = 0;
       this_in = mpn_mu_divappr_q_choose_in (dn + 1, dn, 0);
       this_ip = ip + in - this_in;
-      mpn_preinv_mu_divappr_q (tp, rp, 2 * dn + 1, dp, dn, this_ip, this_in, scratch);
+      cy = mpn_preinv_mu_divappr_q (tp, rp, 2 * dn + 1, dp, dn,
+				    this_ip, this_in, scratch);
+
+      if (UNLIKELY (cy != 0))
+	{
+	  /* Since the partial remainder fed to mpn_preinv_mu_divappr_q was
+	     canonically reduced, replace the returned value of B^(qn-dn)+eps
+	     by the largest possible value.  */
+	  mp_size_t i;
+	  for (i = 0; i < dn + 1; i++)
+	    tp[i] = GMP_NUMB_MAX;
+	}
 
       /* The max error of mpn_mu_divappr_q is +4.  If the low quotient limb is
 	 greater than the max error, we cannot trust the quotient.  */
diff -r 03ff49efb568 -r db54118ab8e5 tests/mpn/t-bdiv.c
--- a/tests/mpn/t-bdiv.c	Thu Jan 07 16:06:45 2010 +0100
+++ b/tests/mpn/t-bdiv.c	Thu Jan 07 17:09:30 2010 +0100
@@ -246,6 +246,8 @@
       qp[nn - dn + 1] = qran1;
       rp[-1] = rran0;
 
+      ran = random_word (rands);
+
       if ((double) (nn - dn) * dn < 1e5)
 	{
 	  if (nn > dn)
@@ -297,8 +299,6 @@
       if (nn - dn < 2 || dn < 2)
 	continue;
 
-      ran = random_word (rands);
-
       /* Test mpn_mu_bdiv_qr */
       itch = mpn_mu_bdiv_qr_itch (nn, dn);
       if (itch + 1 > alloc)
diff -r 03ff49efb568 -r db54118ab8e5 tests/mpn/t-div.c
--- a/tests/mpn/t-div.c	Thu Jan 07 16:06:45 2010 +0100
+++ b/tests/mpn/t-div.c	Thu Jan 07 17:09:30 2010 +0100
@@ -12,6 +12,7 @@
 You should have received a copy of the GNU General Public License along with
 this program.  If not, see http://www.gnu.org/licenses/.  */
 
+
 #include <stdlib.h>		/* for strtol */
 #include <stdio.h>		/* for printf */
 
@@ -268,6 +269,8 @@
       qp[nn - dn + 1] = qran1;
       rp[-1] = rran0;
 
+      ran = random_word (rands);
+
       if ((double) (nn - dn) * dn < 1e5)
 	{
 	  /* Test mpn_sbpi1_div_qr */
@@ -337,8 +340,6 @@
 	  check_one (qp, NULL, np, nn, dp, dn, "mpn_dcpi1_div_q", 0);
 	}
 
-      ran = random_word (rands);
-
      /* Test mpn_mu_div_qr */
       if (nn - dn > 2 && dn >= 2)
 	{


More information about the gmp-commit mailing list