1 dnl Alpha mpn_addlsh1_n/mpn_sublsh1_n -- rp[] = up[] +- (vp[] << 1).
3 dnl Copyright 2003 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 the GNU Lesser General Public License as published
9 dnl by the Free Software Foundation; either version 3 of the License, or (at
10 dnl your option) any later version.
12 dnl The GNU MP Library is distributed in the hope that it will be useful, but
13 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 dnl License for more details.
17 dnl You should have received a copy of the GNU Lesser General Public License
18 dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
20 include(`../config.m4')
25 C EV6: 4.375 (i.e., worse than separate mpn_lshift and mpn_add_n at 3.875)
28 C * Write special version for ev6, as this is a slowdown for 100 < n < 2200
29 C compared to separate mpn_lshift and mpn_add_n.
30 C * Use addq instead of sll for left shift, and similarly cmplt instead of srl
55 ifdef(`OPERATION_addlsh1_n',`
57 define(CARRY, `cmpult $1,$2,$3')
58 define(func, mpn_addlsh1_n)
60 ifdef(`OPERATION_sublsh1_n',`
62 define(CARRY, `cmpult $2,$1,$3')
63 define(func, mpn_sublsh1_n)
66 MULFUNC_PROLOGUE(mpn_addlsh1_n mpn_sublsh1_n)
78 $Lb11: C n = 3, 7, 11, ...
89 $Lb10: C n = 2, 6, 10, ...
102 $Lb01: C n = 1, 5, 9, ...
115 $Lb00: C n = 4, 8, 12, ...
128 $Loop: sll v0, 1, sl C left shift vlimb
131 ADDSUB u0, sl, ps C ulimb + (vlimb << 1)
134 ADDSUB ps, cy1, rr C consume carry from previous operation
135 srl v0, 63, cy0 C carry out #1
137 CARRY( ps, u0, cy) C carry out #2
140 addq cy, cy0, cy0 C combine carry out #1 and #2
141 CARRY( rr, ps, cy) C carry out #3
143 addq cy, cy0, cy0 C final carry out
144 lda vp, 32(vp) C bookkeeping
162 lda rp, 32(rp) C bookkeeping
180 $LL00x: lda up, 32(up) C bookkeeping
198 lda n, -4(n) C bookkeeping