[Gmp-commit] /var/hg/gmp: Measure mpn_sqrtrem and mpn_rootrem in remainder-le...

mercurial at gmplib.org mercurial at gmplib.org
Mon Jun 1 20:57:52 UTC 2015


details:   /var/hg/gmp/rev/c86f4fc0aafe
changeset: 16672:c86f4fc0aafe
user:      Torbjorn Granlund <torbjorng at google.com>
date:      Mon Jun 01 22:57:49 2015 +0200
description:
Measure mpn_sqrtrem and mpn_rootrem in remainder-less mode.

diffstat:

 ChangeLog     |  14 +++++++++++++-
 tune/common.c |  16 ++++++++++++++--
 tune/speed.c  |   2 ++
 tune/speed.h  |  35 ++++-------------------------------
 4 files changed, 33 insertions(+), 34 deletions(-)

diffs (130 lines):

diff -r 104ecfe38735 -r c86f4fc0aafe ChangeLog
--- a/ChangeLog	Mon Jun 01 22:02:48 2015 +0200
+++ b/ChangeLog	Mon Jun 01 22:57:49 2015 +0200
@@ -1,3 +1,15 @@
+2015-06-01  Torbjörn Granlund  <torbjorng at google.com>
+
+	* tune/speed.c (routine): Measure "mpn_sqrt" and "mpn_root", which are
+	really the corresponding "rem" functions with NULL remainder argument.
+
+	* tune/speed.h (SPEED_ROUTINE_MPN_SQRTROOT_CALL): New.
+	(SPEED_ROUTINE_MPN_SQRTREM, SPEED_ROUTINE_MPN_ROOTREM):	Remove.
+
+	* tune/common.c (speed_mpn_sqrt, speed_mpn_root): New functions.
+	(speed_mpn_sqrtrem): Use SPEED_ROUTINE_MPN_SQRTROOT_CALL
+	(speed_mpn_rootrem): Likewise.
+
 2015-05-30 Marco Bodrato <bodrato at mail.dm.unipi.it>
 
 	* mpf/cmp_ui.c: Use macros, remove branches, correct nails.
@@ -21,7 +33,7 @@
 
 	* mini-gmp/mini-gmp.h: Declare mpn_zero_p.
 	* mini-gmp/mini-gmp.c: Define mpn_zero_p as a function, not a macro.
-	
+
 2015-05-28  Niels Möller  <nisse at lysator.liu.se>
 
 	* doc/gmp.texi (Low-level Functions): Document mpn_divexact_1 and
diff -r 104ecfe38735 -r c86f4fc0aafe tune/common.c
--- a/tune/common.c	Mon Jun 01 22:02:48 2015 +0200
+++ b/tune/common.c	Mon Jun 01 22:57:49 2015 +0200
@@ -1741,13 +1741,25 @@
 double
 speed_mpn_sqrtrem (struct speed_params *s)
 {
-  SPEED_ROUTINE_MPN_SQRTREM (mpn_sqrtrem);
+  SPEED_ROUTINE_MPN_SQRTROOT_CALL (mpn_sqrtrem (wp, wp2, s->xp, s->size));
+}
+
+double
+speed_mpn_sqrt (struct speed_params *s)
+{
+  SPEED_ROUTINE_MPN_SQRTROOT_CALL (mpn_sqrtrem (wp, NULL, s->xp, s->size));
 }
 
 double
 speed_mpn_rootrem (struct speed_params *s)
 {
-  SPEED_ROUTINE_MPN_ROOTREM (mpn_rootrem);
+  SPEED_ROUTINE_MPN_SQRTROOT_CALL (mpn_rootrem (wp, wp2, s->xp, s->size, s->r));
+}
+
+double
+speed_mpn_root (struct speed_params *s)
+{
+  SPEED_ROUTINE_MPN_SQRTROOT_CALL (mpn_rootrem (wp, NULL, s->xp, s->size, s->r));
 }
 
 
diff -r 104ecfe38735 -r c86f4fc0aafe tune/speed.c
--- a/tune/speed.c	Mon Jun 01 22:02:48 2015 +0200
+++ b/tune/speed.c	Mon Jun 01 22:57:49 2015 +0200
@@ -401,6 +401,8 @@
 
   { "mpn_sqrtrem",       speed_mpn_sqrtrem          },
   { "mpn_rootrem",       speed_mpn_rootrem, FLAG_R  },
+  { "mpn_sqrt",          speed_mpn_sqrt             },
+  { "mpn_root",          speed_mpn_root, FLAG_R     },
 
   { "mpn_fib2_ui",       speed_mpn_fib2_ui,    FLAG_NODATA },
   { "mpz_fib_ui",        speed_mpz_fib_ui,     FLAG_NODATA },
diff -r 104ecfe38735 -r c86f4fc0aafe tune/speed.h
--- a/tune/speed.h	Mon Jun 01 22:02:48 2015 +0200
+++ b/tune/speed.h	Mon Jun 01 22:57:49 2015 +0200
@@ -329,6 +329,8 @@
 double speed_mpn_sqr (struct speed_params *);
 double speed_mpn_sqrtrem (struct speed_params *);
 double speed_mpn_rootrem (struct speed_params *);
+double speed_mpn_sqrt (struct speed_params *);
+double speed_mpn_root (struct speed_params *);
 double speed_mpn_sub_n (struct speed_params *);
 double speed_mpn_sub_1 (struct speed_params *);
 double speed_mpn_sub_1_inplace (struct speed_params *);
@@ -3290,7 +3292,7 @@
   }
 
 
-#define SPEED_ROUTINE_MPN_SQRTREM(function)				\
+#define SPEED_ROUTINE_MPN_SQRTROOT_CALL(call)				\
   {									\
     mp_ptr    wp, wp2;							\
     unsigned  i;							\
@@ -3311,36 +3313,7 @@
     speed_starttime ();							\
     i = s->reps;							\
     do									\
-      function (wp, wp2, s->xp, s->size);				\
-    while (--i != 0);							\
-    t = speed_endtime ();						\
-									\
-    TMP_FREE;								\
-    return t;								\
-  }
-
-#define SPEED_ROUTINE_MPN_ROOTREM(function)				\
-  {									\
-    mp_ptr    wp, wp2;							\
-    unsigned  i;							\
-    double    t;							\
-    TMP_DECL;								\
-									\
-    SPEED_RESTRICT_COND (s->size >= 1);					\
-									\
-    TMP_MARK;								\
-    SPEED_TMP_ALLOC_LIMBS (wp,	s->size, s->align_wp);			\
-    SPEED_TMP_ALLOC_LIMBS (wp2, s->size, s->align_wp2);			\
-									\
-    speed_operand_src (s, s->xp, s->size);				\
-    speed_operand_dst (s, wp, s->size);					\
-    speed_operand_dst (s, wp2, s->size);				\
-    speed_cache_fill (s);						\
-									\
-    speed_starttime ();							\
-    i = s->reps;							\
-    do									\
-      function (wp, wp2, s->xp, s->size, s->r);				\
+      call;								\
     while (--i != 0);							\
     t = speed_endtime ();						\
 									\


More information about the gmp-commit mailing list