[Gmp-commit] /var/hg/gmp: Simplified mpn_mod_1_1p_cps

mercurial at gmplib.org mercurial at gmplib.org
Tue Mar 1 22:20:05 CET 2011


details:   /var/hg/gmp/rev/7c4473db3190
changeset: 13964:7c4473db3190
user:      Niels M?ller <nisse at lysator.liu.se>
date:      Tue Mar 01 22:19:44 2011 +0100
description:
Simplified mpn_mod_1_1p_cps

diffstat:

 ChangeLog              |   6 ++++++
 mpn/x86/k7/mod_1_1.asm |  23 +++++------------------
 2 files changed, 11 insertions(+), 18 deletions(-)

diffs (73 lines):

diff -r e0c2725df0f7 -r 7c4473db3190 ChangeLog
--- a/ChangeLog	Tue Mar 01 19:27:49 2011 +0100
+++ b/ChangeLog	Tue Mar 01 22:19:44 2011 +0100
@@ -1,3 +1,9 @@
+2011-03-01  Niels Möller  <nisse at lysator.liu.se>
+
+	* mpn/x86/k7/mod_1_1.asm (mpn_mod_1_1p_cps): Simplified
+	computation, analogous to x86_64//mod_1_1.asm.
+	(mpn_mod_1_1p): Corresponding changes. Don't shift b.
+
 2011-03-01  Torbjorn Granlund  <tege at gmplib.org>
 
 	* mpn/x86/pentium4/sse2/mul_1.asm: Swap entry insns to share more code
diff -r e0c2725df0f7 -r 7c4473db3190 mpn/x86/k7/mod_1_1.asm
--- a/mpn/x86/k7/mod_1_1.asm	Tue Mar 01 19:27:49 2011 +0100
+++ b/mpn/x86/k7/mod_1_1.asm	Tue Mar 01 22:19:44 2011 +0100
@@ -77,9 +77,6 @@
 	mov	12(%ebp), %eax		C B2modb
 	push	%eax			C Put it on stack
 
-	mov	4(%ebp), %cl
-	shrl	%cl, b
-
 	mov	n, %edx
 	mov	24(%esp), ap
 
@@ -147,7 +144,6 @@
 	mov	t0, %eax
 
 	C Left-shift to normalize
-	shll	%cl, b
 	shld	%cl, r0, %eax C Always use shld?
 
 	shl	%cl, r0
@@ -185,7 +181,6 @@
 EPILOGUE()
 
 PROLOGUE(mpn_mod_1_1p_cps)
-C CAUTION: This is the same code as in pentium4/sse2//mod_1_1.asm
 	push	%ebp
 	mov	12(%esp), %ebp
 	push	%esi
@@ -197,25 +192,17 @@
 	mov	%ebp, %edx
 	not	%edx
 	mov	$-1, %eax
-	div	%ebp
+	div	%ebp			C On K7, invert_limb would be a few cycles faster.
 	mov	%eax, (%esi)		C store bi
 	mov	%ecx, 4(%esi)		C store cnt
-	xor	%ebx, %ebx
-	sub	%ebp, %ebx
+	neg	%ebp
 	mov	$1, %edx
 	shld	%cl, %eax, %edx
-	imul	%edx, %ebx
-	mul	%ebx
-	add	%ebx, %edx
-	not	%edx
 	imul	%ebp, %edx
-	add	%edx, %ebp
-	cmp	%edx, %eax
-	cmovc(	%ebp, %edx)
-	shr	%cl, %ebx
-	mov	%ebx, 8(%esi)		C store B1modb
 	shr	%cl, %edx
-	mov	%edx, 12(%esi)		C store B2modb
+	imul	%ebp, %eax
+	mov	%edx, 8(%esi)		C store B1modb
+	mov	%eax, 12(%esi)		C store B2modb
 	pop	%ebx
 	pop	%esi
 	pop	%ebp


More information about the gmp-commit mailing list