1 dnl x86 mpn_lshift -- mpn left shift.
3 dnl Copyright (C) 1992, 1994, 1996, 1999, 2000 Free Software Foundation,
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
9 dnl modify it under the terms of the GNU Lesser General Public License as
10 dnl published by the Free Software Foundation; either version 2.1 of the
11 dnl License, or (at your option) any later version.
13 dnl The GNU MP Library is distributed in the hope that it will be useful,
14 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
15 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 dnl Lesser General Public License for more details.
18 dnl You should have received a copy of the GNU Lesser General Public
19 dnl License along with the GNU MP Library; see the file COPYING.LIB. If
20 dnl not, write to the Free Software Foundation, Inc., 59 Temple Place -
21 dnl Suite 330, Boston, MA 02111-1307, USA.
24 include(`../config.m4')
27 C mp_limb_t mpn_lshift (mp_ptr dst, mp_srcptr src, mp_size_t size,
30 defframe(PARAM_SHIFT,16)
31 defframe(PARAM_SIZE, 12)
32 defframe(PARAM_SRC, 8)
33 defframe(PARAM_DST, 4)
49 subl $4,%esi C adjust src
51 movl (%esi,%edx,4),%ebx C read most significant limb
53 shldl( %cl, %ebx, %eax) C compute carry limb
56 pushl %eax C push carry limb onto stack
58 jnz L(1) C enter loop in the middle
62 L(oop): movl (%esi,%edx,4),%ebx C load next lower limb
63 shldl( %cl, %ebx, %eax) C compute result limb
64 movl %eax,(%edi,%edx,4) C store it
66 L(1): movl (%esi,%edx,4),%eax
67 shldl( %cl, %eax, %ebx)
68 movl %ebx,(%edi,%edx,4)
72 shll %cl,%eax C compute least significant limb
73 movl %eax,(%edi) C store it
75 popl %eax C pop carry limb
82 L(end): shll %cl,%ebx C compute least significant limb
83 movl %ebx,(%edi) C store it