3 dnl Contributed to the GNU project by Torbjörn Granlund.
5 dnl Copyright
2013 Free Software Foundation
, Inc.
7 dnl
This file is part of the GNU MP Library.
9 dnl The GNU MP Library is free software
; you can redistribute it and/or modify
10 dnl it under the terms of
either:
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.
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
22 dnl
or both
in parallel
, as here.
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
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
')
45 C * Use a fast path for n <= KARATSUBA_MUL_THRESHOLD using a jump table,
46 C avoiding the current multiply.
47 C * Start the first multiply or multiplies early.
54 define(`v0',`r4
') define(`v1',`r5
') define(`v2',`r6
')
55 define(`u0',`r3
') define(`u1',`r14
')
56 define(`w0',`r7
') define(`w1',`r8
') define(`w2',`r9
')
57 define(`cy0',`r10
') define(`cy1',`r11
') define(`cy2',`r12
')
61 PROLOGUE(mpn_addmul_3)
64 ldr w0, =0xaaaaaaab C 3^{-1} mod 2^32
71 mul w0, w0, n C n * 3^{-1} mod 2^32
72 and w0, w0, #0xc0000001 C pseudo-CRT mod 3,2
75 add pc
, pc
, w0
, ror $28
80 .
word 0xe7f000f0 C udf
85 ldr pc, [pc, w0, ror $28]
87 .word L(b0), L(b2), L(b4), 0, L(b3), L(b5), L(b1)
90 L
(b5
): add up
, up
, #
-8
96 L
(b4
): add rp
, rp
, #
-4
103 L
(b3
): add rp
, rp
, #
-8
110 L
(b1
): add rp
, rp
, #
8
116 L
(b0
): add rp
, rp
, #
4
123 L
(b2
): add rp
, rp
, #
12
130 L
(top
): ldr w0
, [rp
, #
-4]
131 umaal w1
, cy0
, u0
, v0
133 umaal w2
, cy1
, u0
, v1
135 umaal w0
, cy2
, u0
, v2
136 L
(lo1
): ldr w1
, [rp
, #
0]
137 umaal w2
, cy0
, u1
, v0
139 umaal w0
, cy1
, u1
, v1
141 umaal w1
, cy2
, u1
, v2
142 L
(lo0
): ldr w2
, [rp
, #
4]
143 umaal w0
, cy0
, u0
, v0
145 umaal w1
, cy1
, u0
, v1
147 umaal w2
, cy2
, u0
, v2
148 L
(lo5
): ldr w0
, [rp
, #
8]
149 umaal w1
, cy0
, u1
, v0
151 umaal w2
, cy1
, u1
, v1
153 umaal w0
, cy2
, u1
, v2
154 L
(lo4
): ldr w1
, [rp
, #
12]
155 umaal w2
, cy0
, u0
, v0
157 umaal w0
, cy1
, u0
, v1
159 umaal w1
, cy2
, u0
, v2
160 L
(lo3
): ldr w2
, [rp
, #
16]
161 umaal w0
, cy0
, u1
, v0
163 umaal w1
, cy1
, u1
, v1
165 umaal w2
, cy2
, u1
, v2
166 L
(lo2
): subs n
, n
, #
6
171 L
(end): umaal w1
, cy0
, u0
, v0
173 umaal w2
, cy1
, u0
, v1
176 umaal w0
, cy2
, u0
, v2
177 umaal w2
, cy0
, u1
, v0
178 umaal w0
, cy1
, u1
, v1
180 umaal cy1
, cy2
, u1
, v2