[Gmp-commit] /home/hgfiles/gmp: Further clean-up for toom63.
mercurial at gmplib.org
mercurial at gmplib.org
Fri Dec 18 12:19:17 CET 2009
details: /home/hgfiles/gmp/rev/06d82b76fd86
changeset: 13128:06d82b76fd86
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Fri Dec 18 12:19:14 2009 +0100
description:
Further clean-up for toom63.
diffstat:
mpn/generic/toom63_mul.c | 5 ++++-
mpn/generic/toom_interpolate_8pts.c | 9 +++++++++
2 files changed, 13 insertions(+), 1 deletions(-)
diffs (57 lines):
diff -r 622f9d47a9e4 -r 06d82b76fd86 mpn/generic/toom63_mul.c
--- a/mpn/generic/toom63_mul.c Fri Dec 18 12:15:02 2009 +0100
+++ b/mpn/generic/toom63_mul.c Fri Dec 18 12:19:14 2009 +0100
@@ -96,7 +96,8 @@
static int
abs_sub_add_n (mp_ptr rm, mp_ptr rp, mp_srcptr rs, mp_size_t n) {
- int result = abs_sub_n (rm, rp, rs, n);
+ int result;
+ result = abs_sub_n (rm, rp, rs, n);
ASSERT_NOCARRY(mpn_add_n (rp, rp, rs, n));
return result;
}
@@ -170,6 +171,7 @@
/* $\pm4$ */
sign = mpn_toom_eval_pm2exp (v2, v0, 5, ap, n, s, 2, pp);
pp[n] = mpn_lshift (pp, b1, n, 2); /* 4b1 */
+ /* FIXME: use addlsh */
v3[t] = mpn_lshift (v3, b2, t, 4);/* 16b2 */
if ( n == t )
v3[n]+= mpn_add_n (v3, v3, b0, n); /* 16b2+b0 */
@@ -220,6 +222,7 @@
/* $\pm2$ */
sign = mpn_toom_eval_pm2 (v2, v0, 5, ap, n, s, pp);
pp[n] = mpn_lshift (pp, b1, n, 1); /* 2b1 */
+ /* FIXME: use addlsh or addlsh2 */
v3[t] = mpn_lshift (v3, b2, t, 2);/* 4b2 */
if ( n == t )
v3[n]+= mpn_add_n (v3, v3, b0, n); /* 4b2+b0 */
diff -r 622f9d47a9e4 -r 06d82b76fd86 mpn/generic/toom_interpolate_8pts.c
--- a/mpn/generic/toom_interpolate_8pts.c Fri Dec 18 12:15:02 2009 +0100
+++ b/mpn/generic/toom_interpolate_8pts.c Fri Dec 18 12:19:14 2009 +0100
@@ -28,6 +28,11 @@
#define BINVERT_3 MODLIMB_INVERSE_3
+#define BINVERT_15 \
+ ((((GMP_NUMB_MAX >> (GMP_NUMB_BITS % 4)) / 15) * 14 * 16 & GMP_NUMB_MAX) + 15)
+
+#define BINVERT_45 (BINVERT_15 * BINVERT_3)
+
#ifndef mpn_divexact_by3
#if HAVE_NATIVE_mpn_bdiv_q_1_pi1
#define mpn_divexact_by3(dst,src,size) mpn_bdiv_q_1_pi1(dst,src,size,3,BINVERT_3,0)
@@ -37,8 +42,12 @@
#endif
#ifndef mpn_divexact_by45
+#if HAVE_NATIVE_mpn_bdiv_q_1_pi1
+#define mpn_divexact_by45(dst,src,size) mpn_bdiv_q_1_pi1(dst,src,size,45,BINVERT_45,0)
+#else
#define mpn_divexact_by45(dst,src,size) mpn_divexact_1(dst,src,size,45)
#endif
+#endif
#if HAVE_NATIVE_mpn_sublsh_n
#define DO_mpn_sublsh_n(dst,src,n,s,ws) mpn_sublsh_n (dst,src,n,s)
More information about the gmp-commit
mailing list