Annotation of OpenXM_contrib/gmp/mpn/arm/add_n.asm, Revision 1.1.1.1
1.1 ohara 1: dnl ARM mpn_add_n -- Add two limb vectors of the same length > 0 and store sum
2: dnl in a third limb vector.
3: dnl Contributed by Robert Harley.
4:
5: dnl Copyright 1997, 2000, 2001 Free Software Foundation, Inc.
6:
7: dnl This file is part of the GNU MP Library.
8:
9: dnl The GNU MP Library is free software; you can redistribute it and/or modify
10: dnl it under the terms of the GNU Lesser General Public License as published
11: dnl by the Free Software Foundation; either version 2.1 of the License, or (at
12: dnl your option) any later version.
13:
14: dnl The GNU MP Library is distributed in the hope that it will be useful, but
15: dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16: dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17: dnl License for more details.
18:
19: dnl You should have received a copy of the GNU Lesser General Public License
20: dnl along with the GNU MP Library; see the file COPYING.LIB. If not, write to
21: dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22: dnl MA 02111-1307, USA.
23:
24: include(`../config.m4')
25:
26: C This code runs at 5 cycles/limb.
27:
28: define(`rp',`r0')
29: define(`up',`r1')
30: define(`vp',`r2')
31: define(`n',`r3')
32:
33:
34: ASM_START()
35: PROLOGUE(mpn_add_n)
36: stmfd sp!, { r8, r9, lr }
37: movs n, n, lsr #1
38: bcc L(skip1)
39: ldr r12, [up], #4
40: ldr lr, [vp], #4
41: adds r12, r12, lr
42: str r12, [rp], #4
43: L(skip1):
44: tst n, #1
45: beq L(skip2)
46: ldmia up!, { r8, r9 }
47: ldmia vp!, { r12, lr }
48: adcs r8, r8, r12
49: adcs r9, r9, lr
50: stmia rp!, { r8, r9 }
51: L(skip2):
52: bics n, n, #1
53: beq L(return)
54: stmfd sp!, { r4, r5, r6, r7 }
55: L(add_n_loop):
56: ldmia up!, { r4, r5, r6, r7 }
57: ldmia vp!, { r8, r9, r12, lr }
58: adcs r4, r4, r8
59: ldr r8, [rp, #12] C cache allocate
60: adcs r5, r5, r9
61: adcs r6, r6, r12
62: adcs r7, r7, lr
63: stmia rp!, { r4, r5, r6, r7 }
64: sub n, n, #2
65: teq n, #0
66: bne L(add_n_loop)
67: ldmfd sp!, { r4, r5, r6, r7 }
68: L(return):
69: adc r0, n, #0
70: ldmfd sp!, { r8, r9, pc }
71: EPILOGUE(mpn_add_n)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>