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

mercurial at gmplib.org mercurial at gmplib.org
Thu Jan 16 20:30:54 UTC 2014


details:   /var/hg/gmp/rev/4eb285dce7e1
changeset: 16188:4eb285dce7e1
user:      Niels M?ller <nisse at lysator.liu.se>
date:      Thu Jan 16 21:23:29 2014 +0100
description:
mini-gmp: Add mp_bits_per_limb.

details:   /var/hg/gmp/rev/c6c071ee07ec
changeset: 16189:c6c071ee07ec
user:      Niels M?ller <nisse at lysator.liu.se>
date:      Thu Jan 16 21:25:09 2014 +0100
description:
List sec_minvert.c in AUTHORS.

details:   /var/hg/gmp/rev/6c9dba3c6d0d
changeset: 16190:6c9dba3c6d0d
user:      Niels M?ller <nisse at lysator.liu.se>
date:      Thu Jan 16 21:30:22 2014 +0100
description:
speed support for mpn_sec_minvert.

diffstat:

 AUTHORS             |   1 +
 ChangeLog           |  10 ++++++++++
 mini-gmp/mini-gmp.c |   2 ++
 mini-gmp/mini-gmp.h |   2 ++
 tune/common.c       |   6 ++++++
 tune/speed.c        |   1 +
 tune/speed.h        |  38 ++++++++++++++++++++++++++++++++++++++
 7 files changed, 60 insertions(+), 0 deletions(-)

diffs (134 lines):

diff -r 3e9554b3bfe7 -r 6c9dba3c6d0d AUTHORS
--- a/AUTHORS	Tue Jan 14 14:30:09 2014 +0100
+++ b/AUTHORS	Thu Jan 16 21:30:22 2014 +0100
@@ -40,6 +40,7 @@
 			matrix22_mul1_inverse_vector.c,
 			toom_interpolate_7pts, mulmod_bnm1.c, dcpi1_bdiv_qr.c,
 			dcpi1_bdiv_q.c, sbpi1_bdiv_qr.c, sbpi1_bdiv_q.c,
+			sec_minvert.c,
 			toom_eval_dgr3_pm1.c, toom_eval_dgr3_pm2.c,
 			toom_eval_pm1.c, toom_eval_pm2.c, toom_eval_pm2exp.c,
 			divexact.c, mod_1_1.c, div_qr_2.c,
diff -r 3e9554b3bfe7 -r 6c9dba3c6d0d ChangeLog
--- a/ChangeLog	Tue Jan 14 14:30:09 2014 +0100
+++ b/ChangeLog	Thu Jan 16 21:30:22 2014 +0100
@@ -1,3 +1,13 @@
+2014-01-16  Niels Möller  <nisse at lysator.liu.se>
+
+	* tune/common.c (speed_mpn_sec_minvert): New function.
+	* tune/speed.h: Declare it.
+	(SPEED_ROUTINE_MPN_SEC_MINVERT): New macro.
+	* tune/speed.c (routine): Added mpn_sec_minvert.
+
+	* mini-gmp/mini-gmp.c (mp_bits_per_limb): New const value.
+	* mini-gmp/mini-gmp.h: Declare it.
+
 2014-01-12  Marc Glisse  <marc.glisse at inria.fr>
 
 	* demos/expr/expr.h: Add extern "C" for C++.
diff -r 3e9554b3bfe7 -r 6c9dba3c6d0d mini-gmp/mini-gmp.c
--- a/mini-gmp/mini-gmp.c	Tue Jan 14 14:30:09 2014 +0100
+++ b/mini-gmp/mini-gmp.c	Thu Jan 16 21:30:22 2014 +0100
@@ -225,6 +225,8 @@
     (y) = __mpz_srcptr_swap__tmp;					\
   } while (0)
 
+const int mp_bits_per_limb = GMP_LIMB_BITS;
+
 

 /* Memory allocation and other helper functions. */
 static void
diff -r 3e9554b3bfe7 -r 6c9dba3c6d0d mini-gmp/mini-gmp.h
--- a/mini-gmp/mini-gmp.h	Tue Jan 14 14:30:09 2014 +0100
+++ b/mini-gmp/mini-gmp.h	Thu Jan 16 21:30:22 2014 +0100
@@ -64,6 +64,8 @@
 typedef __mpz_struct *mpz_ptr;
 typedef const __mpz_struct *mpz_srcptr;
 
