Annotation of OpenXM_contrib/gmp/mpn/x86/lshift.asm, Revision 1.1.1.2
1.1 maekawa 1: dnl x86 mpn_lshift -- mpn left shift.
2:
1.1.1.2 ! ohara 3: dnl Copyright 1992, 1994, 1996, 1999, 2000, 2001, 2002 Free Software
! 4: dnl Foundation, Inc.
1.1 maekawa 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: include(`../config.m4')
24:
25:
1.1.1.2 ! ohara 26: C cycles/limb
! 27: C P54: 7.5
! 28: C P55: 7.0
! 29: C P6: 2.5
! 30: C K6: 4.5
! 31: C K7: 5.0
! 32: C P4: 14.5
! 33:
! 34:
1.1 maekawa 35: C mp_limb_t mpn_lshift (mp_ptr dst, mp_srcptr src, mp_size_t size,
36: C unsigned shift);
37:
38: defframe(PARAM_SHIFT,16)
39: defframe(PARAM_SIZE, 12)
40: defframe(PARAM_SRC, 8)
41: defframe(PARAM_DST, 4)
42:
1.1.1.2 ! ohara 43: TEXT
1.1 maekawa 44: ALIGN(8)
45: PROLOGUE(mpn_lshift)
46:
47: pushl %edi
48: pushl %esi
49: pushl %ebx
50: deflit(`FRAME',12)
51:
52: movl PARAM_DST,%edi
53: movl PARAM_SRC,%esi
54: movl PARAM_SIZE,%edx
55: movl PARAM_SHIFT,%ecx
56:
57: subl $4,%esi C adjust src
58:
59: movl (%esi,%edx,4),%ebx C read most significant limb
60: xorl %eax,%eax
61: shldl( %cl, %ebx, %eax) C compute carry limb
62: decl %edx
63: jz L(end)
64: pushl %eax C push carry limb onto stack
65: testb $1,%dl
66: jnz L(1) C enter loop in the middle
67: movl %ebx,%eax
68:
69: ALIGN(8)
70: L(oop): movl (%esi,%edx,4),%ebx C load next lower limb
71: shldl( %cl, %ebx, %eax) C compute result limb
72: movl %eax,(%edi,%edx,4) C store it
73: decl %edx
74: L(1): movl (%esi,%edx,4),%eax
75: shldl( %cl, %eax, %ebx)
76: movl %ebx,(%edi,%edx,4)
77: decl %edx
78: jnz L(oop)
79:
80: shll %cl,%eax C compute least significant limb
81: movl %eax,(%edi) C store it
82:
83: popl %eax C pop carry limb
84:
85: popl %ebx
86: popl %esi
87: popl %edi
88: ret
89:
90: L(end): shll %cl,%ebx C compute least significant limb
91: movl %ebx,(%edi) C store it
92:
93: popl %ebx
94: popl %esi
95: popl %edi
96: ret
97:
98: EPILOGUE()
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>