1 dnl AMD64 mpn_lshift -- mpn left shift.
3 dnl Copyright 2003, 2005, 2007, 2009 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
8 dnl modify it under the terms of the GNU Lesser General Public License as
9 dnl published by the Free Software Foundation; either version 3 of the
10 dnl License, or (at your option) any later version.
12 dnl The GNU MP Library is distributed in the hope that it will be useful,
13 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
14 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 dnl Lesser General Public 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')
23 C cycles/limb cycles/limb cnt=1
27 C P6-15 (Core2): 2.11 4.28
28 C P6-28 (Atom): 5.75 3.5
44 C For cnt=1 we want to work from lowest limb towards higher limbs.
45 C Check for bad overlap (up=rp is OK!) up=1..rp+n-1 is bad.
46 C FIXME: this could surely be done more cleverly.
55 L(fwd): mov R32(n), R32(%rax)
83 adc R32(%rax), R32(%rax)
85 L(e1): test R32(%rax), R32(%rax) C clear cy
91 L(ret): adc R32(%rax), R32(%rax)
100 adc R32(%rax), R32(%rax)
102 L(n10): mov 16(up), %r10
112 L(gen): neg R32(%rcx) C put rsh count in cl
114 shr R8(%rcx), %rax C function return value
116 neg R32(%rcx) C put lsh count in cl
119 je L(rlx) C jump for n = 3, 7, 11, ...
126 neg R32(%rcx) C put rsh count in cl
135 je L(1x) C jump for n = 1, 5, 9, 13, ...
136 C n = 2, 6, 10, 16, ...
139 neg R32(%rcx) C put rsh count in cl
145 neg R32(%rcx) C put lsh count in cl
151 mov -16(up,n,8), %r11
153 neg R32(%rcx) C put rsh count in cl
161 mov %r11, -16(rp,n,8)
164 L(rll): neg R32(%rcx) C put lsh count in cl
165 L(rlx): mov -8(up,n,8), %r10
167 mov -16(up,n,8), %r11
174 C finish stuff from lsh block
175 neg R32(%rcx) C put rsh count in cl
190 C finish stuff from rsh block
191 neg R32(%rcx) C put lsh count in cl
202 mov -16(up,n,8), %r11
209 neg R32(%rcx) C put rsh count in cl
219 neg R32(%rcx) C put lsh count in cl
220 L(ast): mov (up), %r10