[Gmp-commit] /var/hg/gmp: Speed support for mpn_hgcd2.
mercurial at gmplib.org
mercurial at gmplib.org
Wed Sep 4 18:09:55 UTC 2019
details: /var/hg/gmp/rev/fcd2d9b71d76
changeset: 17863:fcd2d9b71d76
user: Niels M?ller <nisse at lysator.liu.se>
date: Wed Sep 04 20:09:20 2019 +0200
description:
Speed support for mpn_hgcd2.
* tune/speed.h (SPEED_ROUTINE_MPN_HGCD2): New macro.
* tune/common.c (speed_mpn_hgcd2): New function.
* tune/speed.c (routine): Add mpn_hgcd2.
diffstat:
ChangeLog | 6 ++++++
tune/common.c | 6 ++++++
tune/speed.c | 1 +
tune/speed.h | 35 +++++++++++++++++++++++++++++++++++
4 files changed, 48 insertions(+), 0 deletions(-)
diffs (92 lines):
diff -r b1ea8c11ae1e -r fcd2d9b71d76 ChangeLog
--- a/ChangeLog Wed Sep 04 06:18:08 2019 +0200
+++ b/ChangeLog Wed Sep 04 20:09:20 2019 +0200
@@ -1,3 +1,9 @@
+2019-09-04 Niels Möller <nisse at lysator.liu.se>
+
+ * tune/speed.h (SPEED_ROUTINE_MPN_HGCD2): New macro.
+ * tune/common.c (speed_mpn_hgcd2): New function.
+ * tune/speed.c (routine): Add mpn_hgcd2.
+
2019-08-22 Niels Möller <nisse at lysator.liu.se>
From Hugh McMaster:
diff -r b1ea8c11ae1e -r fcd2d9b71d76 tune/common.c
--- a/tune/common.c Wed Sep 04 06:18:08 2019 +0200
+++ b/tune/common.c Wed Sep 04 20:09:20 2019 +0200
@@ -1634,6 +1634,12 @@
}
double
+speed_mpn_hgcd2 (struct speed_params *s)
+{
+ SPEED_ROUTINE_MPN_HGCD2 (mpn_hgcd2);
+}
+
+double
speed_mpn_hgcd (struct speed_params *s)
{
SPEED_ROUTINE_MPN_HGCD_CALL (mpn_hgcd, mpn_hgcd_itch);
diff -r b1ea8c11ae1e -r fcd2d9b71d76 tune/speed.c
--- a/tune/speed.c Wed Sep 04 06:18:08 2019 +0200
+++ b/tune/speed.c Wed Sep 04 20:09:20 2019 +0200
@@ -285,6 +285,7 @@
{ "mpn_matrix22_mul", speed_mpn_matrix22_mul },
+ { "mpn_hgcd2", speed_mpn_hgcd2, FLAG_NODATA },
{ "mpn_hgcd", speed_mpn_hgcd },
{ "mpn_hgcd_lehmer", speed_mpn_hgcd_lehmer },
{ "mpn_hgcd_appr", speed_mpn_hgcd_appr },
diff -r b1ea8c11ae1e -r fcd2d9b71d76 tune/speed.h
--- a/tune/speed.h Wed Sep 04 06:18:08 2019 +0200
+++ b/tune/speed.h Wed Sep 04 20:09:20 2019 +0200
@@ -214,6 +214,7 @@
double speed_mpn_div_qr_2u (struct speed_params *);
double speed_mpn_fib2_ui (struct speed_params *);
double speed_mpn_matrix22_mul (struct speed_params *);
+double speed_mpn_hgcd2 (struct speed_params *);
double speed_mpn_hgcd (struct speed_params *);
double speed_mpn_hgcd_lehmer (struct speed_params *);
double speed_mpn_hgcd_appr (struct speed_params *);
@@ -2843,6 +2844,40 @@
}, \
function (px[j-1], py[j-1], 0))
+#define SPEED_ROUTINE_MPN_HGCD2(function) \
+ { \
+ unsigned i, j; \
+ struct hgcd_matrix1 m = {{{0,0},{0,0}}}; \
+ double t; \
+ \
+ speed_operand_src (s, s->xp_block, SPEED_BLOCK_SIZE); \
+ speed_operand_src (s, s->yp_block, SPEED_BLOCK_SIZE); \
+ speed_cache_fill (s); \
+ \
+ speed_starttime (); \
+ i = s->reps; \
+ mp_limb_t chain = 0; \
+ do \
+ { \
+ for (j = 0; j < SPEED_BLOCK_SIZE; j+= 2) \
+ { \
+ /* randomized but successively dependent */ \
+ function (s->xp_block[j] | GMP_NUMB_HIGHBIT, \
+ s->xp_block[j+1] + chain, \
+ s->yp_block[j] | GMP_NUMB_HIGHBIT, \
+ s->yp_block[j+1], &m); \
+ chain += m.u[0][0]; \
+ } \
+ } \
+ while (--i != 0); \
+ t = speed_endtime (); \
+ \
+ /* make sure the compiler won't optimize away chain */ \
+ noop_1 (chain); \
+ \
+ s->time_divisor = SPEED_BLOCK_SIZE / 2; \
+ return t; \
+ }
#define SPEED_ROUTINE_MPN_HGCD_CALL(func, itchfunc) \
{ \
More information about the gmp-commit
mailing list