[Gmp-commit] /home/hgfiles/gmp: New sqrmod_bnm1, with test and speed support.
mercurial at gmplib.org
mercurial at gmplib.org
Thu Dec 17 16:28:26 CET 2009
details: /home/hgfiles/gmp/rev/207c2e42f269
changeset: 13111:207c2e42f269
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Thu Dec 17 16:28:21 2009 +0100
description:
New sqrmod_bnm1, with test and speed support.
diffstat:
ChangeLog | 15 ++++++++++++++-
configure.in | 2 +-
gmp-impl.h | 12 +++++++++++-
tests/mpn/Makefile.am | 2 +-
tests/mpn/t-mulmod_bnm1.c | 2 ++
tune/Makefile.am | 1 +
tune/common.c | 6 ++++++
tune/speed.c | 1 +
tune/speed.h | 1 +
9 files changed, 38 insertions(+), 4 deletions(-)
diffs (162 lines):
diff -r 054bd0e275bf -r 207c2e42f269 ChangeLog
--- a/ChangeLog Thu Dec 17 15:23:26 2009 +0100
+++ b/ChangeLog Thu Dec 17 16:28:21 2009 +0100
@@ -14,7 +14,7 @@
the initial quotient block is a single limb, use 3/2 division,
thereby eliminating the only use of gmp_pi1_t->inv21.
-2009-12-15 Marco Bodrato <bodrato at mail.dm.unipi.it>
+2009-12-17 Marco Bodrato <bodrato at mail.dm.unipi.it>
* mpn/generic/invert.c: Added some comment.
* mpn/generic/invertappr.c: Slightly better threshold handling.
@@ -28,6 +28,18 @@
* tune/common.c (speed_mpn_nussbaumer_mul): New function.
* tune/speed.c (routine): Add speed_mpn_nussbaumer_mul.
+ * mpn/generic/sqrmod_bnm1.c: New file.
+ * configure.in (gmp_mpn_functions): Add sqrmod_bnm1.
+ * tune/Makefile.am (TUNE_MPN_SRCS_BASIC): Add sqrmod_bnm1.
+ * gmp-impl.h (mpn_sqrmod_bnm1): Added prototype and name-mangling.
+ (SQRMOD_BNM1_THRESHOLD): support for the new threshold.
+ * tune/speed.h (speed_mpn_sqrmod_bnm1): Declare function.
+ * tune/common.c (speed_mpn_sqrmod_bnm1): New function.
+ * tune/speed.c (routine): Add speed_mpn_sqrmod_bnm1.
+ * tests/mpn/t-mulmod_bnm1.c: Attribution.
+ * tests/mpn/t-sqrmod_bnm1.c: New test file.
+ * tests/mpn/Makefile.am (check_PROGRAMS): Add t-sqrmod_bnm1.
+
2009-12-17 Torbjorn Granlund <tege at gmplib.org>
* mpn/generic/bdiv_q.c (mpn_bdiv_q_itch): Rewrite.
@@ -527,6 +539,7 @@
2009-11-26 Marco Bodrato <bodrato at mail.dm.unipi.it>
* tests/mpn/t-mulmod_bnm1.c: New test file.
+ * tests/mpn/Makefile.am (check_PROGRAMS): Add t-mulmod_bnm1.
* mpn/generic/mullow_n.c: Comments on Mulders' trick implementation.
diff -r 054bd0e275bf -r 207c2e42f269 configure.in
--- a/configure.in Thu Dec 17 15:23:26 2009 +0100
+++ b/configure.in Thu Dec 17 16:28:21 2009 +0100
@@ -2496,7 +2496,7 @@
toom_eval_dgr3_pm1 toom_eval_dgr3_pm2 \
toom_eval_pm1 toom_eval_pm2 toom_eval_pm2exp \
toom_interpolate_5pts toom_interpolate_6pts toom_interpolate_7pts \
- invertappr invert binvert mulmod_bnm1 \
+ invertappr invert binvert mulmod_bnm1 sqrmod_bnm1 \
sbpi1_div_q sbpi1_div_qr sbpi1_divappr_q \
dcpi1_div_q dcpi1_div_qr dcpi1_divappr_q \
mu_div_qr mu_divappr_q mu_div_q \
diff -r 054bd0e275bf -r 207c2e42f269 gmp-impl.h
--- a/gmp-impl.h Thu Dec 17 15:23:26 2009 +0100
+++ b/gmp-impl.h Thu Dec 17 16:28:21 2009 +0100
@@ -955,6 +955,8 @@
__GMP_DECLSPEC mp_size_t mpn_mulmod_bnm1_next_size __GMP_PROTO ((mp_size_t)) ATTRIBUTE_CONST;
#define mpn_mulmod_bnm1_itch(n) (2*(n) + 2*GMP_LIMB_BITS +2)
+#define mpn_sqrmod_bnm1 __MPN(sqrmod_bnm1)
+__GMP_DECLSPEC void mpn_sqrmod_bnm1 __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr));
typedef __gmp_randstate_struct *gmp_randstate_ptr;
typedef const __gmp_randstate_struct *gmp_randstate_srcptr;
@@ -1736,6 +1738,10 @@
#define MULMOD_BNM1_THRESHOLD 16
#endif
+#ifndef SQRMOD_BNM1_THRESHOLD
+#define SQRMOD_BNM1_THRESHOLD 16
+#endif
+
#if HAVE_NATIVE_mpn_addmul_2 || HAVE_NATIVE_mpn_redc_2
#ifndef REDC_1_TO_REDC_2_THRESHOLD
@@ -4295,10 +4301,14 @@
extern mp_size_t divrem_2_threshold;
#endif
-#undef MULMOD_BNM1_THRESHOLD
+#undef MULMOD_BNM1_THRESHOLD
#define MULMOD_BNM1_THRESHOLD mulmod_bnm1_threshold
extern mp_size_t mulmod_bnm1_threshold;
+#undef SQRMOD_BNM1_THRESHOLD
+#define SQRMOD_BNM1_THRESHOLD sqrmod_bnm1_threshold
+extern mp_size_t sqrmod_bnm1_threshold;
+
#undef GET_STR_DC_THRESHOLD
#define GET_STR_DC_THRESHOLD get_str_dc_threshold
extern mp_size_t get_str_dc_threshold;
diff -r 054bd0e275bf -r 207c2e42f269 tests/mpn/Makefile.am
--- a/tests/mpn/Makefile.am Thu Dec 17 15:23:26 2009 +0100
+++ b/tests/mpn/Makefile.am Thu Dec 17 16:28:21 2009 +0100
@@ -25,7 +25,7 @@
t-instrument t-iord_u t-mp_bases t-perfsqr t-scan \
t-toom22 t-toom32 t-toom33 t-toom42 t-toom43 t-toom44 \
t-toom52 t-toom53 t-toom62 \
- t-bdiv t-hgcd t-matrix22 t-mullo t-mulmod_bnm1
+ t-bdiv t-hgcd t-matrix22 t-mullo t-mulmod_bnm1 t-sqrmod_bnm1
EXTRA_DIST = toom-shared.h
diff -r 054bd0e275bf -r 207c2e42f269 tests/mpn/t-mulmod_bnm1.c
--- a/tests/mpn/t-mulmod_bnm1.c Thu Dec 17 15:23:26 2009 +0100
+++ b/tests/mpn/t-mulmod_bnm1.c Thu Dec 17 16:28:21 2009 +0100
@@ -1,5 +1,7 @@
/* Test for mulmod_bnm1 function.
+ Contributed to the GNU project by Marco Bodrato.
+
Copyright 2009 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
diff -r 054bd0e275bf -r 207c2e42f269 tune/Makefile.am
--- a/tune/Makefile.am Thu Dec 17 15:23:26 2009 +0100
+++ b/tune/Makefile.am Thu Dec 17 16:28:21 2009 +0100
@@ -127,6 +127,7 @@
invertappr.c invert.c binvert.c divrem_2.c gcd.c gcdext.c \
get_str.c set_str.c matrix22_mul.c hgcd.c mul_n.c sqr_n.c \
mullo_n.c mul_fft.c mul.c tdiv_qr.c mulmod_bnm1.c nussbaumer_mul.c \
+ sqrmod_bnm1.c \
toom22_mul.c toom2_sqr.c toom33_mul.c toom3_sqr.c toom44_mul.c toom4_sqr.c
$(TUNE_MPN_SRCS_BASIC):
diff -r 054bd0e275bf -r 207c2e42f269 tune/common.c
--- a/tune/common.c Thu Dec 17 15:23:26 2009 +0100
+++ b/tune/common.c Thu Dec 17 16:28:21 2009 +0100
@@ -1141,6 +1141,12 @@
}
double
+speed_mpn_sqrmod_bnm1 (struct speed_params *s)
+{
+ SPEED_ROUTINE_MPN_MULMOD_BNM1_CALL (mpn_sqrmod_bnm1 (wp, s->size, s->xp, s->size, tp));
+}
+
+double
speed_mpn_matrix22_mul (struct speed_params *s)
{
/* Speed params only includes 2 inputs, so we have to invent the
diff -r 054bd0e275bf -r 207c2e42f269 tune/speed.c
--- a/tune/speed.c Thu Dec 17 15:23:26 2009 +0100
+++ b/tune/speed.c Thu Dec 17 16:28:21 2009 +0100
@@ -312,6 +312,7 @@
{ "mpn_bc_mulmod_bnm1", speed_mpn_bc_mulmod_bnm1 },
{ "mpn_mulmod_bnm1", speed_mpn_mulmod_bnm1 },
{ "mpn_mulmod_bnm1_rounded", speed_mpn_mulmod_bnm1_rounded },
+ { "mpn_sqrmod_bnm1", speed_mpn_sqrmod_bnm1 },
{ "mpn_invert", speed_mpn_invert },
{ "mpn_invertappr", speed_mpn_invertappr },
diff -r 054bd0e275bf -r 207c2e42f269 tune/speed.h
--- a/tune/speed.h Thu Dec 17 15:23:26 2009 +0100
+++ b/tune/speed.h Thu Dec 17 16:28:21 2009 +0100
@@ -281,6 +281,7 @@
double speed_mpn_mulmod_bnm1 __GMP_PROTO ((struct speed_params *s));
double speed_mpn_bc_mulmod_bnm1 __GMP_PROTO ((struct speed_params *s));
double speed_mpn_mulmod_bnm1_rounded __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_sqrmod_bnm1 __GMP_PROTO ((struct speed_params *s));
double speed_mpn_udiv_qrnnd __GMP_PROTO ((struct speed_params *s));
double speed_mpn_udiv_qrnnd_r __GMP_PROTO ((struct speed_params *s));
double speed_mpn_umul_ppmm __GMP_PROTO ((struct speed_params *s));
More information about the gmp-commit
mailing list