summaryrefslogtreecommitdiff
path: root/tune
diff options
context:
space:
mode:
authorNiels M?ller <nisse@lysator.liu.se>2019-09-04 20:09:20 +0200
committerNiels M?ller <nisse@lysator.liu.se>2019-09-04 20:09:20 +0200
commit74469d71e6792fccdfb17f2913aaabafb7094a89 (patch)
tree017c30f0f9391d2e89daf7b08098576013a385f9 /tune
parenta1d52672b638129c9639ea034765ec67c07abff5 (diff)
downloadgmp-74469d71e6792fccdfb17f2913aaabafb7094a89.tar.gz
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 (limited to 'tune')
-rw-r--r--tune/common.c6
-rw-r--r--tune/speed.c1
-rw-r--r--tune/speed.h35
3 files changed, 42 insertions, 0 deletions
diff --git a/tune/common.c b/tune/common.c
index 0b3f491b7..a918a67a4 100644
--- a/tune/common.c
+++ b/tune/common.c
@@ -1634,6 +1634,12 @@ speed_mpn_matrix22_mul (struct speed_params *s)
}
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 --git a/tune/speed.c b/tune/speed.c
index a013a24b7..4220d6be5 100644
--- a/tune/speed.c
+++ b/tune/speed.c
@@ -285,6 +285,7 @@ const struct routine_t {
{ "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 --git a/tune/speed.h b/tune/speed.h
index 25b154203..044bc9c2b 100644
--- a/tune/speed.h
+++ b/tune/speed.h
@@ -214,6 +214,7 @@ double speed_mpn_div_qr_2n (struct speed_params *);
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 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
}, \
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) \
{ \