[Gmp-commit] /var/hg/gmp: 2 new changesets

mercurial at gmplib.org mercurial at gmplib.org
Fri Mar 11 23:11:46 CET 2011


details:   /var/hg/gmp/rev/4d03de42fc3c
changeset: 14039:4d03de42fc3c
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Fri Mar 11 23:07:27 2011 +0100
description:
Declare all addlsh*_ip1 functions.

details:   /var/hg/gmp/rev/357516106f1b
changeset: 14040:357516106f1b
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Fri Mar 11 23:11:42 2011 +0100
description:
More _ip* declarations/tests/speed.

diffstat:

 ChangeLog         |   5 ++-
 configure.in      |  12 +++++++
 gmp-impl.h        |  64 +++++++++++++++++++++++++++++++++++++++--
 mpn/asm-defs.m4   |  12 +++++++
 tests/devel/try.c |  84 ++++++++++++++++++++++++++++++++++++++++++++++++------
 tune/common.c     |  21 +++++++++++++
 tune/speed.c      |   9 +++++
 tune/speed.h      |   3 +
 8 files changed, 195 insertions(+), 15 deletions(-)

diffs (truncated from 365 to 300 lines):

diff -r 2dc198f6c8d1 -r 357516106f1b ChangeLog
--- a/ChangeLog	Fri Mar 11 22:33:39 2011 +0100
+++ b/ChangeLog	Fri Mar 11 23:11:42 2011 +0100
@@ -1,6 +1,6 @@
 2011-03-11 Marco Bodrato <bodrato at mail.dm.unipi.it>
 
-	* gmp-impl.h (mpn_sublsh1_n_ip1): Declare.
+	* gmp-impl.h: Declare many mpn_{sub,add}lsh*_n_ip[12] functions/macros.
 	* mpn/generic/toom_interpolate_5pts.c: Use mpn_sublsh1_n_ip1.
 
 	* tests/devel/try.c: Tests for {add,sub}lsh*_n_ip[12].
@@ -14,6 +14,9 @@
 	* mpn/x86/k7/sublsh1_n.asm: Replaced generic sublsh1 code with faster _ip1.
 	* mpn/x86/atom/sublsh1_n.asm: Changed PROLOGUE accordingly.
 
+	* configure.in: Define HAVE_NATIVE_mpn_addlsh*_n*_ip[12].
+	* mpn/asm-defs.m4: Declare mpn_addlsh*_n*_ip[12].
+
 2011-03-10  Marc Glisse  <marc.glisse at inria.fr>
 
 	* tests/cxx/t-istream.cc: Explicit conversion to streampos.
diff -r 2dc198f6c8d1 -r 357516106f1b configure.in
--- a/configure.in	Fri Mar 11 22:33:39 2011 +0100
+++ b/configure.in	Fri Mar 11 23:11:42 2011 +0100
@@ -3003,6 +3003,18 @@
 #undef HAVE_NATIVE_mpn_addlsh1_nc
 #undef HAVE_NATIVE_mpn_addlsh2_nc
 #undef HAVE_NATIVE_mpn_addlsh_nc
+#undef HAVE_NATIVE_mpn_addlsh1_n_ip1
+#undef HAVE_NATIVE_mpn_addlsh2_n_ip1
+#undef HAVE_NATIVE_mpn_addlsh_n_ip1
+#undef HAVE_NATIVE_mpn_addlsh1_nc_ip1
+#undef HAVE_NATIVE_mpn_addlsh2_nc_ip1
+#undef HAVE_NATIVE_mpn_addlsh_nc_ip1
+#undef HAVE_NATIVE_mpn_addlsh1_n_ip2
+#undef HAVE_NATIVE_mpn_addlsh2_n_ip2
+#undef HAVE_NATIVE_mpn_addlsh_n_ip2
+#undef HAVE_NATIVE_mpn_addlsh1_nc_ip2
+#undef HAVE_NATIVE_mpn_addlsh2_nc_ip2
+#undef HAVE_NATIVE_mpn_addlsh_nc_ip2
 #undef HAVE_NATIVE_mpn_addmul_1c
 #undef HAVE_NATIVE_mpn_addmul_2
 #undef HAVE_NATIVE_mpn_addmul_3
