[Gmp-commit] /var/hg/gmp: 5 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Wed Mar 30 20:23:05 CEST 2011
details: /var/hg/gmp/rev/cb09305fd752
changeset: 14111:cb09305fd752
user: Niels M?ller <nisse at lysator.liu.se>
date: Tue Mar 29 12:30:20 2011 +0200
description:
mpn_div_qr_2 and related functions: Take separate rp argument, don't clobber dividend.
details: /var/hg/gmp/rev/b72a0b645677
changeset: 14112:b72a0b645677
user: Niels M?ller <nisse at lysator.liu.se>
date: Tue Mar 29 21:44:50 2011 +0200
description:
Trivial merge.
details: /var/hg/gmp/rev/276b90fe614b
changeset: 14113:276b90fe614b
user: Niels M?ller <nisse at lysator.liu.se>
date: Tue Mar 29 22:51:29 2011 +0200
description:
x86_64 mpn_div_qr_2_pi1_norm: Updated to use a separate rp argument.
details: /var/hg/gmp/rev/554903beb816
changeset: 14114:554903beb816
user: Niels M?ller <nisse at lysator.liu.se>
date: Wed Mar 30 13:46:48 2011 +0200
description:
New naming convention for div_qr_2 functions.
details: /var/hg/gmp/rev/0594e395043e
changeset: 14115:0594e395043e
user: Niels M?ller <nisse at lysator.liu.se>
date: Wed Mar 30 14:09:06 2011 +0200
description:
Renamed files div_qr_2_pi1_norm* to div_qr_2n_pi1*
diffstat:
ChangeLog | 46 +++++++++++++
configure.in | 2 +-
gmp-h.in | 2 +-
gmp-impl.h | 4 +-
mpn/asm-defs.m4 | 8 +-
mpn/generic/div_qr_2.c | 24 +++---
mpn/generic/div_qr_2_pi1_norm.c | 76 ----------------------
mpn/generic/div_qr_2n_pi1.c | 76 ++++++++++++++++++++++
mpn/x86/k7/addlsh1_n.asm | 22 +++---
mpn/x86/k7/invert_limb.asm | 4 +-
mpn/x86/k7/sublsh1_n.asm | 22 +++---
mpn/x86_64/div_qr_2_pi1_norm.asm | 128 -------------------------------------
mpn/x86_64/div_qr_2n_pi1.asm | 134 +++++++++++++++++++++++++++++++++++++++
tests/mpn/t-div.c | 6 +-
tune/common.c | 4 +-
tune/speed.c | 4 +-
tune/speed.h | 14 +--
tune/tuneup.c | 2 +-
18 files changed, 313 insertions(+), 265 deletions(-)
diffs (truncated from 873 to 300 lines):
diff -r d3c3f6917806 -r 0594e395043e ChangeLog
--- a/ChangeLog Tue Mar 29 11:43:43 2011 +0200
+++ b/ChangeLog Wed Mar 30 14:09:06 2011 +0200
@@ -1,3 +1,49 @@
+2011-03-30 Niels Möller <nisse at lysator.liu.se>
+
+ * gmp-impl.h (mpn_div_qr_2n_pi1): Use new name in declaration.
+ * tune/speed.h (speed_mpn_div_qr_2n): Likewise.
+ (speed_mpn_div_qr_2u): Likewise.
+
+ * tune/tuneup.c (tune_div_qr_2): Use new name speed_mpn_div_qr_2n.
+
+ * tune/speed.c (routine): Use new names mpn_div_qr_2n and
+ mpn_div_qr_2u, also on the command line.
+
+ * tune/common.c (speed_mpn_div_qr_2n): Renamed, from...
+ (speed_mpn_div_qr_2_norm): ... old name.
+ (speed_mpn_div_qr_2u): Renamed, from...
+ (speed_mpn_div_qr_2_unnorm): ... old name.
+
+ * mpn/generic/div_qr_2_pi1_norm.c (mpn_div_qr_2n_pi1): Renamed,
+ from...
+ (mpn_div_qr_2_pi1_norm): ...old name.
+ * mpn/x86_64/div_qr_2_pi1_norm.asm: Likewise.
+
+ * mpn/generic/div_qr_2.c (mpn_div_qr_2n_pi2): Renamed, from...
+ (mpn_div_qr_2_pi2_norm): ... old name.
+ (mpn_div_qr_2u_pi1): Renamed, from...
+ (mpn_div_qr_2_pi1_unnorm): ... old name.
+ (mpn_div_qr_2): Call functions using new names.
+
+ * mpn/asm-defs.m4: Renamed div_qr_2-functions to new names.
+
+2011-03-29 Niels Möller <nisse at lysator.liu.se>
+
+ * mpn/x86_64/div_qr_2_pi1_norm.asm: Updated to use a separate rp
+ argument.
+
+ * gmp-impl.h (mpn_div_qr_2_pi1_norm): Updated declaration.
+ * gmp-h.in (mpn_div_qr_2): Likewise.
+
+ * tests/mpn/t-div.c (main): Adapted to new mpn_div_qr2 interface.
+ * tune/speed.h (SPEED_ROUTINE_MPN_DIV_QR_2): Likewise.
+
+ * mpn/generic/div_qr_2.c (mpn_div_qr_2_pi2_norm): Added rp
+ argument. Don't clobber the input dividend.
+ (mpn_div_qr_2_pi1_unnorm): Likewise.
+ (mpn_div_qr_2): Likewise.
+ * mpn/generic/div_qr_2_pi1_norm.c (mpn_div_qr_2_pi1_norm): Likewise.
+
2011-03-29 Niels Möller <nisse at lysator.liu.se>
* mpn/x86/k7/invert_limb.asm: Use mov rather than push and pop.
diff -r d3c3f6917806 -r 0594e395043e configure.in
--- a/configure.in Tue Mar 29 11:43:43 2011 +0200
+++ b/configure.in Wed Mar 30 14:09:06 2011 +0200
@@ -2547,7 +2547,7 @@
toom_interpolate_5pts toom_interpolate_6pts toom_interpolate_7pts \
toom_interpolate_8pts toom_interpolate_12pts toom_interpolate_16pts \
invertappr invert binvert mulmod_bnm1 sqrmod_bnm1 \
- div_qr_2 div_qr_2_pi1_norm \
+ div_qr_2 div_qr_2n_pi1 \
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 d3c3f6917806 -r 0594e395043e gmp-h.in
--- a/gmp-h.in Tue Mar 29 11:43:43 2011 +0200
+++ b/gmp-h.in Wed Mar 30 14:09:06 2011 +0200
@@ -1536,7 +1536,7 @@
__GMP_DECLSPEC mp_limb_t mpn_divrem_2 __GMP_PROTO ((mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr));
#define mpn_div_qr_2 __MPN(div_qr_2)
-__GMP_DECLSPEC mp_limb_t mpn_div_qr_2 __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr));
+__GMP_DECLSPEC mp_limb_t mpn_div_qr_2 __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr));
#define mpn_gcd __MPN(gcd)
__GMP_DECLSPEC mp_size_t mpn_gcd __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t));
diff -r d3c3f6917806 -r 0594e395043e gmp-impl.h
--- a/gmp-impl.h Tue Mar 29 11:43:43 2011 +0200
+++ b/gmp-impl.h Wed Mar 30 14:09:06 2011 +0200
@@ -1295,8 +1295,8 @@
#define mpn_fft_next_size __MPN(fft_next_size)
__GMP_DECLSPEC mp_size_t mpn_fft_next_size __GMP_PROTO ((mp_size_t, int)) ATTRIBUTE_CONST;
-#define mpn_div_qr_2_pi1_norm __MPN(div_qr_2_pi1_norm)
- __GMP_DECLSPEC mp_limb_t mpn_div_qr_2_pi1_norm __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_limb_t, mp_limb_t, mp_limb_t));
+#define mpn_div_qr_2n_pi1 __MPN(div_qr_2n_pi1)
+ __GMP_DECLSPEC mp_limb_t mpn_div_qr_2n_pi1 __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, mp_limb_t));
#define mpn_sbpi1_div_qr __MPN(sbpi1_div_qr)
__GMP_DECLSPEC mp_limb_t mpn_sbpi1_div_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t));
diff -r d3c3f6917806 -r 0594e395043e mpn/asm-defs.m4
--- a/mpn/asm-defs.m4 Tue Mar 29 11:43:43 2011 +0200
+++ b/mpn/asm-defs.m4 Wed Mar 30 14:09:06 2011 +0200
@@ -1352,10 +1352,10 @@
define_mpn(count_leading_zeros)
define_mpn(count_trailing_zeros)
define_mpn(div_qr_2)
-define_mpn(div_qr_2_pi1_norm)
-define_mpn(div_qr_2_pi1_unnorm)
-define_mpn(div_qr_2_pi2_norm)
-define_mpn(div_qr_2_pi2_unnorm)
+define_mpn(div_qr_2n_pi1)
+define_mpn(div_qr_2u_pi1)
+define_mpn(div_qr_2n_pi2)
+define_mpn(div_qr_2u_pi2)
define_mpn(divexact_1)
define_mpn(divexact_by3c)
define_mpn(divrem)
diff -r d3c3f6917806 -r 0594e395043e mpn/generic/div_qr_2.c
--- a/mpn/generic/div_qr_2.c Tue Mar 29 11:43:43 2011 +0200
+++ b/mpn/generic/div_qr_2.c Wed Mar 30 14:09:06 2011 +0200
@@ -220,8 +220,8 @@
}
static mp_limb_t
-mpn_div_qr_2_pi2_norm (mp_ptr qp, mp_ptr np, mp_size_t nn,
- mp_limb_t d1, mp_limb_t d0, mp_limb_t di1, mp_limb_t di0)
+mpn_div_qr_2n_pi2 (mp_ptr qp, mp_ptr rp, mp_srcptr np, mp_size_t nn,
+ mp_limb_t d1, mp_limb_t d0, mp_limb_t di1, mp_limb_t di0)
{
mp_limb_t qh;
mp_size_t i;
@@ -262,15 +262,15 @@
udiv_qr_3by2 (q, r1, r0, r1, r0, np[0], d1, d0, di1);
qp[0] = q;
}
- np[1] = r1;
- np[0] = r0;
+ rp[1] = r1;
+ rp[0] = r0;
return qh;
}
static mp_limb_t
-mpn_div_qr_2_pi1_unnorm (mp_ptr qp, mp_ptr np, mp_size_t nn,
- mp_limb_t d1, mp_limb_t d0, int shift, mp_limb_t di)
+mpn_div_qr_2u_pi1 (mp_ptr qp, mp_ptr rp, mp_srcptr np, mp_size_t nn,
+ mp_limb_t d1, mp_limb_t d0, int shift, mp_limb_t di)
{
mp_limb_t qh;
mp_limb_t r2, r1, r0;
@@ -296,8 +296,8 @@
qp[i] = q;
}
- np[0] = (r1 >> shift) | (r2 << (GMP_LIMB_BITS - shift));
- np[1] = r2 >> shift;
+ rp[0] = (r1 >> shift) | (r2 << (GMP_LIMB_BITS - shift));
+ rp[1] = r2 >> shift;
return qh;
}
@@ -312,7 +312,7 @@
2. nn >= 2. */
mp_limb_t
-mpn_div_qr_2 (mp_ptr qp, mp_ptr np, mp_size_t nn,
+mpn_div_qr_2 (mp_ptr qp, mp_ptr rp, mp_srcptr np, mp_size_t nn,
mp_srcptr dp)
{
mp_limb_t d1;
@@ -334,13 +334,13 @@
{
gmp_pi1_t dinv;
invert_pi1 (dinv, d1, d0);
- return mpn_div_qr_2_pi1_norm (qp, np, nn, d1, d0, dinv.inv32);
+ return mpn_div_qr_2n_pi1 (qp, rp, np, nn, d1, d0, dinv.inv32);
}
else
{
mp_limb_t di[2];
invert_4by2 (di, d1, d0);
- return mpn_div_qr_2_pi2_norm (qp, np, nn, d1, d0, di[1], di[0]);
+ return mpn_div_qr_2n_pi2 (qp, rp, np, nn, d1, d0, di[1], di[0]);
}
}
else
@@ -350,6 +350,6 @@
d1 = (d1 << shift) | (d0 >> (GMP_LIMB_BITS - shift));
d0 <<= shift;
invert_pi1 (dinv, d1, d0);
- return mpn_div_qr_2_pi1_unnorm (qp, np, nn, d1, d0, shift, dinv.inv32);
+ return mpn_div_qr_2u_pi1 (qp, rp, np, nn, d1, d0, shift, dinv.inv32);
}
}
diff -r d3c3f6917806 -r 0594e395043e mpn/generic/div_qr_2_pi1_norm.c
--- a/mpn/generic/div_qr_2_pi1_norm.c Tue Mar 29 11:43:43 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/* mpn_div_qr_2_pi1_norm
-
- Contributed to the GNU project by Torbjorn Granlund and Niels Möller
-
- THIS FILE CONTAINS INTERNAL FUNCTIONS WITH MUTABLE INTERFACES. IT IS
- ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS
- ALMOST GUARANTEED THAT THEY'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP
- RELEASE.
-
-
-Copyright 1993, 1994, 1995, 1996, 1999, 2000, 2001, 2002, 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"
-#include "longlong.h"
-
-
-/* 3/2 loop, for normalized divisor */
-mp_limb_t
-mpn_div_qr_2_pi1_norm (mp_ptr qp, mp_ptr np, mp_size_t nn,
- mp_limb_t d1, mp_limb_t d0, mp_limb_t di)
-{
- mp_limb_t qh;
- mp_size_t i;
- mp_limb_t r1, r0;
-
- ASSERT (nn >= 2);
- ASSERT (d1 & GMP_NUMB_HIGHBIT);
-
- np += nn - 2;
- r1 = np[1];
- r0 = np[0];
-
- qh = 0;
- if (r1 >= d1 && (r1 > d1 || r0 >= d0))
- {
-#if GMP_NAIL_BITS == 0
- sub_ddmmss (r1, r0, r1, r0, d1, d0);
-#else
- r0 = r0 - d0;
- r1 = r1 - d1 - (r0 >> GMP_LIMB_BITS - 1);
- r0 &= GMP_NUMB_MASK;
-#endif
- qh = 1;
- }
-
- for (i = nn - 2 - 1; i >= 0; i--)
- {
- mp_limb_t n0, q;
- n0 = np[-1];
- udiv_qr_3by2 (q, r1, r0, r1, r0, n0, d1, d0, di);
- np--;
- qp[i] = q;
- }
-
- np[1] = r1;
- np[0] = r0;
-
- return qh;
-}
diff -r d3c3f6917806 -r 0594e395043e mpn/generic/div_qr_2n_pi1.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mpn/generic/div_qr_2n_pi1.c Wed Mar 30 14:09:06 2011 +0200
@@ -0,0 +1,76 @@
+/* mpn_div_qr_2n_pi1
+
+ Contributed to the GNU project by Torbjorn Granlund and Niels Möller
+
+ THIS FILE CONTAINS INTERNAL FUNCTIONS WITH MUTABLE INTERFACES. IT IS
+ ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS
+ ALMOST GUARANTEED THAT THEY'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP
+ RELEASE.
+
+
+Copyright 1993, 1994, 1995, 1996, 1999, 2000, 2001, 2002, 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"
More information about the gmp-commit
mailing list