Annotation of OpenXM_contrib/gmp/mpn/x86/rshift.asm, Revision 1.1.1.1
1.1 maekawa 1: dnl x86 mpn_rshift -- mpn right shift.
2:
3: dnl Copyright (C) 1992, 1994, 1996, 1999, 2000 Free Software Foundation,
4: dnl Inc.
5: dnl
6: dnl This file is part of the GNU MP Library.
7: dnl
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.
12: dnl
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.
17: dnl
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.
22:
23:
24: include(`../config.m4')
25:
26:
27: C mp_limb_t mpn_rshift (mp_ptr dst, mp_srcptr src, mp_size_t size,
28: C unsigned shift);
29:
30: defframe(PARAM_SHIFT,16)
31: defframe(PARAM_SIZE, 12)
32: defframe(PARAM_SRC, 8)
33: defframe(PARAM_DST, 4)
34:
35: .text
36: ALIGN(8)
37: PROLOGUE(mpn_rshift)
38:
39: pushl %edi
40: pushl %esi
41: pushl %ebx
42: deflit(`FRAME',12)
43:
44: movl PARAM_DST,%edi
45: movl PARAM_SRC,%esi
46: movl PARAM_SIZE,%edx
47: movl PARAM_SHIFT,%ecx
48:
49: leal -4(%edi,%edx,4),%edi
50: leal (%esi,%edx,4),%esi
51: negl %edx
52:
53: movl (%esi,%edx,4),%ebx C read least significant limb
54: xorl %eax,%eax
55: shrdl( %cl, %ebx, %eax) C compute carry limb
56: incl %edx
57: jz L(end)
58: pushl %eax C push carry limb onto stack
59: testb $1,%dl
60: jnz L(1) C enter loop in the middle
61: movl %ebx,%eax
62:
63: ALIGN(8)
64: L(oop): movl (%esi,%edx,4),%ebx C load next higher limb
65: shrdl( %cl, %ebx, %eax) C compute result limb
66: movl %eax,(%edi,%edx,4) C store it
67: incl %edx
68: L(1): movl (%esi,%edx,4),%eax
69: shrdl( %cl, %eax, %ebx)
70: movl %ebx,(%edi,%edx,4)
71: incl %edx
72: jnz L(oop)
73:
74: shrl %cl,%eax C compute most significant limb
75: movl %eax,(%edi) C store it
76:
77: popl %eax C pop carry limb
78:
79: popl %ebx
80: popl %esi
81: popl %edi
82: ret
83:
84: L(end): shrl %cl,%ebx C compute most significant limb
85: movl %ebx,(%edi) C store it
86:
87: popl %ebx
88: popl %esi
89: popl %edi
90: ret
91:
92: EPILOGUE()
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>