sqr_diag_addlsh1.asm revision 1.1 1 dnl ARM64 mpn_sqr_diag_addlsh1.
2
3 dnl Contributed to the GNU project by Torbjrn Granlund.
4
5 dnl Copyright 2016, 2017 Free Software Foundation, Inc.
6
7 dnl This file is part of the GNU MP Library.
8 dnl
9 dnl The GNU MP Library is free software; you can redistribute it and/or modify
10 dnl it under the terms of either:
11 dnl
12 dnl * the GNU Lesser General Public License as published by the Free
13 dnl Software Foundation; either version 3 of the License, or (at your
14 dnl option) any later version.
15 dnl
16 dnl or
17 dnl
18 dnl * the GNU General Public License as published by the Free Software
19 dnl Foundation; either version 2 of the License, or (at your option) any
20 dnl later version.
21 dnl
22 dnl or both in parallel, as here.
23 dnl
24 dnl The GNU MP Library is distributed in the hope that it will be useful, but
25 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
26 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 dnl for more details.
28 dnl
29 dnl You should have received copies of the GNU General Public License and the
30 dnl GNU Lesser General Public License along with the GNU MP Library. If not,
31 dnl see https://www.gnu.org/licenses/.
32
33 include(`../config.m4')
34
35 C cycles/limb
36 C Cortex-A53 5.65
37 C Cortex-A57 3.5
38 C X-Gene 3.38
39
40 changecom(blah)
41
42 define(`rp', `x0')
43 define(`tp', `x1')
44 define(`up', `x2')
45 define(`n', `x3')
46
47 ASM_START()
48 PROLOGUE(mpn_sqr_diag_addlsh1)
49 ldr x15, [up],#8
50 lsr x18, n, #1
51 tbz n, #0, L(bx0)
52
53 L(bx1): adds x7, xzr, xzr
54 mul x12, x15, x15
55 ldr x16, [up],#8
56 ldp x4, x5, [tp],#16
57 umulh x11, x15, x15
58 b L(mid)
59
60 L(bx0): adds x5, xzr, xzr
61 mul x12, x15, x15
62 ldr x17, [up],#16
63 ldp x6, x7, [tp],#32
64 umulh x11, x15, x15
65 sub x18, x18, #1
66 cbz x18, L(end)
67
68 ALIGN(16)
69 L(top): extr x9, x6, x5, #63
70 mul x10, x17, x17
71 ldr x16, [up,#-8]
72 adcs x13, x9, x11
73 ldp x4, x5, [tp,#-16]
74 umulh x11, x17, x17
75 extr x8, x7, x6, #63
76 stp x12, x13, [rp],#16
77 adcs x12, x8, x10
78 L(mid): extr x9, x4, x7, #63
79 mul x10, x16, x16
80 ldr x17, [up],#16
81 adcs x13, x9, x11
82 ldp x6, x7, [tp],#32
83 umulh x11, x16, x16
84 extr x8, x5, x4, #63
85 stp x12, x13, [rp],#16
86 adcs x12, x8, x10
87 sub x18, x18, #1
88 cbnz x18, L(top)
89
90 L(end): extr x9, x6, x5, #63
91 mul x10, x17, x17
92 adcs x13, x9, x11
93 umulh x11, x17, x17
94 extr x8, x7, x6, #63
95 stp x12, x13, [rp]
96 adcs x12, x8, x10
97 extr x9, xzr, x7, #63
98 adcs x13, x9, x11
99 stp x12, x13, [rp,#16]
100
101 ret
102 EPILOGUE()
103