[Gmp-commit] /var/hg/gmp: Avoid setting carry in jumptab calc.

mercurial at gmplib.org mercurial at gmplib.org
Wed Jun 7 11:45:06 UTC 2017


details:   /var/hg/gmp/rev/ab2326038a38
changeset: 17439:ab2326038a38
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Wed Jun 07 13:44:59 2017 +0200
description:
Avoid setting carry in jumptab calc.

diffstat:

 mpn/x86_64/coreihwl/aors_n.asm |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (42 lines):

diff -r 1fbc37263d34 -r ab2326038a38 mpn/x86_64/coreihwl/aors_n.asm
--- a/mpn/x86_64/coreihwl/aors_n.asm	Tue Jun 06 20:33:44 2017 +0200
+++ b/mpn/x86_64/coreihwl/aors_n.asm	Wed Jun 07 13:44:59 2017 +0200
@@ -88,13 +88,12 @@
 	and	$7, R32(%rax)
 
 	lea	L(tab)(%rip), %r9
+	neg	%r8			C set carry
 ifdef(`PIC',`
 	movslq	(%r9,%rax,4), %rax
-	add	%r9, %rax
-	neg	%r8			C set carry
+	lea	(%r9,%rax), %rax	C lea not add to preserve carry
 	jmp	*%rax
 ',`
-	neg	%r8			C set carry
 	jmp	*(%r9,%rax,8)
 ')
 EPILOGUE()
@@ -105,12 +104,12 @@
 
 	mov	R32(n), R32(%rax)
 	shr	$3, n
-	and	$7, R32(%rax)
+	and	$7, R32(%rax)		C clear cy as side-effect
 
 	lea	L(tab)(%rip), %r9
 ifdef(`PIC',`
 	movslq	(%r9,%rax,4), %rax
-	add	%r9, %rax
+	lea	(%r9,%rax), %rax	C lea not add to preserve carry
 	jmp	*%rax
 ',`
 	jmp	*(%r9,%rax,8)
@@ -159,6 +158,7 @@
 	inc	n
 	jmp	L(e7)
 
+	ALIGN(16)
 L(top):
 L(e3):	mov	%r9, 40(rp)
 L(e2):	mov	%r10, 48(rp)


More information about the gmp-commit mailing list