diff options
author | Niels Möller <nisse@lysator.liu.se> | 2011-11-15 14:07:40 +0100 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2011-11-15 14:07:40 +0100 |
commit | 5153cf91d11990dbb6dc0291eb9eee2a6796b089 (patch) | |
tree | 204774767738eb8026a2bd697858963f1da4fa2a /tune | |
parent | 8467dfae35b0349c306be952466a6382818d4188 (diff) | |
download | gmp-5153cf91d11990dbb6dc0291eb9eee2a6796b089.tar.gz |
speed support for mpn_hgcd_appr_lehmer.
Diffstat (limited to 'tune')
-rw-r--r-- | tune/Makefile.am | 2 | ||||
-rw-r--r-- | tune/common.c | 8 | ||||
-rw-r--r-- | tune/hgcd_appr_lehmer.c | 29 | ||||
-rw-r--r-- | tune/speed.c | 1 | ||||
-rw-r--r-- | tune/speed.h | 7 |
5 files changed, 44 insertions, 3 deletions
diff --git a/tune/Makefile.am b/tune/Makefile.am index 38b1fe9d2..646a1f4af 100644 --- a/tune/Makefile.am +++ b/tune/Makefile.am @@ -43,7 +43,7 @@ libspeed_la_SOURCES = \ 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 --git a/tune/common.c b/tune/common.c index cc333a470..9855e8845 100644 --- a/tune/common.c +++ b/tune/common.c @@ -1529,7 +1529,7 @@ speed_mpn_hgcd (struct speed_params *s) 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 @@ speed_mpn_hgcd_appr (struct speed_params *s) } 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 --git a/tune/hgcd_appr_lehmer.c b/tune/hgcd_appr_lehmer.c new file mode 100644 index 000000000..18123e951 --- /dev/null +++ b/tune/hgcd_appr_lehmer.c @@ -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 --git a/tune/speed.c b/tune/speed.c index 08c13e776..cffed35b6 100644 --- a/tune/speed.c +++ b/tune/speed.c @@ -278,6 +278,7 @@ const struct routine_t { { "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 --git a/tune/speed.h b/tune/speed.h index 5add58720..329c09783 100644 --- a/tune/speed.h +++ b/tune/speed.h @@ -198,6 +198,7 @@ double speed_mpn_matrix22_mul __GMP_PROTO ((struct speed_params *s)); 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 @@ mp_size_t mpn_gcdext_double __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)); |