[Gmp-commit] /var/hg/gmp: Speed support for gcd_22.

mercurial at gmplib.org mercurial at gmplib.org
Fri Aug 16 06:21:56 UTC 2019


details:   /var/hg/gmp/rev/31d5fb37995b
changeset: 17817:31d5fb37995b
user:      Niels M?ller <nisse at lysator.liu.se>
date:      Fri Aug 16 08:21:42 2019 +0200
description:
Speed support for gcd_22.

Calls mpn_gcd_22(al, al, bl, bl), so that B+1 is a common factor.
* tune/speed.h (SPEED_ROUTINE_MPN_GCD_22): New macro.
* tune/speed.c (routine): Add mpn_gcd_22.
* tune/common.c (speed_mpn_gcd_22): New function.

diffstat:

 ChangeLog     |  6 ++++++
 tune/common.c |  5 +++++
 tune/speed.c  |  1 +
 tune/speed.h  |  7 +++++++
 4 files changed, 19 insertions(+), 0 deletions(-)

diffs (65 lines):

diff -r 3540ef669514 -r 31d5fb37995b ChangeLog
--- a/ChangeLog	Fri Aug 16 08:09:57 2019 +0200
+++ b/ChangeLog	Fri Aug 16 08:21:42 2019 +0200
@@ -1,5 +1,11 @@
 2019-08-16  Niels Möller  <nisse at lysator.liu.se>
 
+	Speed support for gcd_22. Calls mpn_gcd_22(al, al, bl, bl), so
+	that B+1 is a common factor.
+	* tune/speed.h (SPEED_ROUTINE_MPN_GCD_22): New macro.
+	* tune/speed.c (routine): Add mpn_gcd_22.
+	* tune/common.c (speed_mpn_gcd_22): New function.
+
 	* mpn/generic/gcd.c (gcd_2): Moved to gcd_22.c below.
 	(mpn_gcd): Adapt for calling gcd_22.
 	* mpn/generic/gcd_22.c (mpn_gcd_22): New file and function.
diff -r 3540ef669514 -r 31d5fb37995b tune/common.c
--- a/tune/common.c	Fri Aug 16 08:09:57 2019 +0200
+++ b/tune/common.c	Fri Aug 16 08:21:42 2019 +0200
@@ -1726,6 +1726,11 @@
 {
   SPEED_ROUTINE_MPN_GCD_1N (mpn_gcd_1);
 }
+double
+speed_mpn_gcd_22 (struct speed_params *s)
+{
+  SPEED_ROUTINE_MPN_GCD_22 (mpn_gcd_22);
+}
 
 
 double
diff -r 3540ef669514 -r 31d5fb37995b tune/speed.c
--- a/tune/speed.c	Fri Aug 16 08:09:57 2019 +0200
+++ b/tune/speed.c	Fri Aug 16 08:21:42 2019 +0200
@@ -297,6 +297,7 @@
   { "mpn_gcd_1",         speed_mpn_gcd_1,  FLAG_R_OPTIONAL },
   { "mpn_gcd_11",        speed_mpn_gcd_11, FLAG_R_OPTIONAL },
   { "mpn_gcd_1N",        speed_mpn_gcd_1N, FLAG_R_OPTIONAL },
+  { "mpn_gcd_22",        speed_mpn_gcd_22, FLAG_R_OPTIONAL },
 
   { "mpn_gcd",           speed_mpn_gcd                    },
 
diff -r 3540ef669514 -r 31d5fb37995b tune/speed.h
--- a/tune/speed.h	Fri Aug 16 08:09:57 2019 +0200
+++ b/tune/speed.h	Fri Aug 16 08:21:42 2019 +0200
@@ -225,6 +225,7 @@
 double speed_mpn_gcd_1 (struct speed_params *);
 double speed_mpn_gcd_11 (struct speed_params *);
 double speed_mpn_gcd_1N (struct speed_params *);
+double speed_mpn_gcd_22 (struct speed_params *);
 double speed_mpn_gcdext (struct speed_params *);
 double speed_mpn_gcdext_double (struct speed_params *);
 double speed_mpn_gcdext_one_double (struct speed_params *);
@@ -2825,6 +2826,12 @@
   SPEED_ROUTINE_MPN_GCD_1_CALL((px[i] |= 1, py[i] |= 1),		\
 			       function (px[j-1], py[j-1]))
 
+/* Multiply limbs by (B+1). Then we get a gcd exceeding one limb, so
+   we can measure gcd_22 loop only, without gcd_11. */
+#define SPEED_ROUTINE_MPN_GCD_22(function)				\
+  SPEED_ROUTINE_MPN_GCD_1_CALL((px[i] |= 1, py[i] |= 1),		\
+			       function (px[j-1], px[j-1], py[j-1], py[j-1]))
+
 #define SPEED_ROUTINE_MPN_JACBASE(function)				\
   SPEED_ROUTINE_MPN_GCD_1_CALL						\
     ({									\


More information about the gmp-commit mailing list