1 /* Pentium optimized __mpn_lshift --
2 Copyright (C) 1992, 94, 95, 96, 97, 98, 2000 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Library General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or (at your
8 option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with the GNU MP Library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
18 MA 02111-1307, USA. */
21 #include "asm-syntax.h"
24 #define PARMS LINKAGE+16 /* space for 4 saved regs */
26 #define S RES+PTR_SIZE
27 #define SIZE S+PTR_SIZE
44 /* We can use faster code for shift-by-1 under certain conditions. */
49 jnc L(special) /* jump if s_ptr + 1 >= res_ptr */
50 leal (%esi,%ebx,4),%eax
52 jnc L(special) /* jump if res_ptr >= s_ptr + size */
55 leal -4(%edi,%ebx,4),%edi
56 leal -4(%esi,%ebx,4),%esi
61 shldl %cl,%edx,%eax /* compute carry limb */
62 pushl %eax /* push carry limb onto stack */
69 movl (%edi),%eax /* fetch destination cache line */
72 L(oop): movl -28(%edi),%eax /* fetch destination cache line */
122 shll %cl,%edx /* compute least significant limb */
123 movl %edx,(%edi) /* store it */
125 popl %eax /* pop carry limb */
135 /* We loop from least significant end of the arrays, which is only
136 permissible if the source and destination don't overlap, since the
137 function is documented to work for overlapping source and destination.
153 movl (%edi),%eax /* fetch destination cache line */
157 movl 28(%edi),%eax /* fetch destination cache line */
188 leal 32(%esi),%esi /* use leal not to clobber carry */
195 sbbl %eax,%eax /* save carry in %eax */
198 addl %eax,%eax /* restore carry from eax */
205 leal 4(%esi),%esi /* use leal not to clobber carry */
212 addl %eax,%eax /* restore carry from eax */
213 L(L1): movl %edx,(%edi) /* store last limb */