+extern const int mp_bits_per_limb;
+
 void mpn_copyi (mp_ptr, mp_srcptr, mp_size_t);
 void mpn_copyd (mp_ptr, mp_srcptr, mp_size_t);
 
diff -r 3e9554b3bfe7 -r 6c9dba3c6d0d tune/common.c
--- a/tune/common.c	Tue Jan 14 14:30:09 2014 +0100
+++ b/tune/common.c	Thu Jan 16 21:30:22 2014 +0100
@@ -931,6 +931,12 @@
 }
 
 double
+speed_mpn_sec_minvert (struct speed_params *s)
+{
+  SPEED_ROUTINE_MPN_SEC_MINVERT (mpn_sec_minvert, mpn_sec_minvert_itch);
+}
+
+double
 speed_mpn_redc_1 (struct speed_params *s)
 {
   SPEED_ROUTINE_REDC_1 (mpn_redc_1);
diff -r 3e9554b3bfe7 -r 6c9dba3c6d0d tune/speed.c
--- a/tune/speed.c	Tue Jan 14 14:30:09 2014 +0100
+++ b/tune/speed.c	Thu Jan 16 21:30:22 2014 +0100
@@ -361,6 +361,7 @@
   { "mpn_invertappr",          speed_mpn_invertappr          },
   { "mpn_ni_invertappr",       speed_mpn_ni_invertappr       },
   { "mpn_binvert",             speed_mpn_binvert             },
+  { "mpn_sec_minvert",         speed_mpn_sec_minvert         },
 
   { "mpn_sbpi1_div_qr",        speed_mpn_sbpi1_div_qr,    FLAG_R_OPTIONAL},
   { "mpn_dcpi1_div_qr",        speed_mpn_dcpi1_div_qr,    FLAG_R_OPTIONAL},
diff -r 3e9554b3bfe7 -r 6c9dba3c6d0d tune/speed.h
--- a/tune/speed.h	Tue Jan 14 14:30:09 2014 +0100
+++ b/tune/speed.h	Thu Jan 16 21:30:22 2014 +0100
@@ -291,6 +291,7 @@
 double speed_mpn_invert (struct speed_params *);
 double speed_mpn_invertappr (struct speed_params *);
 double speed_mpn_ni_invertappr (struct speed_params *);
+double speed_mpn_sec_minvert (struct speed_params *s);
 double speed_mpn_binvert (struct speed_params *);
 double speed_mpn_redc_1 (struct speed_params *);
 double speed_mpn_redc_2 (struct speed_params *);
@@ -2290,6 +2291,43 @@
     return t;								\
   }
 
+#define SPEED_ROUTINE_MPN_SEC_MINVERT(function,itchfn)			\
+  {									\
+    long  i;								\
+    mp_ptr    up, mp, tp, ip;						\
+    double    t;							\
+    TMP_DECL;								\
+									\
+    SPEED_RESTRICT_COND (s->size >= 1);					\
+									\
+    TMP_MARK;								\
+    SPEED_TMP_ALLOC_LIMBS (ip, s->size, s->align_xp);			\
+    SPEED_TMP_ALLOC_LIMBS (up, s->size, s->align_yp);			\
+    SPEED_TMP_ALLOC_LIMBS (mp, s->size, s->align_yp);			\
+    SPEED_TMP_ALLOC_LIMBS (tp, itchfn (s->size), s->align_wp);		\
+									\
+    speed_operand_src (s, up, s->size);					\
+    speed_operand_dst (s, tp, s->size);					\
+    speed_operand_dst (s, ip, s->size);					\
+    speed_cache_fill (s);						\
+									\
+    MPN_COPY (mp, s->yp, s->size);					\
+    /* Must be odd */							\
+    mp[0] |= 1;								\
+    speed_starttime ();							\
+    i = s->reps;							\
+    do									\
+      {									\
+	MPN_COPY (up, s->xp, s->size);					\
+	function (ip, up, mp, s->size, 2*s->size*GMP_NUMB_BITS, tp);	\
+      }									\
+    while (--i != 0);							\
+    t = speed_endtime ();						\
+									\
+    TMP_FREE;								\
+    return t;								\
+  }
+
 #define SPEED_ROUTINE_REDC_1(function)					\
   {									\
     unsigned   i;							\


More information about the gmp-commit mailing list