1 dnl IA
-64 mpn_sec_tabselect.
3 dnl Copyright
2011 Free Software Foundation
, Inc.
5 dnl
This file is part of the GNU MP Library.
7 dnl The GNU MP Library is free software
; you can redistribute it and/or modify
8 dnl it under the terms of
either:
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.
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
20 dnl
or both
in parallel
, as here.
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
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
')
38 C * Using software pipelining could trivially yield 2 c/l without unrolling,
39 C or 1+epsilon with unrolling. (This code was modelled after the powerpc64
40 C code, for simplicity.)
42 C mpn_sec_tabselect (mp_limb_t *rp, mp_limb_t *tp, mp_size_t n, mp_size_t nents, mp_size_t which)
46 define(`nents', `r35
')
47 define(`which', `r36
')
57 PROLOGUE(mpn_sec_tabselect)
62 {.mmi; addp4 rp = 0, rp C M I
63 addp4 tp = 0, tp C M I
66 zxt4 nents = nents C I
67 zxt4 which = which C I
70 {.mmi; add rp2 = 8, rp1
74 }{.mmi; cmp.eq p10, p0 = 1, n
75 and r9 = 1, n C set cr0 for use in inner loop
76 shr.u r6 = r6, 1 C inner loop count
78 }{.mmi; cmp.eq p8, p0 = 0, r9
79 sub which = nents, which
84 {.mmi; cmp.eq p6, p7 = which, nents C are we at the selected table entry?
91 (p8) br.dptk L(top) C branch to loop entry if n even
93 }{.mmi; ld8 r16 = [tp1], 8
97 }{.mmi; ld8 r18 = [rp1]
101 }{.mmi; andcm r18 = r18, mask
106 }{.mmb; st8 [rp1] = r16, 8
112 {.mmi; ld8 r16 = [tp1], 16
116 }{.mmi; ld8 r18 = [rp1]
119 }{.mmi; ld8 r19 = [rp2]
123 }{.mmi; andcm r18 = r18, mask
124 andcm r19 = r19, mask
127 }{.mmi; or r16 = r16, r18
131 }{.mmb; st8 [rp1] = r16, 16
137 {.mmi; sub rp1 = rp1, n C move rp back to beginning
138 sub rp2 = rp2, n C move rp back to beginning
139 cmp.ne p9, p0 = 1, nents
140 }{.mmb; add nents = -1, nents
142 (p9) br.dptk L(outer)