diff -r 2dc198f6c8d1 -r 357516106f1b gmp-impl.h
--- a/gmp-impl.h	Fri Mar 11 22:33:39 2011 +0100
+++ b/gmp-impl.h	Fri Mar 11 23:11:42 2011 +0100
@@ -797,25 +797,67 @@
 __GMP_DECLSPEC mp_limb_t mpn_addmul_2s __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr));
 
 /* mpn_addlsh1_n(c,a,b,n), when it exists, sets {c,n} to {a,n}+2*{b,n}, and
-   returns the carry out (0, 1 or 2).  */
+   returns the carry out (0, 1 or 2). Use _ip1 when a=c. */
 #define mpn_addlsh1_n __MPN(addlsh1_n)
 __GMP_DECLSPEC mp_limb_t mpn_addlsh1_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
 #define mpn_addlsh1_nc __MPN(addlsh1_nc)
 __GMP_DECLSPEC mp_limb_t mpn_addlsh1_nc __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t));
+#if HAVE_NATIVE_mpn_addlsh1_n && ! HAVE_NATIVE_mpn_addlsh1_n_ip1
+#define mpn_addlsh1_n_ip1(dst,src,n) mpn_addlsh1_n(dst,dst,src,n)
+#define HAVE_NATIVE_mpn_addlsh1_n_ip1 1
+#else
+#define mpn_addlsh1_n_ip1 __MPN(addlsh1_n_ip1)
+__GMP_DECLSPEC mp_limb_t mpn_addlsh1_n_ip1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t));
+#endif
+#if HAVE_NATIVE_mpn_addlsh1_nc && ! HAVE_NATIVE_mpn_addlsh1_nc_ip1
+#define mpn_addlsh1_nc_ip1(dst,src,n,c) mpn_addlsh1_nc(dst,dst,src,n,c)
+#define HAVE_NATIVE_mpn_addlsh1_nc_ip1 1
+#else
+#define mpn_addlsh1_nc_ip1 __MPN(addlsh1_nc_ip1)
+__GMP_DECLSPEC mp_limb_t mpn_addlsh1_nc_ip1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
+#endif
 
 /* mpn_addlsh2_n(c,a,b,n), when it exists, sets {c,n} to {a,n}+4*{b,n}, and
-   returns the carry out (0, ..., 4).  */
+   returns the carry out (0, ..., 4). Use _ip1 when a=c. */
 #define mpn_addlsh2_n __MPN(addlsh2_n)
 __GMP_DECLSPEC mp_limb_t mpn_addlsh2_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
 #define mpn_addlsh2_nc __MPN(addlsh2_nc)
 __GMP_DECLSPEC mp_limb_t mpn_addlsh2_nc __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t));
+#if HAVE_NATIVE_mpn_addlsh2_n && ! HAVE_NATIVE_mpn_addlsh2_n_ip1
+#define mpn_addlsh2_n_ip1(dst,src,n) mpn_addlsh2_n(dst,dst,src,n)
+#define HAVE_NATIVE_mpn_addlsh2_n_ip1 1
+#else
+#define mpn_addlsh2_n_ip1 __MPN(addlsh2_n_ip1)
+__GMP_DECLSPEC mp_limb_t mpn_addlsh2_n_ip1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t));
+#endif
+#if HAVE_NATIVE_mpn_addlsh2_nc && ! HAVE_NATIVE_mpn_addlsh2_nc_ip1
+#define mpn_addlsh2_nc_ip1(dst,src,n,c) mpn_addlsh2_nc(dst,dst,src,n,c)
+#define HAVE_NATIVE_mpn_addlsh2_nc_ip1 1
+#else
+#define mpn_addlsh2_nc_ip1 __MPN(addlsh2_nc_ip1)
+__GMP_DECLSPEC mp_limb_t mpn_addlsh2_nc_ip1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
+#endif
 
 /* mpn_addlsh_n(c,a,b,n,k), when it exists, sets {c,n} to {a,n}+2^k*{b,n}, and
-   returns the carry out (0, ..., 2^k).  */
+   returns the carry out (0, ..., 2^k). Use _ip1 when a=c. */
 #define mpn_addlsh_n __MPN(addlsh_n)
 __GMP_DECLSPEC mp_limb_t mpn_addlsh_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned int));
 #define mpn_addlsh_nc __MPN(addlsh_nc)
 __GMP_DECLSPEC mp_limb_t mpn_addlsh_nc __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned int, mp_limb_t));
