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

mercurial at gmplib.org mercurial at gmplib.org
Sun Apr 22 21:03:07 CEST 2012


details:   /var/hg/gmp/rev/93c2ed5f26fe
changeset: 14879:93c2ed5f26fe
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Apr 22 20:46:16 2012 +0200
description:
*** empty log message ***

details:   /var/hg/gmp/rev/4717833d2b43
changeset: 14880:4717833d2b43
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Apr 22 21:03:03 2012 +0200
description:
New ARM files.

diffstat:

 ChangeLog               |    7 ++
 mpn/arm/README          |   18 +-----
 mpn/arm/bdiv_dbm1c.asm  |  101 ++++++++++++++++++++++++++++++++++++++++
 mpn/arm/v6/addmul_1.asm |  119 ++++++++++++++++++++++++++++++++++++++++++++++++
 mpn/arm/v6/mul_1.asm    |  108 +++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 339 insertions(+), 14 deletions(-)

diffs (truncated from 383 to 300 lines):

diff -r 7f5429959ef8 -r 4717833d2b43 ChangeLog
--- a/ChangeLog	Sun Apr 22 12:23:10 2012 +0200
+++ b/ChangeLog	Sun Apr 22 21:03:03 2012 +0200
@@ -1,3 +1,10 @@
+2012-04-22  Torbjorn Granlund  <tege at gmplib.org>
+
+	* mpn/arm/bdiv_dbm1c.asm: New file.
+
+	* mpn/arm/v6/mul_1.asm: New file.
+	* mpn/arm/v6/addmul_1.asm: New file.
+
 2012-04-22 Marco Bodrato <bodrato at mail.dm.unipi.it>
 
 	* gen-fac.c: Renamed, was gen-fac_ui.c .
diff -r 7f5429959ef8 -r 4717833d2b43 mpn/arm/README
--- a/mpn/arm/README	Sun Apr 22 12:23:10 2012 +0200
+++ b/mpn/arm/README	Sun Apr 22 21:03:03 2012 +0200
@@ -1,4 +1,4 @@
-Copyright 2002 Free Software Foundation, Inc.
+Copyright 2002, 2012 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -19,16 +19,6 @@
 
 
 
