[Gmp-commit] /var/hg/gmp: mpn/x86_64/mod_1_1.asm (mpn_mod_1_1p): Shaved off o...

mercurial at gmplib.org mercurial at gmplib.org
Wed Feb 23 07:03:22 CET 2011


details:   /var/hg/gmp/rev/3c44a85b6ab2
changeset: 13889:3c44a85b6ab2
user:      Niels M?ller <nisse at lysator.liu.se>
date:      Wed Feb 23 07:03:06 2011 +0100
description:
mpn/x86_64/mod_1_1.asm (mpn_mod_1_1p): Shaved off one instruction and one register in the inner loop.

diffstat:

 ChangeLog              |   5 +++++
 mpn/x86_64/mod_1_1.asm |  15 +++++++--------
 2 files changed, 12 insertions(+), 8 deletions(-)

diffs (48 lines):

diff -r 0c678f22f3f8 -r 3c44a85b6ab2 ChangeLog
--- a/ChangeLog	Tue Feb 22 22:08:27 2011 +0100
+++ b/ChangeLog	Wed Feb 23 07:03:06 2011 +0100
@@ -1,3 +1,8 @@
+2011-02-23  Niels Möller  <nisse at lysator.liu.se>
+
+	* mpn/x86_64/mod_1_1.asm (mpn_mod_1_1p): Shaved off one
+	instruction and one register in the inner loop.
+
 2011-02-22  Torbjorn Granlund  <tege at gmplib.org>
 
 	* configure.in: Export SHLD_SLOW and SHRD_SLOW to config.m4, also
diff -r 0c678f22f3f8 -r 3c44a85b6ab2 mpn/x86_64/mod_1_1.asm
--- a/mpn/x86_64/mod_1_1.asm	Tue Feb 22 22:08:27 2011 +0100
+++ b/mpn/x86_64/mod_1_1.asm	Wed Feb 23 07:03:06 2011 +0100
@@ -41,7 +41,7 @@
 define(`r0',     `%rbp') C r1 kept in %rax
 define(`r2',	 `%r8')  C kept negated
 define(`t0',     `%r9')
-define(`t1',     `%rcx') C Also used as shift count
+C define(`t1',     `%rcx') C Also used as shift count
 
 C mp_limb_t
 C mpn_mod_1_1p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t bmodb[4])
@@ -108,17 +108,16 @@
 
 	ALIGN(16)
 L(top):	and	B2modb, r2
-	lea	(B2mb, r0), t1
+	lea	(B2mb, r0), t0
 	mul	B2modb
-	add	r2, r0
-	mov	(ap, n, 8), t0
-	cmovc	t1, r0
-	add	%rax, t0
-	mov	r0, %rax
+	add	r0, r2
+	mov	(ap, n, 8), r0
+	cmovc	t0, r2
+	add	%rax, r0
+	mov	r2, %rax
 	adc	%rdx, %rax
 	sbb 	r2, r2
 	sub 	$1, n
-	mov	t0, r0
 	jnc	L(top)
 
 L(reduce_three):


More information about the gmp-commit mailing list