[Gmp-commit] /home/hgfiles/gmp: 2 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Sun Jan 3 12:27:38 CET 2010
details: /home/hgfiles/gmp/rev/dc9d8c58258e
changeset: 13312:dc9d8c58258e
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sun Jan 03 12:23:29 2010 +0100
description:
Small reorganisation in toom_interpolate_6pts.
details: /home/hgfiles/gmp/rev/6b8511f53169
changeset: 13313:6b8511f53169
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sun Jan 03 12:27:26 2010 +0100
description:
Speed support for toom43.
diffstat:
ChangeLog | 7 ++++++
mpn/generic/toom_interpolate_6pts.c | 40 ++++++++++++++++++++----------------
tune/common.c | 5 ++++
tune/speed.c | 2 +
tune/speed.h | 7 ++++++
5 files changed, 43 insertions(+), 18 deletions(-)
diffs (156 lines):
diff -r 3c0653082a4e -r 6b8511f53169 ChangeLog
--- a/ChangeLog Sun Jan 03 07:54:25 2010 +0100
+++ b/ChangeLog Sun Jan 03 12:27:26 2010 +0100
@@ -1,3 +1,10 @@
+2010-01-03 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+ * tune/common.c, tune/speed.c, tune/speed.h: Support measuring
+ mpn_toom43_mul.
+
+ * mpn/generic/toom_interpolate_6pts.c: Small reorganisation.
+
2010-01-03 Torbjorn Granlund <tege at gmplib.org>
* gmp-impl.h (MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD): Default to
diff -r 3c0653082a4e -r 6b8511f53169 mpn/generic/toom_interpolate_6pts.c
--- a/mpn/generic/toom_interpolate_6pts.c Sun Jan 03 07:54:25 2010 +0100
+++ b/mpn/generic/toom_interpolate_6pts.c Sun Jan 03 12:27:26 2010 +0100
@@ -79,9 +79,9 @@
/* Interpolate with sequence:
W2 =(W1 - W2)>>2
- W4 =(W3 - W4)>>1
W1 =(W1 - W5)>>1
W1 =(W1 - W2)>>1
+ W4 =(W3 - W4)>>1
W2 =(W2 - W4)/3 - W0<<2
W3 = W3 - W4 - W5
W1 =(W1 - W3)/3
@@ -98,6 +98,18 @@
mpn_sub_n (w2, w1, w2, 2 * n + 1);
mpn_rshift (w2, w2, 2 * n + 1, 2);
+ /* W1 =(W1 - W5)>>1 */
+ w1[2*n] -= mpn_sub_n (w1, w1, w5, 2*n);
+ mpn_rshift (w1, w1, 2 * n + 1, 1);
+
+ /* W1 =(W1 - W2)>>1 */
+#if HAVE_NATIVE_mpn_rsh1sub_n
+ mpn_rsh1sub_n (w1, w1, w2, 2 * n + 1);
+#else
+ mpn_sub_n (w1, w1, w2, 2 * n + 1);
+ mpn_rshift (w1, w1, 2 * n + 1, 1);
+#endif
+
/* W4 =(W3 - W4)>>1 */
if (flags & toom6_vm1_neg)
{
@@ -118,23 +130,15 @@
#endif
}
- /* W1 =(W1 - W5)>>1 */
- w1[2*n] -= mpn_sub_n (w1, w1, w5, 2*n);
- mpn_rshift (w1, w1, 2 * n + 1, 1);
-
- /* W1 =(W1 - W2)>>1 */
-#if HAVE_NATIVE_mpn_rsh1sub_n
- mpn_rsh1sub_n (w1, w1, w2, 2 * n + 1);
-#else
- mpn_sub_n (w1, w1, w2, 2 * n + 1);
- mpn_rshift (w1, w1, 2 * n + 1, 1);
-#endif
-
/* W2 =(W2 - W4)/3 - W0<<2 */
mpn_sub_n (w2, w2, w4, 2 * n + 1);
mpn_divexact_by3 (w2, w2, 2 * n + 1);
-#if HAVE_NATIVE_mpn_sublsh_n
+#if HAVE_NATIVE_mpn_sublsh_n || HAVE_NATIVE_mpn_sublsh2_n
+#if HAVE_NATIVE_mpn_sublsh2_n
+ cy = mpn_sublsh2_n(w2, w0, w0n);
+#else
cy = mpn_sublsh_n(w2, w0, w0n, 2);
+#endif
MPN_DECR_U (w2 + w0n, 2 * n + 1 - w0n, cy);
#else
/* the "- W0<<2" will be delayed */
@@ -172,7 +176,7 @@
MPN_INCR_U (pp + 3 * n + 1, n, cy);
/* W2 -= W0<<2 */
-#if HAVE_NATIVE_mpn_sublsh_n
+#if HAVE_NATIVE_mpn_sublsh_n || HAVE_NATIVE_mpn_sublsh2_n
/* Computed earlier */
#else
/* {W4,2*n+1} is now free and can be overwritten. */
@@ -208,8 +212,8 @@
/* embankment is a "dirty trick" to avoid carry/borrow propagation
beyond allocated memory */
- embankment = w0[w0n - 1];
- w0[w0n - 1] = 0x80;
+ embankment = w0[w0n - 1] - 1;
+ w0[w0n - 1] = 1;
if (LIKELY (w0n > n)) {
if ( LIKELY(cy4 > cy6) )
MPN_INCR_U (pp + 4 * n, w0n + n, cy4 - cy6);
@@ -221,7 +225,7 @@
MPN_INCR_U (pp + 4 * n, w0n + n, cy4);
MPN_DECR_U (pp + 3 * n + w0n, 2 * n, cy + cy6);
}
- w0[w0n - 1] += embankment - 0x80;
+ w0[w0n - 1] += embankment;
#undef w5
#undef w3
diff -r 3c0653082a4e -r 6b8511f53169 tune/common.c
--- a/tune/common.c Sun Jan 03 07:54:25 2010 +0100
+++ b/tune/common.c Sun Jan 03 12:27:26 2010 +0100
@@ -1110,6 +1110,11 @@
SPEED_ROUTINE_MPN_TOOM42_MUL (mpn_toom42_mul);
}
double
+speed_mpn_toom43_mul (struct speed_params *s)
+{
+ SPEED_ROUTINE_MPN_TOOM43_MUL (mpn_toom43_mul);
+}
+double
speed_mpn_toom63_mul (struct speed_params *s)
{
SPEED_ROUTINE_MPN_TOOM63_MUL (mpn_toom63_mul);
diff -r 3c0653082a4e -r 6b8511f53169 tune/speed.c
--- a/tune/speed.c Sun Jan 03 07:54:25 2010 +0100
+++ b/tune/speed.c Sun Jan 03 12:27:26 2010 +0100
@@ -309,6 +309,8 @@
{ "mpn_toom8h_mul", speed_mpn_toom8h_mul },
{ "mpn_toom32_mul", speed_mpn_toom32_mul },
{ "mpn_toom42_mul", speed_mpn_toom42_mul },
+ { "mpn_toom43_mul", speed_mpn_toom43_mul },
+ { "mpn_toom63_mul", speed_mpn_toom63_mul },
{ "mpn_nussbaumer_mul", speed_mpn_nussbaumer_mul },
{ "mpn_nussbaumer_mul_sqr",speed_mpn_nussbaumer_mul_sqr},
#if WANT_OLD_FFT_FULL
diff -r 3c0653082a4e -r 6b8511f53169 tune/speed.h
--- a/tune/speed.h Sun Jan 03 07:54:25 2010 +0100
+++ b/tune/speed.h Sun Jan 03 12:27:26 2010 +0100
@@ -294,6 +294,7 @@
double speed_mpn_toom8h_mul __GMP_PROTO ((struct speed_params *s));
double speed_mpn_toom32_mul __GMP_PROTO ((struct speed_params *s));
double speed_mpn_toom42_mul __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_toom43_mul __GMP_PROTO ((struct speed_params *s));
double speed_mpn_toom63_mul __GMP_PROTO ((struct speed_params *s));
double speed_mpn_toom32_for_toom43_mul __GMP_PROTO ((struct speed_params *s));
double speed_mpn_toom43_for_toom32_mul __GMP_PROTO ((struct speed_params *s));
@@ -1154,6 +1155,12 @@
mpn_toom42_mul_itch (s->size, s->size/2), \
MPN_TOOM42_MUL_MINSIZE)
+#define SPEED_ROUTINE_MPN_TOOM43_MUL(function) \
+ SPEED_ROUTINE_MPN_MUL_N_TSPACE \
+ (function (wp, s->xp, s->size, s->yp, s->size*3/4, tspace), \
+ mpn_toom43_mul_itch (s->size, s->size*3/4), \
+ MPN_TOOM43_MUL_MINSIZE)
+
#define SPEED_ROUTINE_MPN_TOOM63_MUL(function) \
SPEED_ROUTINE_MPN_MUL_N_TSPACE \
(function (wp, s->xp, s->size, s->yp, s->size/2, tspace), \
More information about the gmp-commit
mailing list