1 dnl ARM v6t2 mpn_divrem_1
and mpn_preinv_divrem_1.
3 dnl Contributed to the GNU project by Torbjörn Granlund.
5 dnl Copyright
2012 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
')
41 C Cortex-A15 11.4 11.8 11.1
44 C * Optimise inner-loops better, they could likely run a cycle or two faster.
45 C * Decrease register usage, streamline non-loop code.
47 define(`qp_arg', `r0
')
49 define(`up_arg', `r2
')
52 define(`dinv_arg',`
4')
53 define(`cnt_arg', `
8')
64 PROLOGUE(mpn_preinv_divrem_1)
65 stmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr}
66 ldr d, [sp, #9*4+d_arg]
67 ldr cnt, [sp, #9*4+cnt_arg]
68 str r1, [sp, #9*4+d_arg] C reuse d stack slot for fn
72 add qp, qp_arg, r3, lsl #2 C put qp at Q[] end
73 add up, up_arg, n, lsl #2 C put up at U[] end
74 ldr dinv, [sp, #9*4+dinv_arg]
79 PROLOGUE(mpn_divrem_1)
80 stmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr}
82 ldr d, [sp, #9*4+d_arg] C d
83 str r1, [sp, #9*4+d_arg] C reuse d stack slot for fn
86 add qp, qp_arg, r3, lsl #2 C put qp at Q[] end
87 add up, up_arg, n, lsl #2 C put up at U[] end
92 mov r0, d, lsl cnt C pass d << cnt
95 mov d, d, lsl cnt C d <<= cnt
104 mov r11, r11, lsl cnt
108 orr r2, r11, r3, lsr tnc
118 orr r2, r11, r3, lsr tnc
121 L(uok): str r8, [qp], #-4
122 L(mid): add r8, r1, #1
124 umlal r2, r8, r1, dinv
138 L(uend):add r8, r1, #1
140 umlal r2, r8, r1, dinv
150 ldr r2, [sp, #9*4+d_arg] C fn
156 umlal r6, r3, r1, dinv
166 L(fend):mov r11, r1, lsr cnt
168 ldmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, pc}
180 movlo r2, #0 C hi q limb
181 movhs r2, #1 C hi q limb
188 L(ntop):ldr r1, [up, #-4]!
190 umlal r1, r12, r11, dinv
198 L(nok): str r12, [qp], #-4
202 L(nend):mov r1, r11 C r
203 mov cnt, #0 C shift cnt
206 L(nfx): add r12, r12, #1
209 L(ufx): rsb r1, d, r1