[Gmp-commit] /var/hg/gmp: small optimizations

mercurial at gmplib.org mercurial at gmplib.org
Wed Mar 9 17:39:25 CET 2011


details:   /var/hg/gmp/rev/d0a1227b5f35
changeset: 14017:d0a1227b5f35
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Wed Mar 09 17:39:18 2011 +0100
description:
small optimizations

diffstat:

 mpn/x86/atom/sse2/bdiv_dbm1c.asm |  26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

diffs (73 lines):

diff -r 8bf7f35d98d1 -r d0a1227b5f35 mpn/x86/atom/sse2/bdiv_dbm1c.asm
--- a/mpn/x86/atom/sse2/bdiv_dbm1c.asm	Wed Mar 09 16:16:01 2011 +0100
+++ b/mpn/x86/atom/sse2/bdiv_dbm1c.asm	Wed Mar 09 17:39:18 2011 +0100
@@ -44,6 +44,10 @@
 defframe(PARAM_SRC,  8)
 defframe(PARAM_DST,  4)
 
+dnl  re-use parameter space
+define(SAVE_RP,`PARAM_MUL')
+define(SAVE_UP,`PARAM_SIZE')
+
 define(`rp', `%edi')
 define(`up', `%esi')
 define(`n',  `%ecx')
@@ -56,32 +60,32 @@
 deflit(`FRAME',0)
 
 PROLOGUE(mpn_bdiv_dbm1c)
-	push	%edi			FRAME_pushl()
-	push	%esi			FRAME_pushl()
+	mov	PARAM_SIZE, n		C size
+	mov	up, SAVE_UP
+	mov	PARAM_SRC, up
+	movd	PARAM_MUL, %mm7
+	mov	rp, SAVE_RP
 	mov	PARAM_DST, rp
-	mov	PARAM_SRC, up
-	mov	PARAM_SIZE, n		C size
-	movd	PARAM_MUL, %mm7
-	mov	PARAM_CARRY, cy
 
 	movd	(up), %mm0
 	pmuludq	%mm7, %mm0
 	shr	n
+	mov	PARAM_CARRY, cy
 	jz	L(eq1)
 
 	movd	4(up), %mm1
 	jc	L(odd)
 
+	lea	4(up), up
 	pmuludq	%mm7, %mm1
 	movd	%mm0, reg
 	psrlq	$32, %mm0
 	sub	reg, cy
 	movd	%mm0, reg
 	movq	%mm1, %mm0
+	dec	n
 	mov	cy, (rp)
 	lea	4(rp), rp
-	lea	4(up), up
-	dec	n
 	jz	L(end)
 
 C	ALIGN(16)
@@ -110,14 +114,14 @@
 
 L(eq1):	movd	%mm0, reg
 	psrlq	$32, %mm0
+	mov	SAVE_UP, up
 	sub	reg, cy
 	movd	%mm0, reg
+	emms
 	mov	cy, (rp)
 	sbb	reg, cy
 
-	emms
-	pop	%esi			FRAME_popl()
-	pop	%edi			FRAME_popl()
+	mov	SAVE_RP, rp
 	ret
 EPILOGUE()
 ASM_END()


More information about the gmp-commit mailing list