[Gmp-commit] /var/hg/gmp: 6 new changesets

mercurial at gmplib.org mercurial at gmplib.org
Sun Oct 9 22:54:17 CEST 2011


details:   /var/hg/gmp/rev/ad989ac0a003
changeset: 14290:ad989ac0a003
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Oct 09 22:48:23 2011 +0200
description:
Rewrite using lmg/stmg.

details:   /var/hg/gmp/rev/16255ee62efe
changeset: 14291:16255ee62efe
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Oct 09 22:48:31 2011 +0200
description:
Rewrite using lmg/stmg.

details:   /var/hg/gmp/rev/c575436d1436
changeset: 14292:c575436d1436
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Oct 09 22:48:53 2011 +0200
description:
New file.

details:   /var/hg/gmp/rev/efe5909dbf28
changeset: 14293:efe5909dbf28
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Oct 09 22:49:04 2011 +0200
description:
New file.

details:   /var/hg/gmp/rev/dceadf02cc71
changeset: 14294:dceadf02cc71
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Oct 09 22:49:20 2011 +0200
description:
New file.

details:   /var/hg/gmp/rev/f3cf63f51722
changeset: 14295:f3cf63f51722
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Oct 09 22:49:28 2011 +0200
description:
*** empty log message ***

diffstat:

 ChangeLog              |    7 +++
 mpn/s390_64/add_n.asm  |   74 +++++++++++++++++++++++++++++-----
 mpn/s390_64/copyi.asm  |   44 ++++++++++++++++++++
 mpn/s390_64/lshift.asm |  104 +++++++++++++++++++++++++++++++++++++++++++++++++
 mpn/s390_64/rshift.asm |   92 +++++++++++++++++++++++++++++++++++++++++++
 mpn/s390_64/sub_n.asm  |   76 ++++++++++++++++++++++++++++++-----
 6 files changed, 374 insertions(+), 23 deletions(-)

diffs (truncated from 460 to 300 lines):

diff -r d15ec9db68e7 -r f3cf63f51722 ChangeLog
--- a/ChangeLog	Sun Oct 09 20:26:46 2011 +0200
+++ b/ChangeLog	Sun Oct 09 22:49:28 2011 +0200
@@ -1,5 +1,12 @@
 2011-10-09  Torbjorn Granlund  <tege at gmplib.org>
 
+	* mpn/s390_64/copyi.asm: New file.
+	* mpn/s390_64/lshift.asm: New file.
+	* mpn/s390_64/rshift.asm: New file.
+
+	* mpn/s390_64/add_n.asm: Rewrite using lmg/stmg.
+	* mpn/s390_64/sub_n.asm: Likewise.
+
 	* mpn/s390_64/invert_limb.asm: Save a callee-saves register less.
 
 	* tune/time.c (getrusage_backwards_p): Properly cast printed values.
diff -r d15ec9db68e7 -r f3cf63f51722 mpn/s390_64/add_n.asm
--- a/mpn/s390_64/add_n.asm	Sun Oct 09 20:26:46 2011 +0200
+++ b/mpn/s390_64/add_n.asm	Sun Oct 09 22:49:28 2011 +0200
@@ -17,8 +17,13 @@
 dnl  You should have received a copy of the GNU Lesser General Public License
 dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
 