-This directory contains mpn functions for ARM processors.
-It has been optimized for StrongARM.
-
-TODO
-
-Write mpn_addmul_2.  The speed of mpn_addmul_1 is 9.75 c/l;
-mpn_addmul_2 could run at 8 c/l.  mpn_addmul_N could
-approach 6 c/l, but register shortage will make this hard.
-
-Perhaps nails is the way to go even for an embedded processor like
-this, since the umlal accumulation could be used very effectively in
-that case.  with just 2 nail bits, we should get close to 5 c/l for a
-mpn_addmul_N or mpn_mul_basecase.
+This directory contains mpn functions for ARM processors.  It has been
+optimised for Cortex-A9, but the code in the top-level directory should run
+on all ARM processors at architecture level v4 or later.
diff -r 7f5429959ef8 -r 4717833d2b43 mpn/arm/bdiv_dbm1c.asm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpn/arm/bdiv_dbm1c.asm	Sun Apr 22 21:03:03 2012 +0200
@@ -0,0 +1,101 @@
+dnl  ARM mpn_bdiv_dbm1c.
+
+dnl  Copyright 2008, 2011, 2012 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 StrongARM	 ?
+C XScale	 ?
+C Cortex-A8	 ?
+C Cortex-A9	 4.25
+C Cortex-A15	 ?
+
+C TODO
+C  * Try using umlal or umaal.
+C  * Try using ldm/stm.
+
+define(`qp',	  `r0')
+define(`up',	  `r1')
+define(`n',	  `r2')
+define(`bd',	  `r3')
+define(`cy',	  `sp,#0')
+
+ASM_START()
+	TEXT
+	ALIGN(16)
+PROLOGUE(mpn_bdiv_dbm1c)
+	push	{r4, r5, r6, r7, r8, r9}
+	ldr	r4, [up], #4
+	ldr	r5, [sp, #24]
+	ands	r9, n, #3
+	beq	L(fi0)
+	cmp	r9, #2
+	bcc	L(fi1)
+	beq	L(fi2)
+
+L(fi3):	umull	r8, r9, r4, bd
+	ldr	r4, [up], #4
+	b	L(lo3)
+
+L(fi0):	umull	r6, r7, r4, bd
+	ldr	r4, [up], #4
+	b	L(lo0)
+
+L(fi1):	subs	n, n, #1
+	umull	r8, r9, r4, bd
+	bls	L(wd1)
+	ldr	r4, [up], #4
+	b	L(lo1)
+
+L(fi2):	umull	r6, r7, r4, bd
+	ldr	r4, [up], #4
+	b	L(lo2)
+
+L(top):	ldr	r4, [up], #4
+	subs	r5, r5, r6
+	str	r5, [qp], #4
+	sbc	r5, r5, r7
+L(lo1):	umull	r6, r7, r4, bd
+	ldr	r4, [up], #4
+	subs	r5, r5, r8
+	str	r5, [qp], #4
+	sbc	r5, r5, r9
+L(lo0):	umull	r8, r9, r4, bd
+	ldr	r4, [up], #4
+	subs	r5, r5, r6
+	str	r5, [qp], #4
+	sbc	r5, r5, r7
+L(lo3):	umull	r6, r7, r4, bd
+	ldr	r4, [up], #4
+	subs	r5, r5, r8
+	str	r5, [qp], #4
+	sbc	r5, r5, r9
+L(lo2):	subs	n, n, #4
+	umull	r8, r9, r4, bd
+	bhi	L(top)
+
+L(wd2):	subs	r5, r5, r6
+	str	r5, [qp], #4
+	sbc	r5, r5, r7
+L(wd1):	subs	r5, r5, r8
+	str	r5, [qp]
+	sbc	r0, r5, r9
+	pop	{r4, r5, r6, r7, r8, r9}
+	bx	lr
+EPILOGUE()
diff -r 7f5429959ef8 -r 4717833d2b43 mpn/arm/v6/addmul_1.asm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpn/arm/v6/addmul_1.asm	Sun Apr 22 21:03:03 2012 +0200
@@ -0,0 +1,119 @@
+dnl  ARM mpn_addmul_1.
+
+dnl  Copyright 2012 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 StrongARM:	 -
+C XScale	 -
+C Cortex-A8	 ?
+C Cortex-A9	 3.25
+C Cortex-A15	 ?
+
+C TODO
+C  * Micro-optimise feed-in code.
+C  * Optimise for n=1,2 by delaying register saving.
+C  * Try using ldm/stm.
+
+define(`rp',`r0')
+define(`up',`r1')
+define(`n', `r2')
+define(`v0',`r3')
+
+ASM_START()
+PROLOGUE(mpn_addmul_1)
+	stmfd	sp!, { r4, r5, r6, r7, r8 }
+
+	ands	r12, n, #3
+	beq	L(fi0)
+	cmp	r12, #2
+	bcc	L(fi1)
+	beq	L(fi2)
+
+L(fi3):	ldr	r4, [up], #4
+	ldr	r12, [rp, #0]
+	ldr	r5, [up], #4
+	ldr	r6, [rp, #4]
+	mov	r8, #0
+	umaal	r8, r12, r4, v0
+	b	L(lo3)
+
+L(fi0):	ldr	r5, [up], #4
+	ldr	r8, [rp, #0]
+	ldr	r4, [up], #4
+	ldr	r12, [rp, #4]
+	mov	r7, #0
+	umaal	r7, r8, r5, v0
+	add	rp, rp, #4
+	b	L(lo0)
+
+L(fi1):	ldr	r4, [up], #4
+	ldr	r7, [rp, #0]
+	subs	n, n, #1
+	mov	r6, #0
+	beq	L(1)
+	ldr	r5, [up], #4
+	ldr	r8, [rp, #4]
+	umaal	r6, r7, r4, v0
+	add	rp, rp, #8
+	b	L(lo1)
+
+L(fi2):	ldr	r5, [up], #4
+	ldr	r6, [rp, #0]
+	ldr	r4, [up], #4
+	ldr	r7, [rp, #4]
+	mov	r12, #0
+	umaal	r12, r6, r5, v0
+	subs	n, n, #2
+	add	rp, rp, #12
+	beq	L(end)
+
+	ALIGN(16)
+L(top):	ldr	r5, [up], #4
+	ldr	r8, [rp, #-4]
+	umaal	r6, r7, r4, v0
+	str	r12, [rp, #-12]
+L(lo1):	ldr	r4, [up], #4
+	ldr	r12, [rp, #0]
+	umaal	r7, r8, r5, v0
+	str	r6, [rp, #-8]
+L(lo0):	ldr	r5, [up], #4
+	ldr	r6, [rp, #4]
+	umaal	r8, r12, r4, v0
+	str	r7, [rp, #-4]
+L(lo3):	ldr	r4, [up], #4
+	ldr	r7, [rp, #8]
+	umaal	r12, r6, r5, v0
+	str	r8, [rp], #16
+	subs	n, n, #4
+	bhi	L(top)
+
+L(end):	umaal	r6, r7, r4, v0
+	str	r12, [rp, #-12]
+	str	r6, [rp, #-8]
+	mov	r0, r7
+	ldmfd	sp!, { r4, r5, r6, r7, r8 }
+	bx	lr
+
+L(1):	umaal	r6, r7, r4, v0
+	str	r6, [rp, #0]
+	mov	r0, r7
+	ldmfd	sp!, { r4, r5, r6, r7, r8 }
+	bx	lr
+EPILOGUE()
diff -r 7f5429959ef8 -r 4717833d2b43 mpn/arm/v6/mul_1.asm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpn/arm/v6/mul_1.asm	Sun Apr 22 21:03:03 2012 +0200
@@ -0,0 +1,108 @@
+dnl  ARM mpn_mul_1.
+
+dnl  Copyright 2012 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 StrongARM:	 -
+C XScale	 -
+C Cortex-A8	 ?


More information about the gmp-commit mailing list