1 dnl Alpha mpn_addlsh2_n/mpn_sublsh2_n -- rp[] = up[] +- (vp[] << 2).
3 dnl Copyright 2003, 2013 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')
39 C * Tune to reach 3.5 c/l on ev6 and 5.75 c/l on ev5.
58 ifdef(`OPERATION_addlsh2_n',`
60 define(CARRY, `cmpult $1,$2,$3')
61 define(func, mpn_addlsh2_n)
63 ifdef(`OPERATION_sublsh2_n',`
65 define(CARRY, `cmpult $2,$1,$3')
66 define(func, mpn_sublsh2_n)
69 MULFUNC_PROLOGUE(mpn_addlsh2_n mpn_sublsh2_n)
80 L(b00): lda vp, 48(vp)
86 L(b10): lda vp, 32(vp)
98 L(b11): lda vp, 40(vp)
109 L(top): s4addq v0, r3, sl C combined vlimb
111 ADDSUB u0, sl, ps C ulimb + (vlimb << 1)
113 srl v0, 62, r2 C high v bits
114 ADDSUB ps, cy1, rr C consume carry from previous operation
115 CARRY( ps, u0, cy0) C carry out #2
117 CARRY( rr, ps, cy) C carry out #3
118 lda vp, 32(vp) C bookkeeping
119 addq cy, cy0, cy0 C final carry out
121 L(lo0): ldq v0, -40(vp)
129 lda rp, 32(rp) C bookkeeping
131 L(lo3): s4addq v0, r3, sl
140 lda up, 32(up) C bookkeeping
142 L(lo2): s4addq v1, r2, sl
151 lda n, -4(n) C bookkeeping
155 L(end): s4addq v0, r3, sl