summaryrefslogtreecommitdiff
path: root/tune
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2011-07-31 08:59:53 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2011-07-31 08:59:53 +0000
commit88b5b5ee10cd8bdc3e10149f486186398be5cb23 (patch)
tree84f53f15cc605598c1e7c57e6de4cc63a0b072cc /tune
parentc3308f4337d0bcb4206eb1058af79c8c82822678 (diff)
downloadmpfr-88b5b5ee10cd8bdc3e10149f486186398be5cb23.tar.gz
Added tuning for MPFR_DIV_THRESHOLD, and default value.
It now remains to do the tuning on the architectures in mparam_in.h. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@7768 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tune')
-rw-r--r--tune/tuneup.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/tune/tuneup.c b/tune/tuneup.c
index d99cdeddf..66bb52a81 100644
--- a/tune/tuneup.c
+++ b/tune/tuneup.c
@@ -273,14 +273,18 @@ speed_mpfr_sincos (struct speed_params *s)
SPEED_MPFR_FUNC2 (mpfr_sin_cos);
}
-/* Setup mpfr_mul and mpfr_sqr */
+/* Setup mpfr_mul, mpfr_sqr and mpfr_div */
mpfr_prec_t mpfr_mul_threshold;
mpfr_prec_t mpfr_sqr_threshold;
+mpfr_prec_t mpfr_div_threshold;
#undef MPFR_MUL_THRESHOLD
#define MPFR_MUL_THRESHOLD mpfr_mul_threshold
#undef MPFR_SQR_THRESHOLD
#define MPFR_SQR_THRESHOLD mpfr_sqr_threshold
+#undef MPFR_DIV_THRESHOLD
+#define MPFR_DIV_THRESHOLD mpfr_div_threshold
#include "mul.c"
+#include "div.c"
static double
speed_mpfr_mul (struct speed_params *s)
{
@@ -291,6 +295,11 @@ speed_mpfr_sqr (struct speed_params *s)
{
SPEED_MPFR_SQR (mpfr_mul);
}
+static double
+speed_mpfr_div (struct speed_params *s)
+{
+ SPEED_MPFR_OP (mpfr_div);
+}
/************************************************
* Common functions (inspired by GMP function) *
@@ -1056,6 +1065,14 @@ all (const char *filename)
fprintf (f, "#define MPFR_SQR_THRESHOLD %lu /* limbs */\n",
(unsigned long) (mpfr_sqr_threshold - 1) / GMP_NUMB_BITS + 1);
+ /* Tune mpfr_div (threshold is in limbs, but it doesn't matter too much) */
+ if (verbose)
+ printf ("Tuning mpfr_div...\n");
+ tune_simple_func (&mpfr_div_threshold, speed_mpfr_div,
+ 2*GMP_NUMB_BITS+1);
+ fprintf (f, "#define MPFR_DIV_THRESHOLD %lu /* limbs */\n",
+ (unsigned long) (mpfr_div_threshold - 1) / GMP_NUMB_BITS + 1);
+
/* Tune mpfr_exp_2 */
if (verbose)
printf ("Tuning mpfr_exp_2...\n");