+#if HAVE_NATIVE_mpn_addlsh_n && ! HAVE_NATIVE_mpn_addlsh_n_ip1
+#define mpn_addlsh_n_ip1(dst,src,n,s) mpn_addlsh_n(dst,dst,src,n,s)
+#define HAVE_NATIVE_mpn_addlsh_n_ip1 1
+#else
+#define mpn_addlsh_n_ip1 __MPN(addlsh_n_ip1)
+  __GMP_DECLSPEC mp_limb_t mpn_addlsh_n_ip1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned int));
+#endif
+#if HAVE_NATIVE_mpn_addlsh_nc && ! HAVE_NATIVE_mpn_addlsh_nc_ip1
+#define mpn_addlsh_nc_ip1(dst,src,n,s,c) mpn_addlsh_nc(dst,dst,src,n,s,c)
+#define HAVE_NATIVE_mpn_addlsh_nc_ip1 1
+#else
+#define mpn_addlsh_nc_ip1 __MPN(addlsh_nc_ip1)
+__GMP_DECLSPEC mp_limb_t mpn_addlsh_nc_ip1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned int, mp_limb_t));
+#endif
 
 /* mpn_sublsh1_n(c,a,b,n), when it exists, sets {c,n} to {a,n}-2*{b,n}, and
    returns the borrow out (0, 1 or 2). Use _ip1 when a=c. */
@@ -867,9 +909,23 @@
 #endif
 
 /* mpn_sublsh_n(c,a,b,n,k), when it exists, sets {c,n} to {a,n}-2^k*{b,n}, and
-   returns the carry out (0, ..., 2^k).  */
+   returns the carry out (0, ..., 2^k). Use _ip1 when a=c. */
 #define mpn_sublsh_n __MPN(sublsh_n)
 __GMP_DECLSPEC mp_limb_t mpn_sublsh_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned int));
+#if HAVE_NATIVE_mpn_sublsh_n && ! HAVE_NATIVE_mpn_sublsh_n_ip1
+#define mpn_sublsh_n_ip1(dst,src,n,s) mpn_sublsh_n(dst,dst,src,n,s)
+#define HAVE_NATIVE_mpn_sublsh_n_ip1 1
+#else
+#define mpn_sublsh_n_ip1 __MPN(sublsh_n_ip1)
+__GMP_DECLSPEC mp_limb_t mpn_sublsh_n_ip1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned int));
+#endif
+#if HAVE_NATIVE_mpn_sublsh_nc && ! HAVE_NATIVE_mpn_sublsh_nc_ip1
+#define mpn_sublsh_nc_ip1(dst,src,n,s,c) mpn_sublsh_nc(dst,dst,src,n,s,c)
+#define HAVE_NATIVE_mpn_sublsh_nc_ip1 1
+#else
+#define mpn_sublsh_nc_ip1 __MPN(sublsh_nc_ip1)
+__GMP_DECLSPEC mp_limb_t mpn_sublsh_nc_ip1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned int, mp_limb_t));
+#endif
 
 /* mpn_rsblsh2_n(c,a,b,n), when it exists, sets {c,n} to 4*{b,n}-{a,n}, and
    returns the carry out (-1, ..., 3).  */
diff -r 2dc198f6c8d1 -r 357516106f1b mpn/asm-defs.m4
--- a/mpn/asm-defs.m4	Fri Mar 11 22:33:39 2011 +0100
+++ b/mpn/asm-defs.m4	Fri Mar 11 23:11:42 2011 +0100
@@ -1314,6 +1314,18 @@
 define_mpn(addlsh2_nc)
 define_mpn(addlsh_n)
 define_mpn(addlsh_nc)
