1 dnl x86 mpn_rshift -- mpn right shift.
3 dnl Copyright 1992, 1994, 1996, 1999, 2000, 2001, 2002 Free Software
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 3 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 License
19 dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
21 include(`../config.m4')
33 C mp_limb_t mpn_rshift (mp_ptr dst, mp_srcptr src, mp_size_t size,
36 defframe(PARAM_SHIFT,16)
37 defframe(PARAM_SIZE, 12)
38 defframe(PARAM_SRC, 8)
39 defframe(PARAM_DST, 4)
55 leal -4(%edi,%edx,4),%edi
56 leal (%esi,%edx,4),%esi
59 movl (%esi,%edx,4),%ebx C read least significant limb
61 shrdl( %cl, %ebx, %eax) C compute carry limb
64 pushl %eax C push carry limb onto stack
66 jnz L(1) C enter loop in the middle
70 L(oop): movl (%esi,%edx,4),%ebx C load next higher limb
71 shrdl( %cl, %ebx, %eax) C compute result limb
72 movl %eax,(%edi,%edx,4) C store it
74 L(1): movl (%esi,%edx,4),%eax
75 shrdl( %cl, %eax, %ebx)
76 movl %ebx,(%edi,%edx,4)
80 shrl %cl,%eax C compute most significant limb
81 movl %eax,(%edi) C store it
83 popl %eax C pop carry limb
90 L(end): shrl %cl,%ebx C compute most significant limb
91 movl %ebx,(%edi) C store it