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

mercurial at gmplib.org mercurial at gmplib.org
Fri Dec 4 17:34:07 CET 2009


details:   /home/hgfiles/gmp/rev/80c5ed1b5a2e
changeset: 12977:80c5ed1b5a2e
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Fri Dec 04 17:25:58 2009 +0100
description:
Add ASSERTs.

details:   /home/hgfiles/gmp/rev/b35d832c4b1a
changeset: 12978:b35d832c4b1a
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Fri Dec 04 17:26:52 2009 +0100
description:
Add a comment.

details:   /home/hgfiles/gmp/rev/7f16e7bbc182
changeset: 12979:7f16e7bbc182
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Fri Dec 04 17:31:36 2009 +0100
description:
Negate "binvert"-type inverses, as required.

details:   /home/hgfiles/gmp/rev/302b4fc32e08
changeset: 12980:302b4fc32e08
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Fri Dec 04 17:34:04 2009 +0100
description:
Increase some min_size values.

diffstat:

 ChangeLog             |  8 ++++++++
 mpn/generic/mod_1_1.c |  2 +-
 mpn/generic/redc_1.c  |  7 +++++--
 mpn/generic/redc_2.c  |  1 +
 tune/speed.h          |  4 ++++
 tune/tuneup.c         |  6 +++---
 6 files changed, 22 insertions(+), 6 deletions(-)

diffs (135 lines):

diff -r 4100c447728f -r 302b4fc32e08 ChangeLog
--- a/ChangeLog	Fri Dec 04 17:20:45 2009 +0100
+++ b/ChangeLog	Fri Dec 04 17:34:04 2009 +0100
@@ -1,5 +1,13 @@
 2009-12-04  Torbjorn Granlund  <tege at gmplib.org>
 
+	* tune/tuneup.c (tune_dc_div): Up min_size to 6.
+	(tune_mod_1): Set MOD_1_1_THRESHOLD min_size to 2.
+
+	* tune/speed.h: Negate "binvert"-type inverses, as required.
+
+	* mpn/generic/redc_1.c: Add ASSERTs.
+	* mpn/generic/redc_2.c: Likewise.
+
 	* mpn/generic/sbpi1_bdiv_q.c: Simplify loops, indexing.
 
 2009-12-03  Torbjorn Granlund  <tege at gmplib.org>
diff -r 4100c447728f -r 302b4fc32e08 mpn/generic/mod_1_1.c
--- a/mpn/generic/mod_1_1.c	Fri Dec 04 17:20:45 2009 +0100
+++ b/mpn/generic/mod_1_1.c	Fri Dec 04 17:34:04 2009 +0100
@@ -63,7 +63,7 @@
   int cnt;
   mp_limb_t mask;
 
-  ASSERT (n >= 2);
+  ASSERT (n >= 2);		/* fix tuneup.c if this is changed */
 
   B1modb = bmodb[2];
   B2modb = bmodb[3];
diff -r 4100c447728f -r 302b4fc32e08 mpn/generic/redc_1.c
--- a/mpn/generic/redc_1.c	Fri Dec 04 17:20:45 2009 +0100
+++ b/mpn/generic/redc_1.c	Fri Dec 04 17:34:04 2009 +0100
@@ -4,7 +4,7 @@
    THIS IS AN INTERNAL FUNCTION WITH A MUTABLE INTERFACE.  IT IS ONLY
    SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES.
 
-Copyright (C) 2000, 2001, 2002, 2004, 2008 Free Software Foundation, Inc.
+Copyright (C) 2000, 2001, 2002, 2004, 2008, 2009 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -30,11 +30,14 @@
   mp_size_t j;
   mp_limb_t cy;
 
+  ASSERT (n > 0);
   ASSERT_MPN (up, 2*n);
 
   for (j = n - 1; j >= 0; j--)
     {
-      up[0] = mpn_addmul_1 (up, mp, n, (up[0] * invm) & GMP_NUMB_MASK);
+      cy = mpn_addmul_1 (up, mp, n, (up[0] * invm) & GMP_NUMB_MASK);
+      ASSERT (up[0] == 0);
+      up[0] = cy;
       up++;
     }
   cy = mpn_add_n (rp, up, up - n, n);
