[Gmp-commit] /home/hgfiles/gmp: Revert last change for mpn_mod_1_1p.

mercurial at gmplib.org mercurial at gmplib.org
Tue May 4 10:33:45 CEST 2010


details:   /home/hgfiles/gmp/rev/1dc475969837
changeset: 13599:1dc475969837
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Tue May 04 10:33:40 2010 +0200
description:
Revert last change for mpn_mod_1_1p.

diffstat:

 ChangeLog              |  5 +++++
 mpn/generic/mod_1_1.c  |  7 +++++++
 mpn/x86_64/mod_1_1.asm |  9 +++++++--
 3 files changed, 19 insertions(+), 2 deletions(-)

diffs (50 lines):

diff -r c7b665ec4bda -r 1dc475969837 ChangeLog
--- a/ChangeLog	Mon May 03 22:25:23 2010 +0200
+++ b/ChangeLog	Tue May 04 10:33:40 2010 +0200
@@ -1,3 +1,8 @@
+2010-05-04  Torbjorn Granlund  <tege at gmplib.org>
+
+	* mpn/generic/mod_1_1.c: Undo last change.
+	* mpn/x86_64/mod_1_1.asm: Likewise.
+
 2010-05-03  Niels Möller  <nisse at lysator.liu.se>
 
 	* mpn/generic/jacobi_lehmer.c (jacobi_hook): New function.
diff -r c7b665ec4bda -r 1dc475969837 mpn/generic/mod_1_1.c
--- a/mpn/generic/mod_1_1.c	Mon May 03 22:25:23 2010 +0200
+++ b/mpn/generic/mod_1_1.c	Tue May 04 10:33:40 2010 +0200
@@ -68,8 +68,15 @@
   B1modb = bmodb[2];
   B2modb = bmodb[3];
 
+#if 1
+  umul_ppmm (ph, pl, ap[n - 1], B1modb);
+  add_ssaaaa (rh, rl, ph, pl, 0, ap[n - 2]);
+#else
+  /* FIXME: We could avoid the above multiply when n > 2, i.e., we're about to
+     enter the loop.  But the post loop code assumes rh is reduced.  */
   rh = ap[n - 1];
   rl = ap[n - 2];
+#endif
 
   for (i = n - 3; i >= 0; i -= 1)
     {
diff -r c7b665ec4bda -r 1dc475969837 mpn/x86_64/mod_1_1.asm
--- a/mpn/x86_64/mod_1_1.asm	Mon May 03 22:25:23 2010 +0200
+++ b/mpn/x86_64/mod_1_1.asm	Tue May 04 10:33:40 2010 +0200
@@ -41,8 +41,13 @@
 	mov	16(%rcx), %r10
 	mov	24(%rcx), %r11
 
-	mov	-8(%rdi,%rsi,8), %r8
-	mov	-16(%rdi,%rsi,8), %rax
+C FIXME: See comment in generic/mod_1_1.c.
+	mov	-8(%rdi,%rsi,8), %rax
+	mul	%r10
+	mov	-16(%rdi,%rsi,8), %r9
+	xor	R32(%r8), R32(%r8)
+	add	%r9, %rax
+	adc	%rdx, %r8
 
 	sub	$3, %rsi
 	js	L(2)


More information about the gmp-commit mailing list