beta-0.89.2
[luatex.git] / source / libs / gmp / gmp-src / mpn / arm / v6 / addmul_1.asm
bloba38af58a7df9c60e46783f5e0f9b3bb8e10d4d53
1 dnl ARM mpn_addmul_1.
3 dnl Copyright 2012 Free Software Foundation, Inc.
5 dnl This file is part of the GNU MP Library.
6 dnl
7 dnl The GNU MP Library is free software; you can redistribute it and/or modify
8 dnl it under the terms of either:
9 dnl
10 dnl * the GNU Lesser General Public License as published by the Free
11 dnl Software Foundation; either version 3 of the License, or (at your
12 dnl option) any later version.
13 dnl
14 dnl or
15 dnl
16 dnl * the GNU General Public License as published by the Free Software
17 dnl Foundation; either version 2 of the License, or (at your option) any
18 dnl later version.
19 dnl
20 dnl or both in parallel, as here.
21 dnl
22 dnl The GNU MP Library is distributed in the hope that it will be useful, but
23 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 dnl for more details.
26 dnl
27 dnl You should have received copies of the GNU General Public License and the
28 dnl GNU Lesser General Public License along with the GNU MP Library. If not,
29 dnl see https://www.gnu.org/licenses/.
31 include(`../config.m4')
33 C cycles/limb
34 C StrongARM: -
35 C XScale -
36 C ARM11 6.4
37 C Cortex-A7 5.25
38 C Cortex-A8 7
39 C Cortex-A9 3.25
40 C Cortex-A15 4
42 C TODO
43 C * Micro-optimise feed-in code.
44 C * Optimise for n=1,2 by delaying register saving.
45 C * Try using ldm/stm.
47 define(`rp',`r0')
48 define(`up',`r1')
49 define(`n', `r2')
50 define(`v0',`r3')
52 ASM_START()
53 PROLOGUE(mpn_addmul_1)
54 stmfd sp!, { r4, r5, r6, r7 }
56 ands r6, n, #3
57 mov r12, #0
58 beq L(fi0)
59 cmp r6, #2
60 bcc L(fi1)
61 beq L(fi2)
63 L(fi3): ldr r4, [up], #4
64 ldr r6, [rp, #0]
65 ldr r5, [up], #4
66 b L(lo3)
68 L(fi0): ldr r5, [up], #4
69 ldr r7, [rp], #4
70 ldr r4, [up], #4
71 b L(lo0)
73 L(fi1): ldr r4, [up], #4
74 ldr r6, [rp], #8
75 subs n, n, #1
76 beq L(1)
77 ldr r5, [up], #4
78 b L(lo1)
80 L(fi2): ldr r5, [up], #4
81 ldr r7, [rp], #12
82 ldr r4, [up], #4
83 b L(lo2)
85 ALIGN(16)
86 L(top): ldr r6, [rp, #-8]
87 ldr r5, [up], #4
88 str r7, [rp, #-12]
89 L(lo1): umaal r6, r12, r4, v0
90 ldr r7, [rp, #-4]
91 ldr r4, [up], #4
92 str r6, [rp, #-8]
93 L(lo0): umaal r7, r12, r5, v0
94 ldr r6, [rp, #0]
95 ldr r5, [up], #4
96 str r7, [rp, #-4]
97 L(lo3): umaal r6, r12, r4, v0
98 ldr r7, [rp, #4]
99 ldr r4, [up], #4
100 str r6, [rp], #16
101 L(lo2): umaal r7, r12, r5, v0
102 subs n, n, #4
103 bhi L(top)
105 ldr r6, [rp, #-8]
106 str r7, [rp, #-12]
107 L(1): umaal r6, r12, r4, v0
108 str r6, [rp, #-8]
109 mov r0, r12
110 ldmfd sp!, { r4, r5, r6, r7 }
111 bx lr
112 EPILOGUE()