Debian Codegraph @

msvc/gmp/mpn/x86i/rshift.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 %assign frame frame+12
31
32 section .text
33
34 global ___gmpn_rshift
35 %ifdef DLL
36 export ___gmpn_rshift
37 %endif
38
39 align 8
40 ___gmpn_rshift:
41 push edi
42 push esi
43 push ebx
44 mov edi,[PARAM_DST]
45 mov esi,[PARAM_SRC]
46 mov edx,[PARAM_SIZE]
47 mov ecx,[PARAM_SHIFT]
48 lea edi,[-4+edi+edx*4]
49 lea esi,[esi+edx*4]
50 neg edx
51 mov ebx,[esi+edx*4] ; read least significant limb
52 xor eax,eax
53 shrd eax,ebx,cl
54 inc edx
55 jz Lend
56 push eax ; push carry limb onto stack
57 test dl,1
58 jnz L1 ; enter Lop in the middle
59 mov eax,ebx
60
61 align 8
62 Lop:
63 mov ebx,[esi+edx*4] ; load next higher limb
64 shrd eax,ebx,cl
65 mov [edi+edx*4],eax ; store it
66 inc edx
67 L1:
68 mov eax,[esi+edx*4]
69 shrd ebx,eax,cl
70 mov [edi+edx*4],ebx
71 inc edx
72 jnz Lop
73 shr eax,cl ; compute most significant limb
74 mov [edi],eax ; store it
75 pop eax ; pop carry limb
76 pop ebx
77 pop esi
78 pop edi
79 ret
80 Lend:
81 shr ebx,cl ; compute most significant limb
82 mov [edi],ebx ; store it
83 pop ebx
84 pop esi
85 pop edi
86 ret
87
88 end