[Gmp-commit] /var/hg/gmp: Add speed support for mpn_addaddmul_1msb0.

mercurial at gmplib.org mercurial at gmplib.org
Thu Oct 7 15:05:37 UTC 2021


details:   /var/hg/gmp/rev/4e0d8bc58e24
changeset: 18255:4e0d8bc58e24
user:      Niels Möller <nisse at lysator.liu.se>
date:      Thu Oct 07 17:04:31 2021 +0200
description:
Add speed support for mpn_addaddmul_1msb0.

* tune/speed.h (SPEED_ROUTINE_MPN_ADDADDMUL1_MSB0): New macro.
* tune/common.c (speed_mpn_addaddmul_1msb0): New function.
* tune/speed.c (routine): Add mpn_addaddmul_1msb0 to list.

diffstat:

 ChangeLog     |   6 ++++++
 tune/common.c |   7 +++++++
 tune/speed.c  |   3 +++
 tune/speed.h  |  31 +++++++++++++++++++++++++++++++
 4 files changed, 47 insertions(+), 0 deletions(-)

diffs (91 lines):

diff -r 6a2372c2f54f -r 4e0d8bc58e24 ChangeLog
--- a/ChangeLog	Thu Oct 07 01:23:31 2021 +0200
+++ b/ChangeLog	Thu Oct 07 17:04:31 2021 +0200
@@ -1,3 +1,9 @@
+2021-10-07  Niels Möller  <nisse at lysator.liu.se>
+
+	* tune/speed.h (SPEED_ROUTINE_MPN_ADDADDMUL1_MSB0): New macro.
+	* tune/common.c (speed_mpn_addaddmul_1msb0): New function.
+	* tune/speed.c (routine): Add mpn_addaddmul_1msb0 to list.
+
 2021-10-01 Marco Bodrato <bodrato at mail.dm.unipi.it>
 
 	* gen-sieve.c: New file to generate a small presieved array.
diff -r 6a2372c2f54f -r 4e0d8bc58e24 tune/common.c
--- a/tune/common.c	Thu Oct 07 01:23:31 2021 +0200
+++ b/tune/common.c	Thu Oct 07 17:04:31 2021 +0200
@@ -546,6 +546,13 @@
 }
 #endif
 
+#if HAVE_NATIVE_mpn_addaddmul_1msb0
+double
+speed_mpn_addaddmul_1msb0 (struct speed_params *s)
+{
+  SPEED_ROUTINE_MPN_ADDADDMUL1_MSB0 (mpn_addaddmul_1msb0);
+}
+#endif
 double
 speed_mpn_mul_1 (struct speed_params *s)
 {
diff -r 6a2372c2f54f -r 4e0d8bc58e24 tune/speed.c
--- a/tune/speed.c	Thu Oct 07 01:23:31 2021 +0200
+++ b/tune/speed.c	Thu Oct 07 17:04:31 2021 +0200
@@ -191,6 +191,9 @@
 #if HAVE_NATIVE_mpn_addmul_8
   { "mpn_addmul_8",      speed_mpn_addmul_8,  FLAG_R_OPTIONAL },
 #endif
+#if HAVE_NATIVE_mpn_addaddmul_1msb0
+  { "mpn_addaddmul_1msb0",      speed_mpn_addaddmul_1msb0, FLAG_R_OPTIONAL },
+#endif
   { "mpn_mul_1",         speed_mpn_mul_1,     FLAG_R },
   { "mpn_mul_1_inplace", speed_mpn_mul_1_inplace, FLAG_R },
 #if HAVE_NATIVE_mpn_mul_2
diff -r 6a2372c2f54f -r 4e0d8bc58e24 tune/speed.h
--- a/tune/speed.h	Thu Oct 07 01:23:31 2021 +0200
+++ b/tune/speed.h	Thu Oct 07 17:04:31 2021 +0200
@@ -181,6 +181,7 @@
 double speed_mpn_addmul_6 (struct speed_params *);
 double speed_mpn_addmul_7 (struct speed_params *);
 double speed_mpn_addmul_8 (struct speed_params *);
+double speed_mpn_addaddmul_1msb0 (struct speed_params *);
 double speed_mpn_cnd_add_n (struct speed_params *);
 double speed_mpn_cnd_sub_n (struct speed_params *);
 double speed_mpn_com (struct speed_params *);
@@ -1076,6 +1077,36 @@
 #define SPEED_ROUTINE_MPN_UNARY_8(function)				\
   SPEED_ROUTINE_MPN_UNARY_N (function, 8)
 
+#define SPEED_ROUTINE_MPN_ADDADDMUL1_MSB0(function)			\
+  {									\
+    mp_ptr     wp;							\
+    unsigned   i;							\
+    double     t;							\
+    mp_limb_t  r;							\
+    TMP_DECL;								\
+									\
+    SPEED_RESTRICT_COND (s->size >= 1);					\
+									\
+    TMP_MARK;								\
+    SPEED_TMP_ALLOC_LIMBS (wp, s->size, s->align_wp);			\
+    speed_operand_src (s, s->xp, s->size);				\
+    speed_operand_src (s, s->yp, s->size);				\
+    speed_operand_dst (s, wp, s->size);					\
+    speed_cache_fill (s);						\
+									\
+    r = s->r != 0 ? s->r : MP_BASES_BIG_BASE_10;			\
+    r &= ~GMP_NUMB_HIGHBIT;						\
+									\
+    speed_starttime ();							\
+    i = s->reps;							\
+    do									\
+      function (wp, s->xp, s->yp, s->size, r, r);			\
+    while (--i != 0);							\
+    t = speed_endtime ();						\
+									\
+    TMP_FREE;								\
+    return t;								\
+  }
 
 /* For mpn_mul, mpn_mul_basecase, xsize=r, ysize=s->size. */
 #define SPEED_ROUTINE_MPN_MUL(function)					\


More information about the gmp-commit mailing list