Debian Codegraph @

msvc/gmp/mpn/x86i/pentium4/mmx/popham.asm

raw
1
2 ; Copyright 2000, 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 %macro ph_fun 1
24 %ifdef PIC
25 mov edx,0xAAAAAAAA
26 movd mm7,edx
27 punpckldq mm7,mm7
28 mov edx,0x33333333
29 movd mm6,edx
30 punpckldq mm6,mm6
31 mov edx,0x0F0F0F0F
32 movd mm5,edx
33 punpckldq mm5,mm5
34 %else
35 movq mm7,[L_AA]
36 movq mm6,[L_33]
37 movq mm5,[L_0F]
38 %endif
39 mov ecx,[esp+PARAM_SIZE]
40 mov eax,[esp+PARAM_SRC]
41 %if %1 == 1
42 mov edx,[esp+PARAM_SRC2]
43 %endif
44 pxor mm4,mm4
45 pxor mm0,mm0
46 sub ecx,1
47 ja %%L_top
48
49 %%L_last:
50 movd mm1,[eax+ecx*4]
51 %if %1 == 1
52 movd mm2,[edx+ecx*4]
53 pxor mm1,mm2
54 %endif
55 jmp %%L_loaded
56
57 %%L_top:
58 movd mm1,[eax]
59 movd mm2,[eax+4]
60 punpckldq mm1,mm2
61 add eax,8
62 %if %1 == 1
63 movd mm2,[edx]
64 movd mm3,[edx+4]
65 punpckldq mm2,mm3
66 pxor mm1,mm2
67 add edx,8
68 %endif
69 %%L_loaded:
70 movq mm2,mm7
71 pand mm2,mm1
72 psrlq mm2,1
73 psubd mm1,mm2
74 movq mm2,mm6
75 pand mm2,mm1
76 psrlq mm1,2
77 pand mm1,mm6
78 paddd mm1,mm2
79 movq mm2,mm5
80 pand mm2,mm1
81 psrlq mm1,4
82 pand mm1,mm5
83 paddd mm1,mm2
84 psadbw mm1,mm4
85 paddd mm0,mm1
86 sub ecx,2
87 jg %%L_top
88 jz %%L_last
89 movd eax,mm0
90 emms
91 ret
92 %endmacro
93
94 %ifndef PIC
95 data
96 align 8
97
98 L_AA: dq 0xAAAAAAAAAAAAAAAA
99 L_33: dq 0x3333333333333333
100 L_0F: dq 0x0F0F0F0F0F0F0F0F
101 %endif
102
103 text
104
105 %define PARAM_SIZE 8
106 %define PARAM_SRC 4
107 global ___gmpn_popcount
108 %ifdef DLL
109 export ___gmpn_popcount
110 %endif
111 align 16
112 ___gmpn_popcount:
113 ph_fun 0
114
115 %define PARAM_SIZE 12
116 %define PARAM_SRC2 8
117 %define PARAM_SRC 4
118 global ___gmpn_hamdist
119 %ifdef DLL
120 export ___gmpn_hamdist
121 %endif
122 align 16
123 ___gmpn_hamdist:
124 ph_fun 1
125
126 end