beta-0.89.2
[luatex.git] / source / libs / gmp / gmp-src / mpn / arm / bdiv_dbm1c.asm
blobec3de50e8e2170d61cade58f2071af66f37d5e05
1 dnl ARM mpn_bdiv_dbm1c.
3 dnl Copyright 2008, 2011, 2012 Free Software Foundation, Inc.
5 dnl This file is part of the GNU MP Library.
6 dnl
7 dnl The GNU MP Library is free software; you can redistribute it and/or modify
8 dnl it under the terms of either:
9 dnl
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.
13 dnl
14 dnl or
15 dnl
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
18 dnl later version.
19 dnl
20 dnl or both in parallel, as here.
21 dnl
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
25 dnl for more details.
26 dnl
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')
33 C cycles/limb
34 C StrongARM ?
35 C XScale ?
36 C Cortex-A7 ?
37 C Cortex-A8 ?
38 C Cortex-A9 4.25
39 C Cortex-A15 2.5
41 C TODO
42 C * Try using umlal or umaal.
43 C * Try using ldm/stm.
45 define(`qp', `r0')
46 define(`up', `r1')
47 define(`n', `r2')
48 define(`bd', `r3')
49 define(`cy', `sp,#0')
51 ASM_START()
52 TEXT
53 ALIGN(16)
54 PROLOGUE(mpn_bdiv_dbm1c)
55 push {r4, r5, r6, r7, r8}
56 ldr r4, [up], #4
57 ldr r5, [sp, #20]
58 ands r12, n, #3
59 beq L(fi0)
60 cmp r12, #2
61 bcc L(fi1)
62 beq L(fi2)
64 L(fi3): umull r8, r12, r4, bd
65 ldr r4, [up], #4
66 b L(lo3)
68 L(fi0): umull r6, r7, r4, bd
69 ldr r4, [up], #4
70 b L(lo0)
72 L(fi1): subs n, n, #1
73 umull r8, r12, r4, bd
74 bls L(wd1)
75 ldr r4, [up], #4
76 b L(lo1)
78 L(fi2): umull r6, r7, r4, bd
79 ldr r4, [up], #4
80 b L(lo2)
82 L(top): ldr r4, [up], #4
83 subs r5, r5, r6
84 str r5, [qp], #4
85 sbc r5, r5, r7
86 L(lo1): umull r6, r7, r4, bd
87 ldr r4, [up], #4
88 subs r5, r5, r8
89 str r5, [qp], #4
90 sbc r5, r5, r12
91 L(lo0): umull r8, r12, r4, bd
92 ldr r4, [up], #4
93 subs r5, r5, r6
94 str r5, [qp], #4
95 sbc r5, r5, r7
96 L(lo3): umull r6, r7, r4, bd
97 ldr r4, [up], #4
98 subs r5, r5, r8
99 str r5, [qp], #4
100 sbc r5, r5, r12
101 L(lo2): subs n, n, #4
102 umull r8, r12, r4, bd
103 bhi L(top)
105 L(wd2): subs r5, r5, r6
106 str r5, [qp], #4
107 sbc r5, r5, r7
108 L(wd1): subs r5, r5, r8
109 str r5, [qp]
110 sbc r0, r5, r12
111 pop {r4, r5, r6, r7, r8}
112 bx lr
113 EPILOGUE()