+define_mpn(addlsh1_n_ip1)
+define_mpn(addlsh1_nc_ip1)
+define_mpn(addlsh2_n_ip1)
+define_mpn(addlsh2_nc_ip1)
+define_mpn(addlsh_n_ip1)
+define_mpn(addlsh_nc_ip1)
+define_mpn(addlsh1_n_ip2)
+define_mpn(addlsh1_nc_ip2)
+define_mpn(addlsh2_n_ip2)
+define_mpn(addlsh2_nc_ip2)
+define_mpn(addlsh_n_ip2)
+define_mpn(addlsh_nc_ip2)
 define_mpn(addmul_1)
 define_mpn(addmul_1c)
 define_mpn(addmul_2)
diff -r 2dc198f6c8d1 -r 357516106f1b tests/devel/try.c
--- a/tests/devel/try.c	Fri Mar 11 22:33:39 2011 +0100
+++ b/tests/devel/try.c	Fri Mar 11 23:11:42 2011 +0100
@@ -908,7 +908,7 @@
   REFERENCE (refmpn_addlsh2_n_ip1);
 
   p = &param[TYPE_ADDLSH_N_IP1];
-  COPY (TYPE_ADDLSH_N_IP1);
+  COPY (TYPE_ADDLSH1_N_IP1);
   p->shift = 1;
   REFERENCE (refmpn_addlsh_n_ip1);
 
@@ -1398,6 +1398,70 @@
   return mpn_divexact_by3 (rp, sp, size);
 }
 
