Debian Codegraph @

msvc/gmp/mpn/x86i/pentium4/sse2/dive_1.asm

raw
1
2 ; Copyright 2001, 2002 Free Software Foundation, Inc.
3 ;
4 ; This file is part of the GNU MP Library.
5 ;
6 ; The GNU MP Library is free software; you can redistribute it and/or
7 ; modify it under the terms of the GNU Lesser General Public License as
8 ; published by the Free Software Foundation; either version 2.1 of the
9 ; License, or (at your option) any later version.
10 ;
11 ; The GNU MP Library is distributed in the hope that it will be useful,
12 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 ; Lesser General Public License for more details.
15 ;
16 ; You should have received a copy of the GNU Lesser General Public
17 ; License along with the GNU MP Library; see the file COPYING.LIB. If
18 ; not, write to the Free Software Foundation, Inc., 59 Temple Place -
19 ; Suite 330, Boston, MA 02111-1307, USA.
20 ;
21 ; Translation of AT&T syntax code by Brian Gladman
22
23 %include "..\..\x86i.inc"
24 %define p_space 16
25
26 extern ___gmp_modlimb_invert_table
27
28 section .text
29
30 global ___gmpn_divexact_1
31 %ifdef DLL
32 export ___gmpn_divexact_1
33 %endif
34
35 align 16
36 ___gmpn_divexact_1:
37 mov edx,[12+esp]
38 mov eax,[8+esp]
39 mov ecx,[16+esp]
40 sub edx,1
41 jnz two_or_more
42 mov eax,[eax]
43 xor edx,edx
44 div ecx
45 mov ecx,[4+esp]
46 mov [ecx],eax
47 ret
48
49 two_or_more:
50 mov eax,ecx
51 bsf ecx,ecx
52 shr eax,cl
53 movd mm6,eax
54 movd mm7,ecx
55 shr eax,1
56 and eax,127
57 movzx eax,byte [___gmp_modlimb_invert_table+eax]
58 movd mm5,eax
59 movd mm0,eax
60 pmuludq mm5,mm5
61 pmuludq mm5,mm6
62 paddd mm0,mm0
63 psubd mm0,mm5
64 pxor mm5,mm5
65 paddd mm5,mm0
66 pmuludq mm0,mm0
67 pcmpeqd mm4,mm4
68 psrlq mm4,32
69 pmuludq mm0,mm6
70 paddd mm5,mm5
71 mov eax,[8+esp]
72 mov ecx,[4+esp]
73 pxor mm1,mm1
74 psubd mm5,mm0
75 pxor mm0,mm0
76
77 top:
78 movd mm2,[eax]
79 movd mm3,[4+eax]
80 add eax,4
81 punpckldq mm2,mm3
82 psrlq mm2,mm7
83 pand mm2,mm4
84 psubq mm2,mm0
85 psubq mm2,mm1
86 movq mm0,mm2
87 psrlq mm0,63
88 pmuludq mm2,mm5
89 movd [ecx],mm2
90 add ecx,4
91 movq mm1,mm6
92 pmuludq mm1,mm2
93 psrlq mm1,32
94 sub edx,1
95 jnz top
96
97 done:
98 movd mm2,[eax]
99 psrlq mm2,mm7
100 psubq mm2,mm0
101 psubq mm2,mm1
102 pmuludq mm2,mm5
103 movd [ecx],mm2
104 emms
105 ret
106
107 end