[Gmp-commit] /home/hgfiles/gmp: Corrected return value for rsblsh_n, added pr...

mercurial at gmplib.org mercurial at gmplib.org
Tue Dec 1 20:09:39 CET 2009


details:   /home/hgfiles/gmp/rev/1dbb6ee37e11
changeset: 12953:1dbb6ee37e11
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Tue Dec 01 20:09:25 2009 +0100
description:
Corrected return value for rsblsh_n, added prototype and mangling.

diffstat:

 ChangeLog                |  5 +++++
 gmp-impl.h               |  7 ++++++-
 mpn/asm-defs.m4          |  1 +
 mpn/generic/fib2_ui.c    |  3 +--
 mpn/x86_64/aorrlsh_n.asm |  2 +-
 5 files changed, 14 insertions(+), 4 deletions(-)

diffs (72 lines):

diff -r 539c0a302182 -r 1dbb6ee37e11 ChangeLog
--- a/ChangeLog	Tue Dec 01 19:26:40 2009 +0100
+++ b/ChangeLog	Tue Dec 01 20:09:25 2009 +0100
@@ -2,7 +2,12 @@
 
 	* mpn/generic/toom53_mul.c: Removed double computation of vinf.
 
+	* mpn/x86_64/aorrlsh_n.asm: Correct return value for rsblsh_n.
+	* mpn/asm-defs.m4 (define_mpn): Add rsblsh_n.
+	* gmp-impl.h (mpn_rsblsh_n): Added prototype and name-mangling.
+
 	* mpn/generic/fib2_ui.c: Reduce the amount of temporary storage.
+	Use mpn_rsblsh_n.
 
 2009-12-01  Torbjorn Granlund  <tege at gmplib.org>
 
diff -r 539c0a302182 -r 1dbb6ee37e11 gmp-impl.h
--- a/gmp-impl.h	Tue Dec 01 19:26:40 2009 +0100
+++ b/gmp-impl.h	Tue Dec 01 20:09:25 2009 +0100
@@ -832,10 +832,15 @@
 __GMP_DECLSPEC mp_limb_t mpn_sublsh2_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
 
 /* mpn_rsblsh2_n(c,a,b,n), when it exists, sets {c,n} to 4*{b,n}-{a,n}, and
-   returns the carry out (FIXME -1, ..., 3).  */
+   returns the carry out (-1, ..., 3).  */
 #define mpn_rsblsh2_n __MPN(rsblsh2_n)
 __GMP_DECLSPEC mp_limb_signed_t mpn_rsblsh2_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
 
+/* mpn_rsblsh_n(c,a,b,n,k), when it exists, sets {c,n} to 2^k*{b,n}-{a,n}, and
+   returns the carry out (-1, 0, ..., 2^k-1).  */
+#define mpn_rsblsh_n __MPN(rsblsh_n)
+__GMP_DECLSPEC mp_limb_signed_t mpn_rsblsh_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned int));
+
 /* mpn_rsh1add_n(c,a,b,n), when it exists, sets {c,n} to ({a,n} + {b,n}) >> 1,
    and returns the bit rshifted out (0 or 1).  */
 #define mpn_rsh1add_n __MPN(rsh1add_n)
diff -r 539c0a302182 -r 1dbb6ee37e11 mpn/asm-defs.m4
--- a/mpn/asm-defs.m4	Tue Dec 01 19:26:40 2009 +0100
+++ b/mpn/asm-defs.m4	Tue Dec 01 20:09:25 2009 +0100
@@ -1389,6 +1389,7 @@
 define_mpn(redc_2)
 define_mpn(rsblsh1_n)
 define_mpn(rsblsh2_n)
+define_mpn(rsblsh_n)
 define_mpn(rsh1add_n)
 define_mpn(rsh1sub_n)
 define_mpn(rshift)
diff -r 539c0a302182 -r 1dbb6ee37e11 mpn/generic/fib2_ui.c
--- a/mpn/generic/fib2_ui.c	Tue Dec 01 19:26:40 2009 +0100
+++ b/mpn/generic/fib2_ui.c	Tue Dec 01 20:09:25 2009 +0100
@@ -121,8 +121,7 @@
 
 	  /* Calculate F[2k+1] = 4*F[k]^2 - F[k-1]^2 + 2*(-1)^k.
 	     n&mask is the low bit of our implied k.  */
-	  /* FIXME: enable rsblsh_n if correct */
-#if HAVE_NATIVE_mpn_rsblsh2_n || (HAVE_NATIVE_mpn_rsblsh_n && 0)
+#if HAVE_NATIVE_mpn_rsblsh2_n || HAVE_NATIVE_mpn_rsblsh_n
 #if HAVE_NATIVE_mpn_rsblsh2_n
 	  fp[size] = mpn_rsblsh2_n (fp, fp, xp, size);
 #else /* HAVE_NATIVE_mpn_rsblsh_n */
diff -r 539c0a302182 -r 1dbb6ee37e11 mpn/x86_64/aorrlsh_n.asm
--- a/mpn/x86_64/aorrlsh_n.asm	Tue Dec 01 19:26:40 2009 +0100
+++ b/mpn/x86_64/aorrlsh_n.asm	Tue Dec 01 20:09:25 2009 +0100
@@ -149,7 +149,7 @@
 	jnc	L(oop)
 L(end):
 	add	%ebx, %ebx
-	adc	$0, %r15
+	ADDSUBC	$0, %r15
 	mov	%r15, %rax
 	pop	%rbx
 	pop	%r15


More information about the gmp-commit mailing list