+#if HAVE_NATIVE_mpn_addlsh1_n_ip1
+mp_limb_t
+mpn_addlsh1_n_ip1_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{
+  return mpn_addlsh1_n_ip1 (rp, sp, size);
+}
+#endif
+#if HAVE_NATIVE_mpn_addlsh2_n_ip1
+mp_limb_t
+mpn_addlsh2_n_ip1_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{
+  return mpn_addlsh2_n_ip1 (rp, sp, size);
+}
+#endif
+#if HAVE_NATIVE_mpn_addlsh_n_ip1
+mp_limb_t
+mpn_addlsh_n_ip1_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size, unsigned int sh)
+{
+  return mpn_addlsh_n_ip1 (rp, sp, size, sh);
+}
+#endif
+#if HAVE_NATIVE_mpn_addlsh1_n_ip2
+mp_limb_t
+mpn_addlsh1_n_ip2_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{
+  return mpn_addlsh1_n_ip2 (rp, sp, size);
+}
+#endif
+#if HAVE_NATIVE_mpn_addlsh2_n_ip2
+mp_limb_t
+mpn_addlsh2_n_ip2_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{
+  return mpn_addlsh2_n_ip2 (rp, sp, size);
+}
+#endif
+#if HAVE_NATIVE_mpn_addlsh_n_ip2
+mp_limb_t
+mpn_addlsh_n_ip2_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size, unsigned int sh)
+{
+  return mpn_addlsh_n_ip2 (rp, sp, size, sh);
+}
+#endif
+#if HAVE_NATIVE_mpn_sublsh1_n_ip1
+mp_limb_t
+mpn_sublsh1_n_ip1_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{
+  return mpn_sublsh1_n_ip1 (rp, sp, size);
+}
+#endif
+#if HAVE_NATIVE_mpn_sublsh2_n_ip1
+mp_limb_t
+mpn_sublsh2_n_ip1_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{
+  return mpn_sublsh2_n_ip1 (rp, sp, size);
+}
+#endif
+#if HAVE_NATIVE_mpn_sublsh_n_ip1
+mp_limb_t
+mpn_sublsh_n_ip1_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size, unsigned int sh)
+{
+  return mpn_sublsh_n_ip1 (rp, sp, size, sh);
+}
+#endif
+
 mp_limb_t
 mpn_modexact_1_odd_fun (mp_srcptr ptr, mp_size_t size, mp_limb_t divisor)
 {
@@ -1573,22 +1637,22 @@
   { TRY(mpn_addlsh_n), TYPE_ADDLSH_N },
 #endif
 #if HAVE_NATIVE_mpn_addlsh1_n_ip1
-  { TRY(mpn_addlsh1_n_ip1), TYPE_ADDLSH1_N_IP1 },
+  { TRY_FUNFUN(mpn_addlsh1_n_ip1), TYPE_ADDLSH1_N_IP1 },
 #endif
 #if HAVE_NATIVE_mpn_addlsh2_n_ip1
-  { TRY(mpn_addlsh2_n_ip1), TYPE_ADDLSH2_N_IP1 },
+  { TRY_FUNFUN(mpn_addlsh2_n_ip1), TYPE_ADDLSH2_N_IP1 },
 #endif
 #if HAVE_NATIVE_mpn_addlsh_n_ip1
-  { TRY(mpn_addlsh_n_ip1), TYPE_ADDLSH_N_IP1 },
+  { TRY_FUNFUN(mpn_addlsh_n_ip1), TYPE_ADDLSH_N_IP1 },
 #endif
 #if HAVE_NATIVE_mpn_addlsh1_n_ip2
-  { TRY(mpn_addlsh1_n_ip2), TYPE_ADDLSH1_N_IP2 },
+  { TRY_FUNFUN(mpn_addlsh1_n_ip2), TYPE_ADDLSH1_N_IP2 },
 #endif
 #if HAVE_NATIVE_mpn_addlsh2_n_ip2
-  { TRY(mpn_addlsh2_n_ip2), TYPE_ADDLSH2_N_IP2 },
+  { TRY_FUNFUN(mpn_addlsh2_n_ip2), TYPE_ADDLSH2_N_IP2 },
 #endif
 #if HAVE_NATIVE_mpn_addlsh_n_ip2
-  { TRY(mpn_addlsh_n_ip2), TYPE_ADDLSH_N_IP2 },
+  { TRY_FUNFUN(mpn_addlsh_n_ip2), TYPE_ADDLSH_N_IP2 },
 #endif
 #if HAVE_NATIVE_mpn_sublsh1_n
   { TRY(mpn_sublsh1_n), TYPE_SUBLSH1_N },
@@ -1600,13 +1664,13 @@
   { TRY(mpn_sublsh_n), TYPE_SUBLSH_N },
 #endif
 #if HAVE_NATIVE_mpn_sublsh1_n_ip1
-  { TRY(mpn_sublsh1_n_ip1), TYPE_SUBLSH1_N_IP1 },
+  { TRY_FUNFUN(mpn_sublsh1_n_ip1), TYPE_SUBLSH1_N_IP1 },
 #endif
 #if HAVE_NATIVE_mpn_sublsh2_n_ip1
-  { TRY(mpn_sublsh2_n_ip1), TYPE_SUBLSH2_N_IP1 },
+  { TRY_FUNFUN(mpn_sublsh2_n_ip1), TYPE_SUBLSH2_N_IP1 },
 #endif
 #if HAVE_NATIVE_mpn_sublsh_n_ip1
-  { TRY(mpn_sublsh_n_ip1), TYPE_SUBLSH_N_IP1 },
+  { TRY_FUNFUN(mpn_sublsh_n_ip1), TYPE_SUBLSH_N_IP1 },
 #endif
 #if HAVE_NATIVE_mpn_rsblsh1_n
   { TRY(mpn_rsblsh1_n), TYPE_RSBLSH1_N },
diff -r 2dc198f6c8d1 -r 357516106f1b tune/common.c
--- a/tune/common.c	Fri Mar 11 22:33:39 2011 +0100
+++ b/tune/common.c	Fri Mar 11 23:11:42 2011 +0100
@@ -1021,6 +1021,27 @@
   SPEED_ROUTINE_MPN_BINARY_N_CALL (mpn_sublsh_n (wp, xp, yp, s->size, 7));
 }
 #endif


More information about the gmp-commit mailing list