From 2d4d5a474a3b056bba4a4166b4f2fbdb271f59ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Thu, 7 Oct 2021 17:04:31 +0200 Subject: 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. --- tune/common.c | 7 +++++++ tune/speed.c | 3 +++ tune/speed.h | 31 +++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+) (limited to 'tune') diff --git a/tune/common.c b/tune/common.c index a62e0a91a..4f68b2652 100644 --- a/tune/common.c +++ b/tune/common.c @@ -546,6 +546,13 @@ speed_mpn_addmul_8 (struct speed_params *s) } #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 --git a/tune/speed.c b/tune/speed.c index eb793ee51..f26771168 100644 --- a/tune/speed.c +++ b/tune/speed.c @@ -190,6 +190,9 @@ const struct routine_t { #endif #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 }, diff --git a/tune/speed.h b/tune/speed.h index 636b7671e..7fb0a8068 100644 --- a/tune/speed.h +++ b/tune/speed.h @@ -181,6 +181,7 @@ double speed_mpn_addmul_5 (struct speed_params *); 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 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int); #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) \ -- cgit v1.2.1