+include(`../config.m4')
 
-include(`../config.m4')
+C            cycles/limb
+C z990           3.5
+
+C TODO
+C  * Optimise for small n
 
 C INPUT PARAMETERS
 define(`rp',	`%r2')
@@ -28,20 +33,65 @@
 
 ASM_START()
 PROLOGUE(mpn_add_n)
-	stg	%r12, 96(%r15)
-	lghi	%r12, 0			C zero index register
-	aghi	%r12, 0			C clear C flag
+	stmg	%r6, %r12, 48(%r15)
 
-L(top):	lg	%r0, 0(%r12,up)
-	lg	%r1, 0(%r12,vp)
-	alcgr	%r0, %r1
-	stg	%r0, 0(%r12,rp)
-	la	%r12, 8(%r12)
-	brctg	n, L(top)
+	la	%r1, 3(n)
+	lghi	%r7, 3
+	srlg	%r1, %r1, 2
+	ngr	%r7, n			C n mod 4
+	je	L(top)			C The C flag is clear
+	cghi	%r7, 2
+	jl	L(b1)
+	je	L(b2)
 
-	lghi	%r2, 0
+L(b3):	lmg	%r5, %r7, 0(up)
+	la	up, 24(up)
+	lmg	%r9, %r11, 0(vp)
+	la	vp, 24(vp)
+	algr	%r5, %r9
+	alcgr	%r6, %r10
+	alcgr	%r7, %r11
+	stmg	%r5, %r7, 0(rp)
+	la	rp, 24(rp)
+	brctg	%r1, L(top)
+	j	L(end)
+
+L(b1):	lg	%r5, 0(up)
+	la	up, 8(up)
+	lg	%r9, 0(vp)
+	la	vp, 8(vp)
+	algr	%r5, %r9
+	stg	%r5, 0(rp)
+	la	rp, 8(rp)
+	brctg	%r1, L(top)
+	j	L(end)
+
+L(b2):	lmg	%r5, %r6, 0(up)
+	la	up, 16(up)
+	lmg	%r9, %r10, 0(vp)
+	la	vp, 16(vp)
+	algr	%r5, %r9
+	alcgr	%r6, %r10
+	stmg	%r5, %r6, 0(rp)
+	la	rp, 16(rp)
+	brctg	%r1, L(top)
+	j	L(end)
+
+L(top):	lmg	%r5, %r8, 0(up)
+	la	up, 32(up)
+	lmg	%r9, %r12, 0(vp)
+	la	vp, 32(vp)
+	alcgr	%r5, %r9
+	alcgr	%r6, %r10
+	alcgr	%r7, %r11
+	alcgr	%r8, %r12
+	stmg	%r5, %r8, 0(rp)
+	la	rp, 32(rp)
+	brctg	%r1, L(top)
+
+L(end):	lghi	%r2, 0
 	alcgr	%r2, %r2
 
-	lg	%r12, 96(%r15)
+	lmg	%r6, %r12, 48(%r15)
 	br	%r14
 EPILOGUE()
diff -r d15ec9db68e7 -r f3cf63f51722 mpn/s390_64/copyi.asm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpn/s390_64/copyi.asm	Sun Oct 09 22:49:28 2011 +0200
@@ -0,0 +1,44 @@
+dnl  S/390-64 mpn_copyi
+
+dnl  Copyright 2011 Free Software Foundation, Inc.
+
+dnl  This file is part of the GNU MP Library.
+
+dnl  The GNU MP Library is free software; you can redistribute it and/or modify
+dnl  it under the terms of the GNU Lesser General Public License as published
+dnl  by the Free Software Foundation; either version 3 of the License, or (at
+dnl  your option) any later version.
+
+dnl  The GNU MP Library is distributed in the hope that it will be useful, but
+dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+dnl  License for more details.
+
+dnl  You should have received a copy of the GNU Lesser General Public License
+dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+
+
+include(`../config.m4')
+
+C            cycles/limb
+C z990           1		fluctuates somewhat
+
+C FIXME
+C  * Optimise.  GNU memcpy beats us at 0.75 c/l.
+
+C INPUT PARAMETERS
+define(`rp',	`%r2')
+define(`up',	`%r3')
+define(`n',	`%r4')
+
+ASM_START()
+PROLOGUE(mpn_copyi)
+	lgr	%r0, %r3
+	sllg	%r3, %r4, 3
+	sllg	%r1, %r4, 3
+
+L(top):	mvcle	%r2, %r0, 0(0)
+	jne	L(top)
+
+	br	%r14
+EPILOGUE()
diff -r d15ec9db68e7 -r f3cf63f51722 mpn/s390_64/lshift.asm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpn/s390_64/lshift.asm	Sun Oct 09 22:49:28 2011 +0200
@@ -0,0 +1,104 @@
+dnl  S/390-64 mpn_lshift
+
+dnl  Copyright 2011 Free Software Foundation, Inc.
+
+dnl  This file is part of the GNU MP Library.
+
+dnl  The GNU MP Library is free software; you can redistribute it and/or modify
+dnl  it under the terms of the GNU Lesser General Public License as published
+dnl  by the Free Software Foundation; either version 3 of the License, or (at
+dnl  your option) any later version.
+
+dnl  The GNU MP Library is distributed in the hope that it will be useful, but
+dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+dnl  License for more details.
+
+dnl  You should have received a copy of the GNU Lesser General Public License
+dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+
+include(`../config.m4')
+
+C            cycles/limb
+C z990           4.3
+
+C FIXME
+C  * Streamline feed-in code.
+
+C INPUT PARAMETERS
+define(`rp',	`%r2')
+define(`up',	`%r3')
+define(`n',	`%r4')
+define(`cnt',	`%r5')
+
+define(`tnc',	`%r6')
+
+ASM_START()
+PROLOGUE(mpn_lshift)
+	cghi	n, 1
+	jne	L(gt1)
+	lcgr	%r4, cnt
+	lg	%r1, 0(up)
+	sllg	%r0, %r1, 0(cnt)
+	stg	%r0, 0(rp)
+	srlg	%r2, %r1, 0(%r4)
+	br	%r14
+
+L(gt1):	stmg	%r6, %r10, 48(%r15)
+
+	sllg	%r1, n, 3
+	aghi	up, -8
+
+	lg	%r9, 0(%r1,up)
+
+	srlg	%r10, n, 2		C loop count
+	lcgr	tnc, cnt
+
+	lghi	%r7, 3
+	sllg	%r0, %r9, 0(cnt)
+
+	ngr	%r7, n			C n mod 4
+	je	L(b0)
+	aghi	%r10, 1
+	cghi	%r7, 2
+	jl	L(b1)
+	je	L(b2)
+
+L(b3):	aghi	%r1, -16
+	j	L(m3)
+L(b0):	aghi	%r1, -24
+	j	L(m0)
+L(b1):	aghi	%r1, -32
+	aghi	%r10, -1
+	j	L(top)
+L(b2):	aghi	%r1, -8
+	j	L(m2)
+
+L(top):	lg	%r7, 24(%r1,up)
+	srlg	%r8, %r7, 0(tnc)
+	ogr	%r8, %r0
+	sllg	%r0, %r7, 0(cnt)
+	stg	%r8, 24(%r1,rp)
+L(m0):	lg	%r7, 16(%r1,up)
+	srlg	%r8, %r7, 0(tnc)
+	ogr	%r8, %r0
+	sllg	%r0, %r7, 0(cnt)
+	stg	%r8, 16(%r1,rp)
+L(m3):	lg	%r7, 8(%r1,up)
+	srlg	%r8, %r7, 0(tnc)
+	ogr	%r8, %r0
+	sllg	%r0, %r7, 0(cnt)
+	stg	%r8, 8(%r1,rp)
+L(m2):	lg	%r7, 0(%r1,up)
+	srlg	%r8, %r7, 0(tnc)
+	ogr	%r8, %r0
+	sllg	%r0, %r7, 0(cnt)
+	stg	%r8, 0(%r1,rp)
+	aghi	%r1, -32
+	brctg	%r10, L(top)
+
+L(end):	stg	%r0, 24(%r1,rp)
+	srlg	%r2, %r9, 0(tnc)
+	lmg	%r6, %r10, 48(%r15)
+	br	%r14
+EPILOGUE()
diff -r d15ec9db68e7 -r f3cf63f51722 mpn/s390_64/rshift.asm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpn/s390_64/rshift.asm	Sun Oct 09 22:49:28 2011 +0200
@@ -0,0 +1,92 @@
+dnl  S/390-64 mpn_rshift
+
+dnl  Copyright 2011 Free Software Foundation, Inc.
+
+dnl  This file is part of the GNU MP Library.
+
+dnl  The GNU MP Library is free software; you can redistribute it and/or modify
+dnl  it under the terms of the GNU Lesser General Public License as published
+dnl  by the Free Software Foundation; either version 3 of the License, or (at
+dnl  your option) any later version.
+
+dnl  The GNU MP Library is distributed in the hope that it will be useful, but
+dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+dnl  License for more details.
+
+dnl  You should have received a copy of the GNU Lesser General Public License
+dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+
+include(`../config.m4')
+
+C            cycles/limb
+C z990           4.3
+
+C FIXME
+C  * Streamline feed-in code.
+
+C INPUT PARAMETERS
+define(`rp',	`%r2')


More information about the gmp-commit mailing list