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

mercurial at gmplib.org mercurial at gmplib.org
Thu Oct 20 09:09:15 CEST 2011


details:   /var/hg/gmp/rev/b7ea81f31f8b
changeset: 14363:b7ea81f31f8b
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Thu Oct 20 09:08:44 2011 +0200
description:
Measure mpn_sqr_diag_addlsh1.

details:   /var/hg/gmp/rev/3a8bda046088
changeset: 14364:3a8bda046088
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Thu Oct 20 09:08:57 2011 +0200
description:
*** empty log message ***

diffstat:

 ChangeLog     |   4 ++++
 tune/common.c |  10 ++++++++++
 tune/speed.c  |   3 +++
 tune/speed.h  |  32 +++++++++++++++++++++++++++++---
 4 files changed, 46 insertions(+), 3 deletions(-)

diffs (95 lines):

diff -r 7ac484b22d5d -r 3a8bda046088 ChangeLog
--- a/ChangeLog	Thu Oct 20 00:31:43 2011 +0200
+++ b/ChangeLog	Thu Oct 20 09:08:57 2011 +0200
@@ -1,5 +1,9 @@
 2011-10-20  Torbjorn Granlund  <tege at gmplib.org>
 
+	* tune/speed.h (SPEED_ROUTINE_MPN_SQR_DIAL_ADDLSH1_CALL): New macro.
+	* tune/common.c (speed_mpn_sqr_diag_addlsh1): New function.
+	* tune/speed.c (routine): Measure mpn_sqr_diag_addlsh1.
+
 	* mpn/s390_64/sqr_diag_addlsh1.asm: Rewrite like s390_32/esame code.
 
 	* mpn/s390_32/esame/sqr_diag_addlsh1.asm: Save just needed registers.
diff -r 7ac484b22d5d -r 3a8bda046088 tune/common.c
--- a/tune/common.c	Thu Oct 20 00:31:43 2011 +0200
+++ b/tune/common.c	Thu Oct 20 09:08:57 2011 +0200
@@ -1192,6 +1192,16 @@
 }
 #endif
 
+#if HAVE_NATIVE_mpn_sqr_diag_addlsh1
+double
+speed_mpn_sqr_diag_addlsh1 (struct speed_params *s)
+{
+  /* FIXME: (1) This gives a 2x value for measurements.
+            (2) Pass different arguments for rp and tp.  */
+  SPEED_ROUTINE_MPN_SQR_DIAL_ADDLSH1_CALL (mpn_sqr_diag_addlsh1 (wp, tp, s->xp, s->size));
+}
+#endif
+
 double
 speed_mpn_toom2_sqr (struct speed_params *s)
 {
diff -r 7ac484b22d5d -r 3a8bda046088 tune/speed.c
--- a/tune/speed.c	Thu Oct 20 00:31:43 2011 +0200
+++ b/tune/speed.c	Thu Oct 20 09:08:57 2011 +0200
@@ -310,6 +310,9 @@
 #if HAVE_NATIVE_mpn_sqr_diagonal
   { "mpn_sqr_diagonal",  speed_mpn_sqr_diagonal     },
 #endif
+#if HAVE_NATIVE_mpn_sqr_diag_addlsh1
+  { "mpn_sqr_diag_addlsh1", speed_mpn_sqr_diag_addlsh1 },
+#endif
 
   { "mpn_mul_n",         speed_mpn_mul_n            },
   { "mpn_sqr",           speed_mpn_sqr              },
diff -r 7ac484b22d5d -r 3a8bda046088 tune/speed.h
--- a/tune/speed.h	Thu Oct 20 00:31:43 2011 +0200
+++ b/tune/speed.h	Thu Oct 20 09:08:57 2011 +0200
@@ -296,6 +296,7 @@
 double speed_mpn_dc_set_str __GMP_PROTO ((struct speed_params *s));
 double speed_mpn_set_str_pre __GMP_PROTO ((struct speed_params *s));
 double speed_mpn_sqr_basecase __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_sqr_diag_addlsh1 __GMP_PROTO ((struct speed_params *s));
 double speed_mpn_sqr_diagonal __GMP_PROTO ((struct speed_params *s));
 double speed_mpn_sqr __GMP_PROTO ((struct speed_params *s));
 double speed_mpn_sqrtrem __GMP_PROTO ((struct speed_params *s));
@@ -1442,9 +1443,34 @@
 #define SPEED_ROUTINE_MPN_SQR(function)					\
   SPEED_ROUTINE_MPN_SQR_CALL (function (wp, s->xp, s->size))
 
-#define SPEED_ROUTINE_MPN_SQR_DIAGONAL(function)			\
-  SPEED_ROUTINE_MPN_SQR (function)
-
+#define SPEED_ROUTINE_MPN_SQR_DIAL_ADDLSH1_CALL(call)			\
+  {									\
+    mp_ptr    wp, tp;							\
+    unsigned  i;							\
+    double    t;							\
+    TMP_DECL;								\
+									\
+    SPEED_RESTRICT_COND (s->size >= 1);					\
+									\
+    TMP_MARK;								\
+    SPEED_TMP_ALLOC_LIMBS (tp, 2 * s->size, s->align_wp);		\
+    SPEED_TMP_ALLOC_LIMBS (wp, 2 * s->size, s->align_wp);		\
+									\
+    speed_operand_src (s, s->xp, s->size);				\
+    speed_operand_src (s, tp, 2 * s->size);				\
+    speed_operand_dst (s, wp, 2 * s->size);				\
+    speed_cache_fill (s);						\
+									\
+    speed_starttime ();							\
+    i = s->reps;							\
+    do									\
+      call;								\
+    while (--i != 0);							\
+    t = speed_endtime () / 2;						\
+									\
+    TMP_FREE;								\
+    return t;								\
+  }
 
 #define SPEED_ROUTINE_MPN_SQR_TSPACE(call, tsize, minsize)		\
   {									\


More information about the gmp-commit mailing list