1 dnl ARM mpn_and_n
, mpn_andn_n. mpn_nand_n
, etc
, optimised for A15.
3 dnl Contributed to the GNU project by Torbjörn Granlund.
5 dnl Copyright
2013 Free Software Foundation
, Inc.
7 dnl
This file is part of the GNU MP Library.
9 dnl The GNU MP Library is free software
; you can redistribute it and/or modify
10 dnl it under the terms of
either:
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.
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
22 dnl
or both
in parallel
, as here.
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
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
/.
33 include(`..
/config.m4
')
35 C cycles/limb cycles/limb
36 C and andn ior xor nand iorn nior xnor
42 C Cortex-A15 1.27 1.64
44 C This is great A15 core register code, but it is a bit large.
45 C We use FEEDIN_VARIANT 1 to save some space, but use 8-way unrolling.
47 C Architecture requirements:
55 define(`FEEDIN_VARIANT', 1) C
alternatives: 0 1 2
56 define
(`UNROLL
', 4x2) C alternatives: 4 4x2
65 ifdef
(`OPERATION_and_n
',`
66 define(`func', `mpn_and_n
')
67 define(`LOGOP', `
and $1, $2, $3')')
68 ifdef
(`OPERATION_andn_n
',`
69 define(`func', `mpn_andn_n
')
70 define(`LOGOP', `bic
$1, $2, $3')')
71 ifdef
(`OPERATION_nand_n
',`
72 define(`func', `mpn_nand_n
')
73 define(`POSTOP', `mvn
$1, $1')
74 define(`LOGOP', `
and $1, $2, $3')')
75 ifdef
(`OPERATION_ior_n
',`
76 define(`func', `mpn_ior_n
')
77 define(`LOGOP', `orr
$1, $2, $3')')
78 ifdef
(`OPERATION_iorn_n
',`
79 define(`func', `mpn_iorn_n
')
80 define(`POSTOP', `mvn
$1, $1')
81 define(`LOGOP', `bic
$1, $3, $2')')
82 ifdef
(`OPERATION_nior_n
',`
83 define(`func', `mpn_nior_n
')
84 define(`POSTOP', `mvn
$1, $1')
85 define(`LOGOP', `orr
$1, $2, $3')')
86 ifdef
(`OPERATION_xor_n
',`
87 define(`func', `mpn_xor_n
')
88 define(`LOGOP', `eor
$1, $2, $3')')
89 ifdef
(`OPERATION_xnor_n
',`
90 define(`func', `mpn_xnor_n
')
91 define(`POSTOP', `mvn
$1, $1')
92 define(`LOGOP', `eor
$1, $2, $3')')
94 MULFUNC_PROLOGUE
(mpn_and_n mpn_andn_n mpn_nand_n mpn_ior_n mpn_iorn_n mpn_nior_n mpn_xor_n mpn_xnor_n
)
100 ifelse
(FEEDIN_VARIANT
,0,`
113 L
(bx0
): ldrd r4
, r5
, [up
, #
0]
114 ldrd r6
, r7
, [vp
, #
0]
119 L
(b00a
):ldrd r4
, r5
, [up
], #
-8
120 ldrd r6
, r7
, [vp
], #
-8
124 ifelse(FEEDIN_VARIANT,1,`
136 ldrd r4, r5, [up, #0]
137 ldrd r6, r7, [vp, #0]
142 ldrd r4, r5, [up], #-8
143 ldrd r6, r7, [vp], #-8
147 ifelse
(FEEDIN_VARIANT
,2,`
155 L
(b11
): ldr r5
, [up
], #
4
158 ldrd r4
, r5
, [up
, #
0]
159 ldrd r6
, r7
, [vp
, #
0]
164 L
(b00
): ldrd r4
, r5
, [up
], #
-8
165 ldrd r6
, r7
, [vp
], #
-8
169 L
(b01
): ldr r5
, [up
], #
-4
176 L
(gt1
): ldrd r4
, r5
, [up
, #
8]
177 ldrd r6
, r7
, [vp
, #
8]
180 L
(b10
): ldrd r4
, r5
, [up
]
187 L(top): ldrd r4, r5, [up, #8]
188 ldrd r6, r7, [vp, #8]
191 strd r8, r9, [rp, #8]
192 L(mid): LOGOP( r8, r4, r6)
194 ldrd r4, r5, [up, #16]!
195 ldrd r6, r7, [vp, #16]!
198 strd r8, r9, [rp, #16]!
200 L(lo): LOGOP( r8, r4, r6)
206 L
(top
): ldrd r4
, r5
, [up
, #
8]
207 ldrd r6
, r7
, [vp
, #
8]
210 strd r8
, r9
, [rp
, #
8]
211 L
(mid
): LOGOP
( r8
, r4
, r6
)
213 ldrd r4
, r5
, [up
, #
16]
214 ldrd r6
, r7
, [vp
, #
16]
217 strd r8
, r9
, [rp
, #
16]
223 ldrd r4
, r5
, [up
, #
24]
224 ldrd r6
, r7
, [vp
, #
24]
227 strd r8
, r9
, [rp
, #
24]
230 ldrd r4
, r5
, [up
, #
32]!
231 ldrd r6
, r7
, [vp
, #
32]!
234 strd r8
, r9
, [rp
, #
32]!
235 L
(lo
): LOGOP
( r8
, r4
, r6
)
243 strd r8, r9, [rp, #8]
244 L(wd1): pop { r4-r9 }
249 strd r8, r9, [rp, #24]