diff -r 4100c447728f -r 302b4fc32e08 mpn/generic/redc_2.c
--- a/mpn/generic/redc_2.c	Fri Dec 04 17:20:45 2009 +0100
+++ b/mpn/generic/redc_2.c	Fri Dec 04 17:34:04 2009 +0100
@@ -74,6 +74,7 @@
   mp_limb_t upn;
   mp_limb_t cy;
 
+  ASSERT (n > 0);
   ASSERT_MPN (up, 2*n);
 
   if ((n & 1) != 0)
diff -r 4100c447728f -r 302b4fc32e08 tune/speed.h
--- a/tune/speed.h	Fri Dec 04 17:20:45 2009 +0100
+++ b/tune/speed.h	Fri Dec 04 17:34:04 2009 +0100
@@ -1373,6 +1373,7 @@
     MPN_COPY (dp, s->yp, s->size);					\
     dp[0] |= 1;								\
     binvert_limb (inv, dp[0]);						\
+    inv = -inv;								\
 									\
     speed_operand_src (s, ap, 2*s->size);				\
     speed_operand_dst (s, tp, 2*s->size);				\
@@ -1410,6 +1411,7 @@
     MPN_COPY (dp, s->yp, s->size);					\
     dp[0] |= 1;								\
     binvert_limb (inv, dp[0]);						\
+    inv = -inv;								\
 									\
     speed_operand_src (s, s->xp, s->size);				\
     speed_operand_dst (s, tp, s->size);					\
@@ -1487,6 +1489,7 @@
     MPN_COPY (mp, s->yp, s->size);					\
     mp[0] |= 1;								\
     binvert_limb (inv, mp[0]);						\
+    inv = -inv;								\
 									\
     speed_operand_src (s, ap, 2*s->size+1);				\
     speed_operand_dst (s, tp, 2*s->size+1);				\
@@ -1528,6 +1531,7 @@
     MPN_COPY (mp, s->yp, s->size);					\
     mp[0] |= 1;								\
     mpn_binvert (invp, mp, 2, tp);					\
+    invp[0] = -invp[0]; invp[1] = ~invp[1];				\
 									\
     speed_operand_src (s, ap, 2*s->size+1);				\
     speed_operand_dst (s, tp, 2*s->size+1);				\
diff -r 4100c447728f -r 302b4fc32e08 tune/tuneup.c
--- a/tune/tuneup.c	Fri Dec 04 17:20:45 2009 +0100
+++ b/tune/tuneup.c	Fri Dec 04 17:34:04 2009 +0100
@@ -1004,7 +1004,7 @@
     param.name = "DC_DIV_QR_THRESHOLD";
     param.function = speed_mpn_sbpi1_div_qr;
     param.function2 = speed_mpn_dcpi1_div_qr;
-    param.min_size = 4;
+    param.min_size = 6;
     one (&dc_div_qr_threshold, &param);
   }
   {
@@ -1012,7 +1012,7 @@
     param.name = "DC_DIVAPPR_Q_THRESHOLD";
     param.function = speed_mpn_sbpi1_divappr_q;
     param.function2 = speed_mpn_dcpi1_divappr_q;
-    param.min_size = 4;
+    param.min_size = 6;
     one (&dc_divappr_q_threshold, &param);
   }
 }
@@ -1286,9 +1286,9 @@
 
     s.r = GMP_NUMB_MASK / 5;
     param.function = speed_mpn_mod_1_tune;
-    param.min_size = 1;
 
     param.name = "MOD_1_1_THRESHOLD";
+    param.min_size = 2;
     one (&mod_1_1_threshold, &param);
 
     param.name = "MOD_1_2_THRESHOLD";


More information about the gmp-commit mailing list