[Gmp-commit] /var/hg/gmp: Avoid save and restore of %r12

mercurial at gmplib.org mercurial at gmplib.org
Wed Feb 23 11:29:05 CET 2011


details:   /var/hg/gmp/rev/980fee0af6d5
changeset: 13890:980fee0af6d5
user:      Niels M?ller <nisse at lysator.liu.se>
date:      Wed Feb 23 11:28:44 2011 +0100
description:
Avoid save and restore of %r12

diffstat:

 ChangeLog              |  4 +++-
 mpn/x86_64/mod_1_1.asm |  7 ++-----
 2 files changed, 5 insertions(+), 6 deletions(-)

diffs (49 lines):

diff -r 3c44a85b6ab2 -r 980fee0af6d5 ChangeLog
--- a/ChangeLog	Wed Feb 23 07:03:06 2011 +0100
+++ b/ChangeLog	Wed Feb 23 11:28:44 2011 +0100
@@ -1,7 +1,9 @@
 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.
+	instruction and one register in the inner loop. Rearranged
+	registers slightly, and no longer needs the callee-save register
+	%r12.
 
 2011-02-22  Torbjorn Granlund  <tege at gmplib.org>
 
diff -r 3c44a85b6ab2 -r 980fee0af6d5 mpn/x86_64/mod_1_1.asm
--- a/mpn/x86_64/mod_1_1.asm	Wed Feb 23 07:03:06 2011 +0100
+++ b/mpn/x86_64/mod_1_1.asm	Wed Feb 23 11:28:44 2011 +0100
@@ -35,13 +35,12 @@
 define(`B2modb', `%r11')
 define(`ap',     `%rdi')
 define(`n',      `%rsi')
-define(`pre',    `%r12')
+define(`pre',    `%r8')
 define(`b',      `%rbx')
 
 define(`r0',     `%rbp') C r1 kept in %rax
-define(`r2',	 `%r8')  C kept negated
+define(`r2',	 `%rcx')  C kept negated. Also used as shift count
 define(`t0',     `%r9')
-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])
@@ -78,7 +77,6 @@
 PROLOGUE(mpn_mod_1_1p)
 	push	%rbp
 	push	%rbx
-	push	%r12
 	mov	%rdx, b
 	mov	%rcx, pre
 
@@ -171,7 +169,6 @@
 	jnc	L(fix)
 L(ok):	shr	R8(%rcx), %rax
 
-	pop	%r12
 	pop	%rbx
 	pop	%rbp
 	ret


More information about the gmp-commit mailing list