summaryrefslogtreecommitdiff
path: root/tune
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2021-10-07 17:04:31 +0200
committerNiels Möller <nisse@lysator.liu.se>2021-10-07 17:04:31 +0200
commit2d4d5a474a3b056bba4a4166b4f2fbdb271f59ce (patch)
treef6e184138ca02ff5b3cc5adc8201d94951b2af5f /tune
parent1d4340bb853b78ce4a29de53f17bf9fc7301178f (diff)
downloadgmp-2d4d5a474a3b056bba4a4166b4f2fbdb271f59ce.tar.gz
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.
Diffstat (limited to 'tune')
-rw-r--r--tune/common.c7
-rw-r--r--tune/speed.c3
-rw-r--r--tune/speed.h31
3 files changed, 41 insertions, 0 deletions
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
@@ -191,6 +191,9 @@ const struct routine_t {
#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 },
#if HAVE_NATIVE_mpn_mul_2
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) \