1 dnl Alpha ev6 nails mpn_addmul_2.
3 dnl Copyright
2002, 2005, 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 4.0 cycles/limb.
35 C We could either go for 2-way unrolling over 11 cycles, or 2.75 c/l,
36 C or 4-way unrolling over 20 cycles, for 2.5 c/l.
45 C Useful register aliases
46 define(`numb_mask',`r24
')
61 C Used for temps: r8 r19 r28
63 define(`NAIL_BITS',`GMP_NAIL_BITS
')
64 define(`NUMB_BITS',`GMP_NUMB_BITS
')
66 C This declaration is munged by configure
70 PROLOGUE(mpn_addmul_2)
72 srl numb_mask,NAIL_BITS,numb_mask
77 bis r31, r31, acc0 C zero acc0
79 bis r31, r31, acc1 C zero acc1
85 mulq v0, ulimb, m0a C U1
86 umulh v0, ulimb, m0b C U1
87 mulq v1, ulimb, m1a C U1
88 umulh v1, ulimb, m1b C U1
93 L(top): bis r31, r31, r31 C U1 nop
94 addq r19, acc0, acc0 C U0 propagate nail
99 srl m0a,NAIL_BITS, r8 C U0
101 mulq v0, ulimb, m0a C U1
103 addq r8, acc0, r19 C U0
104 addq m0b, acc1, acc0 C L1
105 umulh v0, ulimb, m0b C U1
106 bis r31, r31, r31 C L0 nop
108 addq rlimb, r19, r19 C L1 FINAL PROD-SUM
109 srl m1a,NAIL_BITS, r8 C U0
111 mulq v1, ulimb, m1a C U1
113 addq r8, acc0, acc0 C U0
114 bis r31, m1b, acc1 C L1
115 umulh v1, ulimb, m1b C U1
116 and r19,numb_mask, r28 C L0 extract numb part
119 srl r19,NUMB_BITS, r19 C U1 extract nail part
123 L(end): ldq rlimb, 0(rp)
124 addq r19, acc0, acc0 C propagate nail
126 srl m0a,NAIL_BITS, r8 C U0
130 srl m1a,NAIL_BITS, r8 C U0
133 and r19,numb_mask, r28 C extract limb
135 srl r19,NUMB_BITS, r19 C extract nail
138 addq r19, acc0, acc0 C propagate nail
139 and acc0,numb_mask, r28
141 srl acc0,NUMB_BITS, r19