Debian Codegraph @

msvc/gmp/mpn/x86i/lshift.asm

raw
1
2 ; Copyright 1992, 1994, 1996, 1999, 2000, 2001, 2002 Free Software
3 ; Foundation, Inc.
4 ;
5 ; This file is part of the GNU MP Library.
6 ;
7 ; The GNU MP Library is free software; you can redistribute it and/or
8 ; modify it under the terms of the GNU Lesser General Public License as
9 ; published by the Free Software Foundation; either version 2.1 of the
10 ; License, or (at your option) any later version.
11 ;
12 ; The GNU MP Library is distributed in the hope that it will be useful,
13 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 ; Lesser General Public License for more details.
16 ;
17 ; You should have received a copy of the GNU Lesser General Public
18 ; License along with the GNU MP Library; see the file COPYING.LIB. If
19 ; not, write to the Free Software Foundation, Inc., 59 Temple Place -
20 ; Suite 330, Boston, MA 02111-1307, USA.
21 ;
22 ; Translation of AT&T syntax code by Brian Gladman
23
24 %include "x86i.inc"
25
26 %define PARAM_SHIFT esp+frame+16
27 %define PARAM_SIZE esp+frame+12
28 %define PARAM_SRC esp+frame+8
29 %define PARAM_DST esp+frame+4
30
31 section .text
32
33 global ___gmpn_lshift
34 %ifdef DLL
35 export ___gmpn_lshift
36 %endif
37
38 align 8
39 ___gmpn_lshift:
40 push edi
41 push esi
42 push ebx
43 %assign frame frame+12
44 mov edi,[PARAM_DST]
45 mov esi,[PARAM_SRC]
46 mov edx,[PARAM_SIZE]
47 mov ecx,[PARAM_SHIFT]
48 sub esi,4 ; adjust src
49 mov ebx,[esi+edx*4] ; read most significant limb
50 xor eax,eax
51 shld eax,ebx,cl
52 dec edx
53 jz Lend
54 push eax ; push carry limb onto stack
55 test dl,1
56 jnz L1 ; enter Lop in the middle
57 mov eax,ebx
58
59 align 8
60 Lop:
61 mov ebx,[esi+edx*4] ; load next lower limb
62 shld eax,ebx,cl
63 mov [edi+edx*4],eax ; store it
64 dec edx
65 L1:
66 mov eax,[esi+edx*4]
67 shld ebx,eax,cl
68 mov [edi+edx*4],ebx
69 dec edx
70 jnz Lop
71 shl eax,cl ; compute least significant limb
72 mov [edi],eax ; store it
73 pop eax ; pop carry limb
74 pop ebx
75 pop esi
76 pop edi
77 ret
78 Lend:
79 shl ebx,cl ; compute least significant limb
80 mov [edi],ebx ; store it
81 pop ebx
82 pop esi
83 pop edi
84 ret
85
86 end