summaryrefslogtreecommitdiff
path: root/tune/speed.h
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/speed.h
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/speed.h')
-rw-r--r--tune/speed.h35
1 files changed, 35 insertions, 0 deletions
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) \
{ \