1 dnl ARM v6t2 mpn_gcd_1.
3 dnl Based on the K7 gcd_1.asm
, by Kevin Ryde. Rehacked for ARM by Torbjörn
6 dnl Copyright
2000-2002, 2005, 2009, 2011, 2012 Free Software Foundation
, Inc.
8 dnl
This file is part of the GNU MP Library.
10 dnl The GNU MP Library is free software
; you can redistribute it and/or modify
11 dnl it under the terms of
either:
13 dnl
* the GNU Lesser General
Public License as published by the Free
14 dnl Software Foundation
; either version 3 of the License, or (at your
15 dnl option
) any later version.
19 dnl
* the GNU General
Public License as published by the Free Software
20 dnl Foundation
; either version 2 of the License, or (at your option) any
23 dnl
or both
in parallel
, as here.
25 dnl The GNU MP Library is distributed
in the hope that it will be useful
, but
26 dnl WITHOUT ANY WARRANTY
; without even the implied warranty of MERCHANTABILITY
27 dnl
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License
30 dnl You should have received copies of the GNU General
Public License
and the
31 dnl GNU Lesser General
Public License along with the GNU MP Library. If
not,
32 dnl see
https://www.gnu.
org/licenses
/.
34 include(`..
/config.m4
')
43 C Numbers measured with: speed -CD -s8-32 -t24 mpn_gcd_1
46 C * Optimise inner-loop better.
47 C * Push saving/restoring of callee-user regs into call code
49 C Threshold of when to call bmod when U is one limb. Should be about
50 C (time_in_cycles(bmod_1,1) + call_overhead) / (cycles/bit).
51 define(`BMOD_THRES_LOG2', 7)
58 ifdef
(`BMOD_1_TO_MOD_1_THRESHOLD
',,
59 `define(`BMOD_1_TO_MOD_1_THRESHOLD',0xffffffff)')
66 ldr r3, [up] C U low limb
70 clz r4, r4 C min(ctz(u0),ctz(v0))
81 C Both U and V are single limbs, reduce with bmod if u0 >> v0.
83 cmp v0, r3, lsr #BMOD_THRES_LOG2
86 L(bmod):mov r3, #0 C carry argument
87 bl mpn_modexact_1c_odd
90 L(nby1):cmp n, #BMOD_1_TO_MOD_1_THRESHOLD
103 L(top): movcs r3, r1 C if x-y < 0
104 movcs r7, r0 C use x,y-x
105 L(mid): mov r3, r3, lsr r12 C
113 L(end): mov r0, r7, lsl r4