[Gmp-commit] /var/hg/gmp: Make sublsh1_n actually work.

mercurial at gmplib.org mercurial at gmplib.org
Sun Oct 16 18:48:35 CEST 2011


details:   /var/hg/gmp/rev/765aaa80da2c
changeset: 14347:765aaa80da2c
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Oct 16 18:48:31 2011 +0200
description:
Make sublsh1_n actually work.

diffstat:

 mpn/s390_64/aorslsh1_n.asm |  33 ++++++++++++++++++---------------
 1 files changed, 18 insertions(+), 15 deletions(-)

diffs (108 lines):

diff -r 293172cd724d -r 765aaa80da2c mpn/s390_64/aorslsh1_n.asm
--- a/mpn/s390_64/aorslsh1_n.asm	Sun Oct 16 16:26:36 2011 +0200
+++ b/mpn/s390_64/aorslsh1_n.asm	Sun Oct 16 18:48:31 2011 +0200
@@ -36,18 +36,16 @@
   define(ADDSUBC,       algr)
   define(ADDSUBE,       alcgr)
   define(INITCY,        `lghi	%r13, -1')
-  define(RETVAL,        `lghi	%r2, 1
-			alcgr	%r2, %r13')
+  define(RETVAL,        `la	%r2, 2(%r1,%r13)')
   define(func, mpn_addlsh1_n)
 ')
 ifdef(`OPERATION_sublsh1_n',`
   define(ADDSUBC,       slgr)
   define(ADDSUBE,       slbgr)
   define(INITCY,        `lghi	%r13, 0')
-  define(RETVAL,        `slbgr	%r2, %r2
-			lcgr	%r2, %r2
-			algr	%r2, %r13
-			aghi	%r2, 1')
+  define(RETVAL,        `slgr	%r1, %r13
+			lghi	%r2, 1
+			algr	%r2, %r1')
   define(func, mpn_sublsh1_n)
 ')
 
@@ -57,13 +55,11 @@
 PROLOGUE(func)
 	stmg	%r6, %r13, 48(%r15)
 
-	INITCY
-
 	la	%r0, 3(n)
 	lghi	%r7, 3
 	srlg	%r0, %r0, 2
 	ngr	%r7, n			C n mod 4
-	je	L(top)			C The C flag is clear
+	je	L(b0)
 	cghi	%r7, 2
 	jl	L(b1)
 	je	L(b2)
@@ -76,26 +72,31 @@
 	algr	%r9, %r9
 	alcgr	%r10, %r10
 	alcgr	%r11, %r11
-
-	slbgr	%r13, %r13
+	slbgr	%r1, %r1
 
 	ADDSUBC	%r5, %r9
 	ADDSUBE	%r6, %r10
 	ADDSUBE	%r7, %r11
+	slbgr	%r13, %r13
 
 	stmg	%r5, %r7, 0(rp)
 	la	rp, 24(rp)
 	brctg	%r0, L(top)
 	j	L(end)
 
+L(b0):	lghi	%r1, -1
+	INITCY
+	j	L(top)
+
 L(b1):	lg	%r5, 0(up)
 	la	up, 8(up)
 	lg	%r9, 0(vp)
 	la	vp, 8(vp)
 
 	algr	%r9, %r9
+	slbgr	%r1, %r1
+	ADDSUBC	%r5, %r9
 	slbgr	%r13, %r13
-	ADDSUBC	%r5, %r9
 
 	stg	%r5, 0(rp)
 	la	rp, 8(rp)
@@ -109,11 +110,11 @@
 
 	algr	%r9, %r9
 	alcgr	%r10, %r10
-
-	slbgr	%r13, %r13
+	slbgr	%r1, %r1
 
 	ADDSUBC	%r5, %r9
 	ADDSUBE	%r6, %r10
+	slbgr	%r13, %r13
 
 	stmg	%r5, %r6, 0(rp)
 	la	rp, 16(rp)
@@ -123,6 +124,8 @@
 L(top):	lmg	%r9, %r12, 0(vp)
 	la	vp, 32(vp)
 
+	aghi	%r1, 1			C restore carry
+
 	alcgr	%r9, %r9
 	alcgr	%r10, %r10
 	alcgr	%r11, %r11
@@ -140,7 +143,7 @@
 	ADDSUBE	%r7, %r11
 	ADDSUBE	%r8, %r12
 
-	lgr	%r13, %r1
+	slbgr	%r13, %r13
 
 	stmg	%r5, %r8, 0(rp)
 	la	rp, 32(rp)


More information about the gmp-commit mailing list