beta-0.89.2
[luatex.git] / source / libs / gmp / gmp-src / mpn / arm / v7a / cora15 / neon / copyi.asm
blob2e05afe5e86facf99607d263673226744337bbdb
1 dnl ARM Neon mpn_copyi optimised for A15.
3 dnl Copyright 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
34 C StrongARM -
35 C XScale -
36 C Cortex-A7 ?
37 C Cortex-A8 ?
38 C Cortex-A9 1.75 slower than core register code
39 C Cortex-A15 0.52
41 define(`rp', `r0')
42 define(`up', `r1')
43 define(`n', `r2')
45 ASM_START()
46 PROLOGUE(mpn_copyi)
47 cmp n, #7
48 ble L(bc)
50 C Copy until rp is 128-bit aligned
51 tst rp, #4
52 beq L(al1)
53 vld1.32 {d22[0]}, [up]!
54 sub n, n, #1
55 vst1.32 {d22[0]}, [rp]!
56 L(al1): tst rp, #8
57 beq L(al2)
58 vld1.32 {d22}, [up]!
59 sub n, n, #2
60 vst1.32 {d22}, [rp:64]!
61 L(al2): vld1.32 {d26-d27}, [up]!
62 subs n, n, #12
63 blt L(end)
65 ALIGN(16)
66 L(top): vld1.32 {d22-d23}, [up]!
67 vst1.32 {d26-d27}, [rp:128]!
68 vld1.32 {d26-d27}, [up]!
69 vst1.32 {d22-d23}, [rp:128]!
70 subs n, n, #8
71 bge L(top)
73 L(end): vst1.32 {d26-d27}, [rp:128]!
75 C Copy last 0-7 limbs. Note that rp is aligned after loop, but not when we
76 C arrive here via L(bc)
77 L(bc): tst n, #4
78 beq L(tl1)
79 vld1.32 {d22-d23}, [up]!
80 vst1.32 {d22-d23}, [rp]!
81 L(tl1): tst n, #2
82 beq L(tl2)
83 vld1.32 {d22}, [up]!
84 vst1.32 {d22}, [rp]!
85 L(tl2): tst n, #1
86 beq L(tl3)
87 vld1.32 {d22[0]}, [up]
88 vst1.32 {d22[0]}, [rp]
89 L(tl3): bx lr
90 EPILOGUE()