[Gmp-commit] /var/hg/gmp: ARM changes.
mercurial at gmplib.org
mercurial at gmplib.org
Sat Apr 21 21:09:06 CEST 2012
details: /var/hg/gmp/rev/2347fd4901ad
changeset: 14876:2347fd4901ad
user: Torbjorn Granlund <tege at gmplib.org>
date: Sat Apr 21 21:09:01 2012 +0200
description:
ARM changes.
diffstat:
ChangeLog | 18 +++++++
mpn/arm/add_n.asm | 69 ----------------------------
mpn/arm/addmul_1.asm | 107 -------------------------------------------
mpn/arm/aors_n.asm | 100 ++++++++++++++++++++++++++++++++++++++++
mpn/arm/aorsmul_1.asm | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++
mpn/arm/com.asm | 63 +++++++++++++++++++++++++
mpn/arm/copyd.asm | 31 ++++++-----
mpn/arm/copyi.asm | 31 ++++++-----
mpn/arm/lshift.asm | 76 ++++++++++++++++++++++++++++++
mpn/arm/mul_1.asm | 24 +++++----
mpn/arm/rshift.asm | 74 ++++++++++++++++++++++++++++++
mpn/arm/sub_n.asm | 71 ----------------------------
mpn/arm/submul_1.asm | 107 -------------------------------------------
mpn/arm/udiv.asm | 2 +-
14 files changed, 503 insertions(+), 393 deletions(-)
diffs (truncated from 1023 to 300 lines):
diff -r 41150d18e236 -r 2347fd4901ad ChangeLog
--- a/ChangeLog Fri Apr 20 22:24:38 2012 +0200
+++ b/ChangeLog Sat Apr 21 21:09:01 2012 +0200
@@ -1,3 +1,21 @@
+2012-04-21 Torbjorn Granlund <tege at gmplib.org>
+
+ * mpn/arm/mul_1.asm: Cleanup.
+ * mpn/arm/copyi.asm: Cleanup, assume allocate-on-write cache.
+ * mpn/arm/copyd.asm: Likewise.
+
+ * mpn/arm/add_n.asm: Delete.
+ * mpn/arm/sub_n.asm: Delete.
+ * mpn/arm/aors_n.asm: New file, made from old files.
+
+ * mpn/arm/addmul_1.asm: Delete.
+ * mpn/arm/submul_1.asm: Delete.
+ * mpn/arm/aorsmul_1.asm: New file, made from old files.
+
+ * mpn/arm/com.asm: New file.
+ * mpn/arm/lshift.asm: New file.
+ * mpn/arm/rshift.asm: New file.
+
2012-04-20 Torbjorn Granlund <tege at gmplib.org>
* tests/mpq/io.c: New file.
diff -r 41150d18e236 -r 2347fd4901ad mpn/arm/add_n.asm
--- a/mpn/arm/add_n.asm Fri Apr 20 22:24:38 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-dnl ARM mpn_add_n -- Add two limb vectors of the same length > 0 and store sum
-dnl in a third limb vector.
-dnl Contributed by Robert Harley.
-
-dnl Copyright 1997, 2000, 2001 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 This code runs at 5 cycles/limb.
-
-define(`rp',`r0')
-define(`up',`r1')
-define(`vp',`r2')
-define(`n',`r3')
-
-
-ASM_START()
-PROLOGUE(mpn_add_n)
- stmfd sp!, { r8, r9, lr }
- movs n, n, lsr #1
- bcc L(skip1)
- ldr r12, [up], #4
- ldr lr, [vp], #4
- adds r12, r12, lr
- str r12, [rp], #4
-L(skip1):
- tst n, #1
- beq L(skip2)
- ldmia up!, { r8, r9 }
- ldmia vp!, { r12, lr }
- adcs r8, r8, r12
- adcs r9, r9, lr
- stmia rp!, { r8, r9 }
-L(skip2):
- bics n, n, #1
- beq L(return)
- stmfd sp!, { r4, r5, r6, r7 }
-L(add_n_loop):
- ldmia up!, { r4, r5, r6, r7 }
- ldmia vp!, { r8, r9, r12, lr }
- adcs r4, r4, r8
- ldr r8, [rp, #12] C cache allocate
- adcs r5, r5, r9
- adcs r6, r6, r12
- adcs r7, r7, lr
- stmia rp!, { r4, r5, r6, r7 }
- sub n, n, #2
- teq n, #0
- bne L(add_n_loop)
- ldmfd sp!, { r4, r5, r6, r7 }
-L(return):
- adc r0, n, #0
- ldmfd sp!, { r8, r9, pc }
-EPILOGUE(mpn_add_n)
diff -r 41150d18e236 -r 2347fd4901ad mpn/arm/addmul_1.asm
--- a/mpn/arm/addmul_1.asm Fri Apr 20 22:24:38 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-dnl ARM mpn_addmul_1 -- Multiply a limb vector with a limb and add the result
-dnl to a second limb vector.
-
-dnl Copyright 1998, 2000, 2001, 2003 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: 7.75-9.75 (dependent on vl value)
-C XScale: 8-9 (dependent on vl value, estimated)
-
-define(`rp',`r0')
-define(`up',`r1')
-define(`n',`r2')
-define(`vl',`r3')
-define(`rl',`r12')
-define(`ul',`r6')
-define(`r',`lr')
-
-
-ASM_START()
-PROLOGUE(mpn_addmul_1)
- stmfd sp!, { r4-r6, lr }
- mov r4, #0 C clear r4
- adds r0, r0, #0 C clear cy
- tst n, #1
- beq L(skip1)
- ldr ul, [up], #4
- ldr rl, [rp, #0]
- umull r5, r4, ul, vl
- adds r, rl, r5
- str r, [rp], #4
-L(skip1):
- tst n, #2
- beq L(skip2)
- ldr ul, [up], #4
- ldr rl, [rp, #0]
- mov r5, #0
- umlal r4, r5, ul, vl
- ldr ul, [up], #4
- adcs r, rl, r4
- ldr rl, [rp, #4]
- mov r4, #0
- umlal r5, r4, ul, vl
- str r, [rp], #4
- adcs r, rl, r5
- str r, [rp], #4
-L(skip2):
- bics r, n, #3
- beq L(return)
-
- ldr ul, [up], #4
- ldr rl, [rp, #0]
- mov r5, #0
- umlal r4, r5, ul, vl
- b L(in)
-
-L(loop):
- ldr ul, [up], #4
- adcs r, rl, r5
- ldr rl, [rp, #4]
- mov r5, #0
- umlal r4, r5, ul, vl
- str r, [rp], #4
-L(in): ldr ul, [up], #4
- adcs r, rl, r4
- ldr rl, [rp, #4]
- mov r4, #0
- umlal r5, r4, ul, vl
- str r, [rp], #4
- ldr ul, [up], #4
- adcs r, rl, r5
- ldr rl, [rp, #4]
- mov r5, #0
- umlal r4, r5, ul, vl
- str r, [rp], #4
- ldr ul, [up], #4
- adcs r, rl, r4
- ldr rl, [rp, #4]
- mov r4, #0
- umlal r5, r4, ul, vl
- str r, [rp], #4
- sub n, n, #4
- bics r, n, #3
- bne L(loop)
-
- adcs r, rl, r5
- str r, [rp], #4
-L(return):
- adc r0, r4, #0
- ldmfd sp!, { r4-r6, pc }
-EPILOGUE(mpn_addmul_1)
diff -r 41150d18e236 -r 2347fd4901ad mpn/arm/aors_n.asm
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mpn/arm/aors_n.asm Sat Apr 21 21:09:01 2012 +0200
@@ -0,0 +1,100 @@
+dnl ARM mpn_add_n and mpn_sub_n
+
+dnl Contributed to the GNU project by Robert Harley.
+
+dnl Copyright 1997, 2000, 2001, 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 2.75
+C Cortex-A15 ?
+
+define(`rp', `r0')
+define(`up', `r1')
+define(`vp', `r2')
+define(`n', `r3')
+
+ifdef(`OPERATION_add_n', `
+ define(`ADDSUB', adds)
+ define(`ADDSUBC', adcs)
+ define(`CLRCY', `cmn r0, #0')
+ define(`SETCY', `cmp $1, #1')
+ define(`RETVAL', `adc r0, n, #0')
+ define(`func', mpn_add_n)
+ define(`func_nc', mpn_add_nc)')
+ifdef(`OPERATION_sub_n', `
+ define(`ADDSUB', subs)
+ define(`ADDSUBC', sbcs)
+ define(`CLRCY', `cmp r0, r0')
+ define(`SETCY', `rsbs $1, $1, #0')
+ define(`RETVAL', `sbc r0, r0, r0
+ and r0, r0, #1')
+ define(`func', mpn_sub_n)
+ define(`func_nc', mpn_sub_nc)')
+
+MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc)
+
+ASM_START()
+PROLOGUE(func_nc)
+ ldr r12, [sp, #0]
+ stmfd sp!, { r8, r9, lr }
+ SETCY( r12)
+ b L(ent)
+EPILOGUE()
+PROLOGUE(func)
+ stmfd sp!, { r8, r9, lr }
+ CLRCY( r12)
+L(ent): tst n, #1
+ beq L(skip1)
+ ldr r12, [up], #4
+ ldr lr, [vp], #4
+ ADDSUBC r12, r12, lr
+ str r12, [rp], #4
+L(skip1):
+ tst n, #2
+ beq L(skip2)
+ ldmia up!, { r8, r9 }
+ ldmia vp!, { r12, lr }
+ ADDSUBC r8, r8, r12
+ ADDSUBC r9, r9, lr
+ stmia rp!, { r8, r9 }
+L(skip2):
+ bics n, n, #3
+ beq L(rtn)
+ stmfd sp!, { r4, r5, r6, r7 }
+
+L(top): ldmia up!, { r4, r5, r6, r7 }
+ ldmia vp!, { r8, r9, r12, lr }
+ ADDSUBC r4, r4, r8
More information about the gmp-commit
mailing list