1 dnl ARM mpn_mod_34lsub1
-- remainder modulo
2^
24-1.
3 dnl Copyright
2012, 2013 Free Software Foundation
, Inc.
5 dnl
This file is part of the GNU MP Library.
7 dnl The GNU MP Library is free software
; you can redistribute it and/or modify
8 dnl it under the terms of
either:
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.
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
20 dnl
or both
in parallel
, as here.
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
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
')
44 C mp_limb_t mpn_mod_34lsub1 (mp_srcptr up, mp_size_t n)
47 C * Write cleverer summation code.
48 C * Consider loading 6 64-bit aligned registers at a time, to approach 1 c/l.
53 PROLOGUE(mpn_mod_34lsub1)
54 push { r4, r5, r6, r7 }
60 ldmia ap!, { r2, r3, r12 }
63 cmn r0, #0 C clear carry
67 L(top): adcs r2, r2, r4
70 L(mid): ldmia ap!, { r4, r5, r6 }
80 movcs r7, #1 C r7 <= 1
91 adc r7, r7, #0 C r7 <= 2
94 bic r0, r2, #0xff000000
95 add r0, r0, r2, lsr #24
99 bic r1, r7, #0xff000000
101 add r0, r0, r3, lsr #16
104 bic r1, r7, #0xff000000
106 add r0, r0, r12, lsr #8
108 pop { r4, r5, r6, r7 }
113 ldmia ap!, { r2, r3 }
117 bic r0, r2, #0xff000000
118 add r0, r0, r2, lsr #24
119 pop { r4, r5, r6, r7 }