[Gmp-commit] /home/hgfiles/gmp: Add mpn_rsh1add_nc, mpn_rsh1sub_nc support.

mercurial at gmplib.org mercurial at gmplib.org
Sat Dec 19 10:24:08 CET 2009


details:   /home/hgfiles/gmp/rev/d38ae3fc622d
changeset: 13132:d38ae3fc622d
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sat Dec 19 10:24:03 2009 +0100
description:
Add mpn_rsh1add_nc, mpn_rsh1sub_nc support.

diffstat:

 ChangeLog                 |   7 +++++++
 configure.in              |   2 ++
 gmp-impl.h                |   4 ++++
 mpn/asm-defs.m4           |   2 ++
 mpn/x86_64/rsh1aors_n.asm |  25 +++++++++++++++++++------
 5 files changed, 34 insertions(+), 6 deletions(-)

diffs (108 lines):

diff -r cd997c18c6b7 -r d38ae3fc622d ChangeLog
--- a/ChangeLog	Sat Dec 19 05:42:53 2009 +0100
+++ b/ChangeLog	Sat Dec 19 10:24:03 2009 +0100
@@ -1,3 +1,10 @@
+2009-12-19  Torbjorn Granlund  <tege at gmplib.org>
+
+	* gmp-impl.h (mpn_rsh1add_nc, mpn_rsh1sub_nc): Declare.
+	* mpn/asm-defs.m4: Likewise.
+	* configure.in: Add corresponding HAVE_NATIVEs.
+	* mpn/x86_64/rsh1aors_n.asm: Add _nc entry point.
+
 2009-12-18  Niels Möller  <nisse at lysator.liu.se>
 
 	* mpz/divexact.c: Rewrite to use mpn_divexact.
diff -r cd997c18c6b7 -r d38ae3fc622d configure.in
--- a/configure.in	Sat Dec 19 05:42:53 2009 +0100
+++ b/configure.in	Sat Dec 19 10:24:03 2009 +0100
@@ -3022,7 +3022,9 @@
 #undef HAVE_NATIVE_mpn_rsblsh2_n
 #undef HAVE_NATIVE_mpn_rsblsh_n
 #undef HAVE_NATIVE_mpn_rsh1add_n
+#undef HAVE_NATIVE_mpn_rsh1add_nc
 #undef HAVE_NATIVE_mpn_rsh1sub_n
+#undef HAVE_NATIVE_mpn_rsh1sub_nc
 #undef HAVE_NATIVE_mpn_rshift
 #undef HAVE_NATIVE_mpn_sqr_basecase
 #undef HAVE_NATIVE_mpn_sqr_diagonal
diff -r cd997c18c6b7 -r d38ae3fc622d gmp-impl.h
--- a/gmp-impl.h	Sat Dec 19 05:42:53 2009 +0100
+++ b/gmp-impl.h	Sat Dec 19 10:24:03 2009 +0100
@@ -845,6 +845,8 @@
    and returns the bit rshifted out (0 or 1).  */
 #define mpn_rsh1add_n __MPN(rsh1add_n)
 __GMP_DECLSPEC mp_limb_t mpn_rsh1add_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
+#define mpn_rsh1add_nc __MPN(rsh1add_nc)
+__GMP_DECLSPEC mp_limb_t mpn_rsh1add_nc __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
 
 /* mpn_rsh1sub_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).  If there's a borrow from the
@@ -852,6 +854,8 @@
    complement negative.  */
 #define mpn_rsh1sub_n __MPN(rsh1sub_n)
 __GMP_DECLSPEC mp_limb_t mpn_rsh1sub_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
+#define mpn_rsh1sub_nc __MPN(rsh1sub_nc)
+__GMP_DECLSPEC mp_limb_t mpn_rsh1sub_nc __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
 
 #define mpn_lshiftc __MPN(lshiftc)
 __GMP_DECLSPEC mp_limb_t mpn_lshiftc __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned int));
diff -r cd997c18c6b7 -r d38ae3fc622d mpn/asm-defs.m4
--- a/mpn/asm-defs.m4	Sat Dec 19 05:42:53 2009 +0100
+++ b/mpn/asm-defs.m4	Sat Dec 19 10:24:03 2009 +0100
@@ -1391,7 +1391,9 @@
 define_mpn(rsblsh2_n)
 define_mpn(rsblsh_n)
 define_mpn(rsh1add_n)
+define_mpn(rsh1add_nc)
 define_mpn(rsh1sub_n)
+define_mpn(rsh1sub_nc)
 define_mpn(rshift)
 define_mpn(rshiftc)
 define_mpn(scan0)
diff -r cd997c18c6b7 -r d38ae3fc622d mpn/x86_64/rsh1aors_n.asm
--- a/mpn/x86_64/rsh1aors_n.asm	Sat Dec 19 05:42:53 2009 +0100
+++ b/mpn/x86_64/rsh1aors_n.asm	Sat Dec 19 10:24:03 2009 +0100
@@ -40,24 +40,37 @@
 ifdef(`OPERATION_rsh1add_n', `
 	define(ADDSUB,	      add)
 	define(ADCSBB,	      adc)
-	define(func,	      mpn_rsh1add_n)')
+	define(func_n,	      mpn_rsh1add_n)
+	define(func_nc,	      mpn_rsh1add_nc)')
 ifdef(`OPERATION_rsh1sub_n', `
 	define(ADDSUB,	      sub)
 	define(ADCSBB,	      sbb)
-	define(func,	      mpn_rsh1sub_n)')
+	define(func_n,	      mpn_rsh1sub_n)
+	define(func_nc,	      mpn_rsh1sub_nc)')
 
-MULFUNC_PROLOGUE(mpn_rsh1add_n mpn_rsh1sub_n)
+MULFUNC_PROLOGUE(mpn_rsh1add_n mpn_rsh1add_nc mpn_rsh1sub_n mpn_rsh1sub_nc)
 
 ASM_START()
 	TEXT
+
 	ALIGN(16)
-PROLOGUE(func)
-	push	%rbx			C				1
+PROLOGUE(func_nc)
+	push	%rbx
+
+	xor	%eax, %eax
+	mov	(up), %rbx
+	ADCSBB	(vp), %rbx
+	jmp	L(ent)
+EPILOGUE()
+
+	ALIGN(16)
+PROLOGUE(func_n)
+	push	%rbx
 
 	xor	%eax, %eax
 	mov	(up), %rbx
 	ADDSUB	(vp), %rbx
-
+L(ent):
 	rcr	%rbx			C rotate, save acy
 	adc	%eax, %eax		C return value
 


More information about the gmp-commit mailing list