summaryrefslogtreecommitdiff
path: root/tune
diff options
context:
space:
mode:
Diffstat (limited to 'tune')
-rw-r--r--tune/common.c36
-rw-r--r--tune/speed.c3
-rw-r--r--tune/speed.h3
3 files changed, 37 insertions, 5 deletions
diff --git a/tune/common.c b/tune/common.c
index f350171b6..a794aafe6 100644
--- a/tune/common.c
+++ b/tune/common.c
@@ -1,6 +1,6 @@
/* Shared speed subroutines.
-Copyright 1999-2006, 2008-2015 Free Software Foundation, Inc.
+Copyright 1999-2006, 2008-2016 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -2039,8 +2039,8 @@ speed_mpz_add (struct speed_params *s)
}
-/* If r==0, calculate (size,size/2),
- otherwise calculate (size,r). */
+/* If r==0, calculate binomial(size,size/2),
+ otherwise calculate binomial(size,r). */
double
speed_mpz_bin_uiui (struct speed_params *s)
@@ -2104,6 +2104,36 @@ speed_mpz_bin_ui (struct speed_params *s)
return t;
}
+/* If r==0, calculate mfac(size,log(size)),
+ otherwise calculate mfac(size,r). */
+
+double
+speed_mpz_mfac_uiui (struct speed_params *s)
+{
+ mpz_t w;
+ unsigned long k;
+ unsigned i;
+ double t;
+
+ mpz_init (w);
+ if (s->r != 0)
+ k = s->r;
+ else
+ for (k = 1; s->size >> k; ++k);
+
+ speed_starttime ();
+ i = s->reps;
+ do
+ {
+ mpz_mfac_uiui (w, s->size, k);
+ }
+ while (--i != 0);
+ t = speed_endtime ();
+
+ mpz_clear (w);
+ return t;
+}
+
/* The multiplies are successively dependent so the latency is measured, not
the issue rate. There's only 10 per loop so the code doesn't get too big
since umul_ppmm is several instructions on some cpus.
diff --git a/tune/speed.c b/tune/speed.c
index e33775b3b..b49d5abf6 100644
--- a/tune/speed.c
+++ b/tune/speed.c
@@ -1,6 +1,6 @@
/* Speed measuring program.
-Copyright 1999-2003, 2005, 2006, 2008-2015 Free Software Foundation, Inc.
+Copyright 1999-2003, 2005, 2006, 2008-2016 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -407,6 +407,7 @@ const struct routine_t {
{ "mpz_bin_ui", speed_mpz_bin_ui, FLAG_NODATA | FLAG_R_OPTIONAL },
{ "mpz_fac_ui", speed_mpz_fac_ui, FLAG_NODATA },
{ "mpz_2fac_ui", speed_mpz_2fac_ui, FLAG_NODATA },
+ { "mpz_mfac_uiui", speed_mpz_mfac_uiui, FLAG_NODATA | FLAG_R_OPTIONAL },
{ "mpz_primorial_ui", speed_mpz_primorial_ui, FLAG_NODATA },
{ "mpz_powm", speed_mpz_powm },
{ "mpz_powm_mod", speed_mpz_powm_mod },
diff --git a/tune/speed.h b/tune/speed.h
index be1966368..dd95372c9 100644
--- a/tune/speed.h
+++ b/tune/speed.h
@@ -1,6 +1,6 @@
/* Header for speed and threshold things.
-Copyright 1999-2003, 2005, 2006, 2008-2015 Free Software Foundation, Inc.
+Copyright 1999-2003, 2005, 2006, 2008-2016 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -388,6 +388,7 @@ double speed_mpz_bin_uiui (struct speed_params *);
double speed_mpz_bin_ui (struct speed_params *);
double speed_mpz_fac_ui (struct speed_params *);
double speed_mpz_2fac_ui (struct speed_params *);
+double speed_mpz_mfac_uiui (struct speed_params *);
double speed_mpz_primorial_ui (struct speed_params *);
double speed_mpz_fib_ui (struct speed_params *);
double speed_mpz_fib2_ui (struct speed_params *);