[Gmp-commit] /var/hg/gmp: 2 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Tue Nov 15 14:58:52 CET 2011
details: /var/hg/gmp/rev/23fe9d322dab
changeset: 14443:23fe9d322dab
user: Niels M?ller <nisse at lysator.liu.se>
date: Tue Nov 15 14:01:48 2011 +0100
description:
Further tweak for HGCD_APPR_THRESHOLD tuning.
details: /var/hg/gmp/rev/b66600cb7949
changeset: 14444:b66600cb7949
user: Niels M?ller <nisse at lysator.liu.se>
date: Tue Nov 15 14:07:40 2011 +0100
description:
speed support for mpn_hgcd_appr_lehmer.
diffstat:
ChangeLog | 22 ++++++++++++++++++++++
tune/Makefile.am | 2 +-
tune/common.c | 8 +++++++-
tune/hgcd_appr_lehmer.c | 29 +++++++++++++++++++++++++++++
tune/speed.c | 1 +
tune/speed.h | 7 ++++++-
tune/tuneup.c | 2 ++
7 files changed, 68 insertions(+), 3 deletions(-)
diffs (146 lines):
diff -r ea546be31e2a -r b66600cb7949 ChangeLog
--- a/ChangeLog Tue Nov 15 01:33:25 2011 +0100
+++ b/ChangeLog Tue Nov 15 14:07:40 2011 +0100
@@ -1,3 +1,25 @@
+2011-11-15 Niels Möller <nisse at lysator.liu.se>
+
+ * tune/speed.h (speed_mpn_hgcd_appr_lehmer): New prototype.
+ (mpn_hgcd_lehmer_itch): Likewise.
+ (mpn_hgcd_appr_lehmer): Likewise.
+ (mpn_hgcd_appr_lehmer_itch): Likewise.
+ (MPN_HGCD_LEHMER_ITCH): Deleted macro.
+
+ * tune/speed.c (routine): Added mpn_hgcd_appr_lehmer.
+
+ * tune/common.c (speed_mpn_hgcd_lehmer): Use mpn_hgcd_lehmer_itch
+ rather than similarly named macro.
+ (speed_mpn_hgcd_appr_lehmer): New function.
+
+ * tune/Makefile.am (libspeed_la_SOURCES): Added
+ hgcd_appr_lehmer.c.
+
+ * tune/hgcd_appr_lehmer.c: New file.
+
+ * tune/tuneup.c (tune_hgcd_appr): Increased min_size to 50; some
+ machines got small thresholds which appear to be bogus.
+
2011-11-15 Torbjorn Granlund <tege at gmplib.org>
* configure.in: Amend 2011-11-03 gcc_cflags change.
diff -r ea546be31e2a -r b66600cb7949 tune/Makefile.am
--- a/tune/Makefile.am Tue Nov 15 01:33:25 2011 +0100
+++ b/tune/Makefile.am Tue Nov 15 14:07:40 2011 +0100
@@ -43,7 +43,7 @@
common.c divrem1div.c divrem1inv.c divrem2div.c divrem2inv.c \
freq.c \
gcdext_single.c gcdext_double.c gcdextod.c gcdextos.c \
- hgcd_lehmer.c hgcd_reduce_1.c hgcd_reduce_2.c \
+ hgcd_lehmer.c hgcd_appr_lehmer.c hgcd_reduce_1.c hgcd_reduce_2.c \
jacbase1.c jacbase2.c jacbase3.c jacbase4.c \
mod_1_div.c mod_1_inv.c mod_1_1-1.c mod_1_1-2.c modlinv.c \
noop.c powm_mod.c powm_redc.c pre_divrem_1.c \
diff -r ea546be31e2a -r b66600cb7949 tune/common.c
--- a/tune/common.c Tue Nov 15 01:33:25 2011 +0100
+++ b/tune/common.c Tue Nov 15 14:07:40 2011 +0100
@@ -1529,7 +1529,7 @@
double
speed_mpn_hgcd_lehmer (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_HGCD_CALL (mpn_hgcd_lehmer, MPN_HGCD_LEHMER_ITCH);
+ SPEED_ROUTINE_MPN_HGCD_CALL (mpn_hgcd_lehmer, mpn_hgcd_lehmer_itch);
}
double
@@ -1539,6 +1539,12 @@
}
double
+speed_mpn_hgcd_appr_lehmer (struct speed_params *s)
+{
+ SPEED_ROUTINE_MPN_HGCD_CALL (mpn_hgcd_appr_lehmer, mpn_hgcd_appr_lehmer_itch);
+}
+
+double
speed_mpn_hgcd_reduce (struct speed_params *s)
{
SPEED_ROUTINE_MPN_HGCD_REDUCE_CALL (mpn_hgcd_reduce, mpn_hgcd_reduce_itch);
diff -r ea546be31e2a -r b66600cb7949 tune/hgcd_appr_lehmer.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tune/hgcd_appr_lehmer.c Tue Nov 15 14:07:40 2011 +0100
@@ -0,0 +1,29 @@
+/* mpn/generic/hgcd_appr.c forced to use Lehmer's quadratic algorithm. */
+
+/*
+Copyright 2010, 2011 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+
+#undef HGCD_APPR_THRESHOLD
+#define HGCD_APPR_THRESHOLD MP_SIZE_T_MAX
+#define __gmpn_hgcd_appr mpn_hgcd_appr_lehmer
+#define __gmpn_hgcd_appr_itch mpn_hgcd_appr_lehmer_itch
+
+#include "../mpn/generic/hgcd_appr.c"
diff -r ea546be31e2a -r b66600cb7949 tune/speed.c
--- a/tune/speed.c Tue Nov 15 01:33:25 2011 +0100
+++ b/tune/speed.c Tue Nov 15 14:07:40 2011 +0100
@@ -278,6 +278,7 @@
{ "mpn_hgcd", speed_mpn_hgcd },
{ "mpn_hgcd_lehmer", speed_mpn_hgcd_lehmer },
{ "mpn_hgcd_appr", speed_mpn_hgcd_appr },
+ { "mpn_hgcd_appr_lehmer", speed_mpn_hgcd_appr_lehmer },
{ "mpn_hgcd_reduce", speed_mpn_hgcd_reduce },
{ "mpn_hgcd_reduce_1", speed_mpn_hgcd_reduce_1 },
diff -r ea546be31e2a -r b66600cb7949 tune/speed.h
--- a/tune/speed.h Tue Nov 15 01:33:25 2011 +0100
+++ b/tune/speed.h Tue Nov 15 14:07:40 2011 +0100
@@ -198,6 +198,7 @@
double speed_mpn_hgcd __GMP_PROTO ((struct speed_params *s));
double speed_mpn_hgcd_lehmer __GMP_PROTO ((struct speed_params *s));
double speed_mpn_hgcd_appr __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_hgcd_appr_lehmer __GMP_PROTO ((struct speed_params *s));
double speed_mpn_hgcd_reduce __GMP_PROTO ((struct speed_params *s));
double speed_mpn_hgcd_reduce_1 __GMP_PROTO ((struct speed_params *s));
double speed_mpn_hgcd_reduce_2 __GMP_PROTO ((struct speed_params *s));
@@ -489,7 +490,11 @@
__GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_size_t, mp_ptr, mp_size_t));
mp_size_t mpn_hgcd_lehmer
__GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, struct hgcd_matrix *, mp_ptr));
-#define MPN_HGCD_LEHMER_ITCH(n) (n)
+mp_size_t mpn_hgcd_lehmer_itch __GMP_PROTO ((mp_size_t));
+
+mp_size_t mpn_hgcd_appr_lehmer
+ __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, struct hgcd_matrix *, mp_ptr));
+mp_size_t mpn_hgcd_appr_lehmer_itch __GMP_PROTO ((mp_size_t));
mp_size_t mpn_hgcd_reduce_1
__GMP_PROTO ((struct hgcd_matrix *, mp_ptr, mp_ptr, mp_size_t, mp_size_t, mp_ptr));
diff -r ea546be31e2a -r b66600cb7949 tune/tuneup.c
--- a/tune/tuneup.c Tue Nov 15 01:33:25 2011 +0100
+++ b/tune/tuneup.c Tue Nov 15 14:07:40 2011 +0100
@@ -1761,6 +1761,8 @@
static struct param_t param;
param.name = "HGCD_APPR_THRESHOLD";
param.function = speed_mpn_hgcd_appr;
+ /* We seem to get strange results for small sizes */
+ param.min_size = 50;
one (&hgcd_appr_threshold, ¶m);
}
More information about the gmp-commit
mailing list