beta-0.89.2
[luatex.git] / source / libs / gmp / gmp-src / mpn / arm / aorsmul_1.asm
blobb02fbb3b2a0b938e5a335c251ec5d41581dc636b
1 dnl ARM mpn_addmul_1 and mpn_submul_1.
3 dnl Copyright 1998, 2000, 2001, 2003, 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 5.25
39 C Cortex-A15 4
41 define(`rp', `r0')
42 define(`up', `r1')
43 define(`n', `r2')
44 define(`vl', `r3')
45 define(`rl', `r12')
46 define(`ul', `r6')
47 define(`r', `lr')
49 ifdef(`OPERATION_addmul_1', `
50 define(`ADDSUB', adds)
51 define(`ADDSUBC', adcs)
52 define(`CLRRCY', `mov $1, #0
53 adds r0, r0, #0')
54 define(`RETVAL', `adc r0, r4, #0')
55 define(`func', mpn_addmul_1)')
56 ifdef(`OPERATION_submul_1', `
57 define(`ADDSUB', subs)
58 define(`ADDSUBC', sbcs)
59 define(`CLRRCY', `subs $1, r0, r0')
60 define(`RETVAL', `sbc r0, r0, r0
61 sub r0, $1, r0')
62 define(`func', mpn_submul_1)')
64 MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
66 ASM_START()
67 PROLOGUE(func)
68 stmfd sp!, { r4-r6, lr }
69 CLRRCY( r4)
70 tst n, #1
71 beq L(skip1)
72 ldr ul, [up], #4
73 ldr rl, [rp, #0]
74 umull r5, r4, ul, vl
75 ADDSUB r, rl, r5
76 str r, [rp], #4
77 L(skip1):
78 tst n, #2
79 beq L(skip2)
80 ldr ul, [up], #4
81 ldr rl, [rp, #0]
82 mov r5, #0
83 umlal r4, r5, ul, vl
84 ldr ul, [up], #4
85 ADDSUBC r, rl, r4
86 ldr rl, [rp, #4]
87 mov r4, #0
88 umlal r5, r4, ul, vl
89 str r, [rp], #4
90 ADDSUBC r, rl, r5
91 str r, [rp], #4
92 L(skip2):
93 bics n, n, #3
94 beq L(rtn)
96 ldr ul, [up], #4
97 ldr rl, [rp, #0]
98 mov r5, #0
99 umlal r4, r5, ul, vl
100 b L(in)
102 L(top): ldr ul, [up], #4
103 ADDSUBC r, rl, r5
104 ldr rl, [rp, #4]
105 mov r5, #0
106 umlal r4, r5, ul, vl
107 str r, [rp], #4
108 L(in): ldr ul, [up], #4
109 ADDSUBC r, rl, r4
110 ldr rl, [rp, #4]
111 mov r4, #0
112 umlal r5, r4, ul, vl
113 str r, [rp], #4
114 ldr ul, [up], #4
115 ADDSUBC r, rl, r5
116 ldr rl, [rp, #4]
117 mov r5, #0
118 umlal r4, r5, ul, vl
119 str r, [rp], #4
120 ldr ul, [up], #4
121 ADDSUBC r, rl, r4
122 ldr rl, [rp, #4]
123 mov r4, #0
124 umlal r5, r4, ul, vl
125 sub n, n, #4
126 tst n, n
127 str r, [rp], #4
128 bne L(top)
130 ADDSUBC r, rl, r5
131 str r, [rp]
133 L(rtn): RETVAL( r4)
134 ldmfd sp!, { r4-r6, pc }
135 EPILOGUE()