1 dnl AMD64 mpn_addlsh2_n and mpn_rsblsh2_n. R = 2*V +- U.
2 dnl ("rsb" means reversed subtract, name mandated by mpn_sublsh2_n which
3 dnl subtacts the shifted operand from the unshifted operand.)
5 dnl Copyright 2009 Free Software Foundation, Inc.
7 dnl This file is part of the GNU MP Library.
9 dnl The GNU MP Library is free software; you can redistribute it and/or modify
10 dnl it under the terms of the GNU Lesser General Public License as published
11 dnl by the Free Software Foundation; either version 3 of the License, or (at
12 dnl your option) any later version.
14 dnl The GNU MP Library is distributed in the hope that it will be useful, but
15 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17 dnl License for more details.
19 dnl You should have received a copy of the GNU Lesser General Public License
20 dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
22 include(`../config.m4')
39 ifdef(`OPERATION_addlsh2_n',`
42 define(func, mpn_addlsh2_n)')
43 ifdef(`OPERATION_rsblsh2_n',`
46 define(func, mpn_rsblsh2_n)')
48 MULFUNC_PROLOGUE(mpn_addlsh2_n mpn_rsblsh2_n)
74 L(b11): mov 8(vp,n,8), %r10
75 lea (%r8,%r10,4), %r14
78 lea (%r10,%r11,4), %r15
81 ADCSBB 8(up,n,8), %r14
82 ADCSBB 16(up,n,8), %r15
83 sbb R32(%rax), R32(%rax) C save carry for next
93 sbb R32(%rax), R32(%rax) C save carry for next
99 L(b10): mov 8(vp,n,8), %r11
100 lea (%r8,%r11,4), %r15
102 ADDSUB (up,n,8), %r12
103 ADCSBB 8(up,n,8), %r15
104 sbb R32(%rax), R32(%rax) C save carry for next
111 L(b00): mov 8(vp,n,8), %r9
116 L(top): mov 16(vp,n,8), %r10
119 lea (%r11,%r8,4), %r12
121 L(e00): lea (%r8,%r9,4), %r13
124 lea (%r9,%r10,4), %r14
126 lea (%r10,%r11,4), %r15
128 add R32(%rax), R32(%rax) C restore carry
129 ADCSBB (up,n,8), %r12
130 ADCSBB 8(up,n,8), %r13
131 ADCSBB 16(up,n,8), %r14
132 ADCSBB 24(up,n,8), %r15
136 sbb R32(%rax), R32(%rax) C save carry for next
142 ifdef(`OPERATION_addlsh2_n',`
143 sub R32(%r11), R32(%rax)
145 ifdef(`OPERATION_rsblsh2_n',`
146 add R32(%r11), R32(%rax)
147 movslq R32(%rax), %rax')