beta-0.89.2
[luatex.git] / source / libs / gmp / gmp-src / mpn / arm / v6 / addmul_2.asm
blob33eeeec87bb57bcbaeff86c5f819b3451658048a
1 dnl ARM mpn_addmul_2.
3 dnl Contributed to the GNU project by Torbjörn Granlund.
5 dnl Copyright 2012, 2013, 2015 Free Software Foundation, Inc.
7 dnl This file is part of the GNU MP Library.
8 dnl
9 dnl The GNU MP Library is free software; you can redistribute it and/or modify
10 dnl it under the terms of either:
11 dnl
12 dnl * the GNU Lesser General Public License as published by the Free
13 dnl Software Foundation; either version 3 of the License, or (at your
14 dnl option) any later version.
15 dnl
16 dnl or
17 dnl
18 dnl * the GNU General Public License as published by the Free Software
19 dnl Foundation; either version 2 of the License, or (at your option) any
20 dnl later version.
21 dnl
22 dnl or both in parallel, as here.
23 dnl
24 dnl The GNU MP Library is distributed in the hope that it will be useful, but
25 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
26 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 dnl for more details.
28 dnl
29 dnl You should have received copies of the GNU General Public License and the
30 dnl GNU Lesser General Public License along with the GNU MP Library. If not,
31 dnl see https://www.gnu.org/licenses/.
33 include(`../config.m4')
35 C cycles/limb
36 C StrongARM: -
37 C XScale -
38 C ARM11 4.68
39 C Cortex-A7 3.625
40 C Cortex-A8 4
41 C Cortex-A9 2.25
42 C Cortex-A15 2.5
44 define(`rp',`r0')
45 define(`up',`r1')
46 define(`n', `r2')
47 define(`vp',`r3')
49 define(`v0',`r6')
50 define(`v1',`r7')
51 define(`u0',`r3')
52 define(`u1',`r9')
54 define(`cya',`r8')
55 define(`cyb',`r12')
58 ASM_START()
59 PROLOGUE(mpn_addmul_2)
60 push { r4-r9 }
62 ldrd v0, v1, [vp, #0]
63 mov cya, #0
64 mov cyb, #0
66 tst n, #1
67 beq L(evn)
69 L(odd): ldr u1, [up, #0]
70 ldr r4, [rp, #0]
71 tst n, #2
72 beq L(fi1)
73 L(fi3): sub up, up, #8
74 sub rp, rp, #8
75 b L(lo3)
76 L(fi1): sub n, n, #1
77 b L(top)
79 L(evn): ldr u0, [up, #0]
80 ldr r5, [rp, #0]
81 tst n, #2
82 bne L(fi2)
83 L(fi0): sub up, up, #4
84 sub rp, rp, #4
85 b L(lo0)
86 L(fi2): sub up, up, #12
87 sub rp, rp, #12
88 b L(lo2)
90 ALIGN(16)
91 L(top): ldr r5, [rp, #4]
92 umaal r4, cya, u1, v0
93 ldr u0, [up, #4]
94 umaal r5, cyb, u1, v1
95 str r4, [rp, #0]
96 L(lo0): ldr r4, [rp, #8]
97 umaal r5, cya, u0, v0
98 ldr u1, [up, #8]
99 umaal r4, cyb, u0, v1
100 str r5, [rp, #4]
101 L(lo3): ldr r5, [rp, #12]
102 umaal r4, cya, u1, v0
103 ldr u0, [up, #12]
104 umaal r5, cyb, u1, v1
105 str r4, [rp, #8]
106 L(lo2): ldr r4, [rp, #16]!
107 umaal r5, cya, u0, v0
108 ldr u1, [up, #16]!
109 umaal r4, cyb, u0, v1
110 str r5, [rp, #-4]
111 subs n, n, #4
112 bhi L(top)
114 L(end): umaal r4, cya, u1, v0
115 umaal cya, cyb, u1, v1
116 str r4, [rp, #0]
117 str cya, [rp, #4]
118 mov r0, cyb
120 pop { r4-r9 }
121 bx r14
122 EPILOGUE()