summaryrefslogtreecommitdiff
path: root/tune
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2011-12-31 10:21:18 +0100
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2011-12-31 10:21:18 +0100
commitc205839fc20ad86770afbdcfeebc334b6f3fb014 (patch)
tree02a066a4d894f0e367f61209137d7ebfb88afe3a /tune
parent6656b4969e1e3b97384296b6670cd99fc144b03f (diff)
downloadgmp-c205839fc20ad86770afbdcfeebc334b6f3fb014.tar.gz
Tune fac_ui thresholds.
Diffstat (limited to 'tune')
-rw-r--r--tune/Makefile.am12
-rw-r--r--tune/tuneup.c33
2 files changed, 41 insertions, 4 deletions
diff --git a/tune/Makefile.am b/tune/Makefile.am
index 646a1f4af..c0e0bbbab 100644
--- a/tune/Makefile.am
+++ b/tune/Makefile.am
@@ -1,6 +1,7 @@
## Process this file with automake to generate Makefile.in
-# Copyright 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+# Copyright 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009,
+# 2010, 2011 Free Software Foundation, Inc.
#
# This file is part of the GNU MP Library.
#
@@ -83,7 +84,7 @@ speed_ext_SOURCES = speed-ext.c
speed_ext_LDFLAGS = $(STATIC)
tuneup_SOURCES = tuneup.c
-nodist_tuneup_SOURCES = sqr_basecase.c $(TUNE_MPN_SRCS)
+nodist_tuneup_SOURCES = sqr_basecase.c fac_ui.c $(TUNE_MPN_SRCS)
tuneup_DEPENDENCIES = $(TUNE_SQR_OBJ) libspeed.la
tuneup_LDADD = $(tuneup_DEPENDENCIES) $(TUNE_LIBS)
tuneup_LDFLAGS = $(STATIC)
@@ -101,7 +102,7 @@ allprogs: $(EXTRA_PROGRAMS)
# $(MANY_CLEAN) and $(MANY_DISTCLEAN) are hooks for many.pl
CLEANFILES = $(EXTRA_PROGRAMS) $(EXTRA_LTLIBRARIES) \
- $(TUNE_MPN_SRCS) sqr_asm.asm \
+ $(TUNE_MPN_SRCS) fac_ui.c sqr_asm.asm \
stg.gnuplot stg.data \
mtg.gnuplot mtg.data \
fibg.gnuplot fibg.data \
@@ -158,5 +159,10 @@ sqr_asm.asm: $(top_builddir)/mpn/sqr_basecase.asm
echo 'define(SQR_TOOM2_THRESHOLD_OVERRIDE,SQR_TOOM2_THRESHOLD_MAX)' >sqr_asm.asm
echo 'include(../mpn/sqr_basecase.asm)' >>sqr_asm.asm
+# FIXME: Should it depend on $(top_builddir)/mpz/fac_ui.h too?
+fac_ui.c: $(top_builddir)/mpz/fac_ui.c
+ echo "#define TUNE_PROGRAM_BUILD 1" >fac_ui.c
+ echo "#define __gmpz_fac_ui mpz_fac_ui_tune" >>fac_ui.c
+ echo "#include \"mpz/fac_ui.c\"" >>fac_ui.c
include ../mpn/Makeasm.am
diff --git a/tune/tuneup.c b/tune/tuneup.c
index bc7e8cc3d..ce84e8fa7 100644
--- a/tune/tuneup.c
+++ b/tune/tuneup.c
@@ -214,6 +214,8 @@ mp_size_t get_str_dc_threshold = MP_SIZE_T_MAX;
mp_size_t get_str_precompute_threshold = MP_SIZE_T_MAX;
mp_size_t set_str_dc_threshold = MP_SIZE_T_MAX;
mp_size_t set_str_precompute_threshold = MP_SIZE_T_MAX;
+mp_size_t fac_odd_threshold = MP_SIZE_T_MAX;
+mp_size_t fac_dsc_threshold = FAC_DSC_THRESHOLD_LIMIT;
mp_size_t fft_modf_sqr_threshold = MP_SIZE_T_MAX;
mp_size_t fft_modf_mul_threshold = MP_SIZE_T_MAX;
@@ -366,12 +368,15 @@ analyze_dat (int final)
}
-/* Measuring for recompiled mpn/generic/divrem_1.c and mpn/generic/mod_1.c */
+/* Measuring for recompiled mpn/generic/divrem_1.c, mpn/generic/mod_1.c
+ * and mpz/fac_ui.c */
mp_limb_t mpn_divrem_1_tune
__GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t));
mp_limb_t mpn_mod_1_tune
__GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t));
+void mpz_fac_ui_tune
+ __GMP_PROTO ((mpz_ptr, unsigned long));
double
speed_mpn_mod_1_tune (struct speed_params *s)
@@ -383,6 +388,11 @@ speed_mpn_divrem_1_tune (struct speed_params *s)
{
SPEED_ROUTINE_MPN_DIVREM_1 (mpn_divrem_1_tune);
}
+double
+speed_mpz_fac_ui_tune (struct speed_params *s)
+{
+ SPEED_ROUTINE_MPZ_FAC_UI (mpz_fac_ui_tune);
+}
double
@@ -2612,6 +2622,24 @@ tune_fft_sqr (void)
}
void
+tune_fac_ui (void)
+{
+ static struct param_t param;
+
+ param.function = speed_mpz_fac_ui_tune;
+
+ param.name = "FAC_ODD_THRESHOLD";
+ param.min_size = 3;
+ param.min_is_always = 0;
+ one (&fac_odd_threshold, &param);
+
+ param.name = "FAC_DSC_THRESHOLD";
+ param.min_size = MAX (32, fac_odd_threshold);
+ param.max_size = FAC_DSC_THRESHOLD_LIMIT;
+ one (&fac_dsc_threshold, &param);
+}
+
+void
all (void)
{
time_t start_time, end_time;
@@ -2747,6 +2775,9 @@ all (void)
tune_set_str ();
printf("\n");
+ tune_fac_ui ();
+ printf("\n");
+
time (&end_time);
printf ("/* Tuneup completed successfully, took %ld seconds */\n",
(long) (end_time - start_time));