1 dnl Alpha ev6 nails mpn_addmul_3.
3 dnl Copyright
2002, 2006 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
')
33 C Runs at 3.0 cycles/limb.
35 C With 2-way unrolling, we could probably reach 2.25 c/l (3.33 i/c).
44 C Useful register aliases
45 define(`numb_mask',`r24
')
64 C Used for temps: r8 r19 r28
66 define(`NAIL_BITS',`GMP_NAIL_BITS
')
67 define(`NUMB_BITS',`GMP_NUMB_BITS
')
69 C This declaration is munged by configure
73 PROLOGUE(mpn_addmul_3)
75 srl numb_mask,NAIL_BITS,numb_mask
81 bis r31, r31, acc0 C zero acc0
83 bis r31, r31, acc1 C zero acc1
85 bis r31, r31, acc2 C zero acc2
91 mulq v0, ulimb, m0a C U1
92 umulh v0, ulimb, m0b C U1
93 mulq v1, ulimb, m1a C U1
94 umulh v1, ulimb, m1b C U1
96 mulq v2, ulimb, m2a C U1
97 umulh v2, ulimb, m2b C U1
101 L(top): ldq rlimb, 0(rp) C L1
102 ldq ulimb, 0(up) C L0
103 bis r31, r31, r31 C U0 nop
104 addq r19, acc0, acc0 C U1 propagate nail
107 srl m0a,NAIL_BITS, r8 C U0
109 mulq v0, ulimb, m0a C U1
111 addq r8, acc0, r19 C U0
112 addq m0b, acc1, acc0 C L1
113 umulh v0, ulimb, m0b C U1
114 bis r31, r31, r31 C L0 nop
116 addq rlimb, r19, r19 C L1
117 srl m1a,NAIL_BITS, r8 C U0
118 bis r31, r31, r31 C L0 nop
119 mulq v1, ulimb, m1a C U1
121 addq r8, acc0, acc0 C U0
122 addq m1b, acc2, acc1 C L1
123 umulh v1, ulimb, m1b C U1
124 and r19,numb_mask, r28 C L0 extract numb part
126 bis r31, r31, r31 C L1 nop
127 srl m2a,NAIL_BITS, r8 C U0
129 mulq v2, ulimb, m2a C U1
131 addq r8, acc1, acc1 C L0
132 bis r31, m2b, acc2 C L1
133 umulh v2, ulimb, m2b C U1
134 srl r19,NUMB_BITS, r19 C U0 extract nail part
139 L(end): ldq rlimb, 0(rp)
140 addq r19, acc0, acc0 C propagate nail
142 srl m0a,NAIL_BITS, r8 C U0
146 srl m1a,NAIL_BITS, r8 C U0
149 and r19,numb_mask, r28 C extract limb
150 srl m2a,NAIL_BITS, r8 C U0
153 srl r19,NUMB_BITS, r19 C extract nail
156 addq r19, acc0, acc0 C propagate nail
157 and acc0,numb_mask, r28
159 srl acc0,NUMB_BITS, r19
162 and acc1,numb_mask, r28
164 srl acc1,NUMB_BITS, r19