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

mercurial at gmplib.org mercurial at gmplib.org
Thu Sep 3 17:40:34 UTC 2015


details:   /var/hg/gmp/rev/b52329db5bdd
changeset: 16809:b52329db5bdd
user:      Torbjorn Granlund <torbjorng at google.com>
date:      Thu Sep 03 19:38:20 2015 +0200
description:
(GMP_C_HIDDEN_ALIAS): New.

details:   /var/hg/gmp/rev/d415b7ed8a5d
changeset: 16810:d415b7ed8a5d
user:      Torbjorn Granlund <torbjorng at google.com>
date:      Thu Sep 03 19:38:42 2015 +0200
description:
ChangeLog

details:   /var/hg/gmp/rev/8f1fe1742042
changeset: 16811:8f1fe1742042
user:      Torbjorn Granlund <torbjorng at google.com>
date:      Thu Sep 03 19:40:32 2015 +0200
description:
Trivial merge.

diffstat:

 ChangeLog              |   6 ++++++
 acinclude.m4           |  19 +++++++++++++++++++
 mpn/generic/bsqrtinv.c |  13 ++++++-------
 mpq/div.c              |  18 +++++++++---------
 4 files changed, 40 insertions(+), 16 deletions(-)

diffs (122 lines):

diff -r dd6e7b59d6d6 -r 8f1fe1742042 ChangeLog
--- a/ChangeLog	Tue Sep 01 22:10:48 2015 +0200
+++ b/ChangeLog	Thu Sep 03 19:40:32 2015 +0200
@@ -1,8 +1,14 @@
+2015-09-03  Torbjörn Granlund  <torbjorng at google.com>
+
+	* acinclude.m4 (GMP_C_HIDDEN_ALIAS): New.
+
 2015-09-01 Marco Bodrato <bodrato at mail.dm.unipi.it>
 
 	* mpq/cmp.c (mpq_cmp_numden): Cast to avoid over/underflow.
 	* tests/mpn/t-toom22.c (MIN_AN): Use defined value.
 	* tests/mpz/t-fac_ui.c: Check big factorial modulo a larger prime.
+	* mpn/generic/bsqrtinv.c: Use sqrlo+mullo_n instead of powlo(,,3,,).
+	* mpq/div.c: Move a branch out of the normal flow.
 
 2015-08-31  Torbjörn Granlund  <torbjorng at google.com>
 
diff -r dd6e7b59d6d6 -r 8f1fe1742042 acinclude.m4
--- a/acinclude.m4	Tue Sep 01 22:10:48 2015 +0200
+++ b/acinclude.m4	Thu Sep 03 19:40:32 2015 +0200
@@ -3249,6 +3249,25 @@
 fi
 ])
 
+dnl  GMP_C_HIDDEN_ALIAS
+dnl  ------------------------
+
+AC_DEFUN([GMP_C_HIDDEN_ALIAS],
+[AC_CACHE_CHECK([whether gcc hidden aliases work],
+                gmp_cv_c_hidden_alias,
+[AC_TRY_COMPILE(
+[void hid() __attribute__ ((visibility("hidden")));
+void hid() {}
+void pub() __attribute__ ((alias("hid")));],
+, gmp_cv_c_hidden_alias=yes, gmp_cv_c_hidden_alias=no)
+])
+if test $gmp_cv_c_hidden_alias = yes; then
+  AC_DEFINE(HAVE_HIDDEN_ALIAS, 1,
+  [Define to 1 if the compiler accepts gcc style __attribute__ ((visibility))
+and __attribute__ ((alias))])
+  GMP_DEFINE(HAVE_HIDDEN_ALIAS, [])
+fi
+])
 
 dnl  GMP_C_DOUBLE_FORMAT
 dnl  -------------------
diff -r dd6e7b59d6d6 -r 8f1fe1742042 mpn/generic/bsqrtinv.c
--- a/mpn/generic/bsqrtinv.c	Tue Sep 01 22:10:48 2015 +0200
+++ b/mpn/generic/bsqrtinv.c	Thu Sep 03 19:40:32 2015 +0200
@@ -2,7 +2,7 @@
 
    Contributed to the GNU project by Martin Boij (as part of perfpow.c).
 
-Copyright 2009, 2010, 2012 Free Software Foundation, Inc.
+Copyright 2009, 2010, 2012, 2015 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -55,8 +55,7 @@
 int
 mpn_bsqrtinv (mp_ptr rp, mp_srcptr yp, mp_bitcnt_t bnb, mp_ptr tp)
 {
-  mp_ptr tp2, tp3;
-  mp_limb_t k;
+  mp_ptr tp2;
   mp_size_t bn, order[GMP_LIMB_BITS + 1];
   int i, d;
 
@@ -65,8 +64,6 @@
   bn = 1 + bnb / GMP_LIMB_BITS;
 
   tp2 = tp + bn;
-  tp3 = tp + 2 * bn;
-  k = 3;
 
   rp[0] = 1;
   if (bnb == 1)
@@ -88,9 +85,11 @@
 	  bnb = order[i];
 	  bn = 1 + bnb / GMP_LIMB_BITS;
 
-	  mpn_mul_1 (tp, rp, bn, k);
+	  mpn_sqrlo (tp, rp, bn);
+	  mpn_mullo_n (tp2, rp, tp, bn); /* tp2 <- rp ^ 3 */
 
-	  mpn_powlo (tp2, rp, &k, 1, bn, tp3);
+	  mpn_mul_1 (tp, rp, bn, 3);
+
 	  mpn_mullo_n (rp, yp, tp2, bn);
 
 #if HAVE_NATIVE_mpn_rsh1sub_n
diff -r dd6e7b59d6d6 -r 8f1fe1742042 mpq/div.c
--- a/mpq/div.c	Tue Sep 01 22:10:48 2015 +0200
+++ b/mpq/div.c	Thu Sep 03 19:40:32 2015 +0200
@@ -47,17 +47,17 @@
   if (UNLIKELY (op2_size == 0))
     DIVIDE_BY_ZERO;
 
-  if (op1 == op2)
+  if (UNLIKELY (quot == op2))
     {
-      PTR(NUM(quot))[0] = 1;
-      SIZ(NUM(quot)) = 1;
-      PTR(DEN(quot))[0] = 1;
-      SIZ(DEN(quot)) = 1;
-      return;
-    }
+      if (op1 == op2)
+	{
+	  PTR(NUM(quot))[0] = 1;
+	  SIZ(NUM(quot)) = 1;
+	  PTR(DEN(quot))[0] = 1;
+	  SIZ(DEN(quot)) = 1;
+	  return;
+	}
 
-  if (quot == op2)
-    {
       /* We checked for op1 == op2: we are not in the x=x/x case.
 	 We compute x=y/x by computing x=inv(x)*y */
       MPN_PTR_SWAP (PTR(NUM(quot)), ALLOC(NUM(quot)),


More information about the gmp-commit mailing list