1 dnl AMD64 mpn_addlsh1_n, mpn_sublsh1_n -- rp[] = up[] +- (vp[] << 1),
2 dnl optimized for Pentium 4.
4 dnl Copyright 2008 Free Software Foundation, Inc.
6 dnl This file is part of the GNU MP Library.
8 dnl The GNU MP Library is free software; you can redistribute it and/or modify
9 dnl it under the terms of the GNU Lesser General Public License as published
10 dnl by the Free Software Foundation; either version 3 of the License, or (at
11 dnl your option) any later version.
13 dnl The GNU MP Library is distributed in the hope that it will be useful, but
14 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16 dnl License for more details.
18 dnl You should have received a copy of the GNU Lesser General Public License
19 dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
21 include(`../config.m4')
36 ifdef(`OPERATION_addlsh1_n', `
38 define(func, mpn_addlsh1_n)')
39 ifdef(`OPERATION_sublsh1_n', `
41 define(func, mpn_sublsh1_n)')
43 MULFUNC_PROLOGUE(mpn_addlsh1_n mpn_sublsh1_n)
57 xor R32(%rbx), R32(%rbx)
61 jne L(n00) C n = 0, 4, 8, ...
74 L(n00): cmp $2, R32(%rax)
75 jnc L(n01) C n = 1, 5, 9, ...
82 jz L(1) C jump for n = 1
91 L(n01): jne L(n10) C n = 2, 6, 10, ...
104 L(n10): mov (up), %r10
109 lea (%rbp,%r9,2), %r9
111 mov 12(vp), R32(%rbp)
117 L(c0): mov $1, R8(%rbx)
119 L(c1): mov $1, R8(%rax)
121 L(c2): mov $1, R8(%rbx)
125 L(top): mov (up), %r8 C not on critical path
127 ADDSUB %r9, %r11 C not on critical path
129 lea (%rbp,%r9,2), %r9
130 setc R8(%rbx) C save carry out
133 ADDSUB %rax, %r11 C apply previous carry out
134 jc L(c0) C jump if ripple
136 L(L01): mov 8(up), %r10
140 lea (%rbp,%r9,2), %r9
142 mov 12(vp), R32(%rbp)
147 L(L00): mov 16(up), %r12
151 lea (%rbp,%r9,2), %r9
153 mov 20(vp), R32(%rbp)
158 L(L11): mov 24(up), %r11
162 lea (%rbp,%r9,2), %r9
166 mov -4(vp), R32(%rbp)
170 L(rc3): lea 32(rp), rp
182 L(1): mov %r11, 8(rp)
183 lea (%rbx,%rbp), R32(%rax)
189 L(c3): mov $1, R8(%rax)