[Gmp-commit] /var/hg/gmp: Make the code for 1 <= n <= 3 work.

mercurial at gmplib.org mercurial at gmplib.org
Mon Sep 23 12:14:37 CEST 2013


details:   /var/hg/gmp/rev/ebc3597af052
changeset: 16022:ebc3597af052
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Mon Sep 23 12:13:53 2013 +0200
description:
Make the code for 1 <= n <= 3 work.

diffstat:

 mpn/x86_64/bobcat/redc_1.asm |  49 ++++++++++++++++++++++++++-----------------
 1 files changed, 30 insertions(+), 19 deletions(-)

diffs (113 lines):

diff -r cb51e25676ef -r ebc3597af052 mpn/x86_64/bobcat/redc_1.asm
--- a/mpn/x86_64/bobcat/redc_1.asm	Sun Sep 22 23:40:59 2013 +0200
+++ b/mpn/x86_64/bobcat/redc_1.asm	Mon Sep 23 12:13:53 2013 +0200
@@ -402,21 +402,21 @@
 
 L(n1):	mov	(mp_param), %rax
 	mul	q0
-	add	-16(up), %rax
-	adc	-8(up), %rdx
+	add	-8(up), %rax
+	adc	(up), %rdx
 	mov	%rdx, (rp)
 	mov	$0, R32(%rax)
 	adc	R32(%rax), R32(%rax)
 	jmp	L(ret)
 
 L(n2):	mov	(mp_param), %rax
-	mov	-24(up), %rbp
+	mov	-16(up), %rbp
 	mul	q0
 	add	%rax, %rbp
 	mov	%rdx, %r9
 	adc	$0, %r9
-	mov	-16(mp), %rax
-	mov	-16(up), %r10
+	mov	-8(mp), %rax
+	mov	-8(up), %r10
 	mul	q0
 	add	%rax, %r10
 	mov	%rdx, %r11
@@ -425,13 +425,13 @@
 	adc	$0, %r11
 	mov	%r10, q0
 	imul	u0inv, q0		C next q0
-	mov	-24(mp), %rax
+	mov	-16(mp), %rax
 	mul	q0
 	add	%rax, %r10
 	mov	%rdx, %r9
 	adc	$0, %r9
-	mov	-16(mp), %rax
-	mov	-8(up), %r14
+	mov	-8(mp), %rax
+	mov	(up), %r14
 	mul	q0
 	add	%rax, %r14
 	adc	$0, %rdx
@@ -439,28 +439,28 @@
 	adc	$0, %rdx
 	xor	R32(%rax), R32(%rax)
 	add	%r11, %r14
-	adc	(up), %rdx
+	adc	8(up), %rdx
 	mov	%r14, (rp)
 	mov	%rdx, 8(rp)
 	adc	R32(%rax), R32(%rax)
 	jmp	L(ret)
 
 	ALIGNx
-L(n3):	mov	-32(mp), %rax
-	mov	-32(up), %r10
+L(n3):	mov	-24(mp), %rax
+	mov	-24(up), %r10
 	mul	q0
 	add	%rax, %r10
-	mov	-24(mp), %rax
+	mov	-16(mp), %rax
 	mov	%rdx, %r11
 	adc	$0, %r11
-	mov	-24(up), %rbp
+	mov	-16(up), %rbp
 	mul	q0
 	add	%rax, %rbp
 	mov	%rdx, %r9
 	adc	$0, %r9
-	mov	-16(mp), %rax
+	mov	-8(mp), %rax
 	add	%r11, %rbp
-	mov	-16(up), %r10
+	mov	-8(up), %r10
 	adc	$0, %r9
 	mul	q0
 	mov	%rbp, q0
@@ -468,14 +468,25 @@
 	add	%rax, %r10
 	mov	%rdx, %r11
 	adc	$0, %r11
-	mov	%rbp, -24(up)
+	mov	%rbp, -16(up)
 	add	%r9, %r10
 	adc	$0, %r11
-	mov	%r10, -16(up)
-	mov	%r11, -32(up)		C up[0]
+	mov	%r10, -8(up)
+	mov	%r11, -24(up)		C up[0]
 	lea	8(up), up		C up++
 	dec	j
 	jnz	L(n3)
-	jmp	L(cj)
+
+	mov	-48(up), %rdx
+	mov	-40(up), %rbx
+	xor	R32(%rax), R32(%rax)
+	add	%rbp, %rdx
+	adc	%r10, %rbx
+	adc	-8(up), %r11
+	mov	%rdx, (rp)
+	mov	%rbx, 8(rp)
+	mov	%r11, 16(rp)
+	adc	R32(%rax), R32(%rax)
+	jmp	L(ret)
 EPILOGUE()
 ASM_END()


More information about the gmp-commit mailing list