beta-0.89.2
[luatex.git] / source / libs / gmp / gmp-src / mpn / arm / v7a / cora15 / mul_1.asm
blob766ba5c57f22dd8a980e9cd3a90b7557351002a7
1 dnl ARM mpn_mul_1 optimised for A15.
3 dnl Copyright 2012, 2013 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 best
34 C StrongARM: -
35 C XScale ?
36 C Cortex-A7 ?
37 C Cortex-A8 ?
38 C Cortex-A9 5.25 3.25
39 C Cortex-A15 2.25 this
42 C This runs well on A15 but very poorly on A9. By scheduling loads and adds
43 C it is possible to get good A9 performance as well, but at the cost of using
44 C many more (callee-saves) registers.
46 C This is armv5 code, optimized for the armv7a cpu A15. Its location in the
47 C GMP file structure might be misleading.
50 define(`rp', `r0')
51 define(`up', `r1')
52 define(`n', `r2')
53 define(`v0', `r3')
55 ASM_START()
56 PROLOGUE(mpn_mul_1c)
57 ldr r12, [sp]
58 b L(ent)
59 EPILOGUE()
60 PROLOGUE(mpn_mul_1)
61 mov r12, #0
62 L(ent): push {r4-r7}
64 ldr r6, [up], #4
65 tst n, #1
66 beq L(bx0)
68 L(bx1): umull r4, r7, r6, v0
69 adds r4, r4, r12
70 tst n, #2
71 beq L(lo1)
72 b L(lo3)
74 L(bx0): umull r4, r5, r6, v0
75 adds r4, r4, r12
76 tst n, #2
77 beq L(lo0)
78 b L(lo2)
80 L(top): ldr r6, [up], #4
81 str r4, [rp], #4
82 umull r4, r5, r6, v0
83 adds r4, r4, r7
84 L(lo0): ldr r6, [up], #4
85 str r4, [rp], #4
86 umull r4, r7, r6, v0
87 adcs r4, r4, r5
88 L(lo3): ldr r6, [up], #4
89 str r4, [rp], #4
90 umull r4, r5, r6, v0
91 adcs r4, r4, r7
92 L(lo2): ldr r6, [up], #4
93 str r4, [rp], #4
94 umull r4, r7, r6, v0
95 adcs r4, r4, r5
96 L(lo1): adc r7, r7, #0
97 subs n, n, #4
98 bgt L(top)
100 str r4, [rp]
101 mov r0, r7
102 pop {r4-r7}
103 bx lr
104 EPILOGUE()