~ubuntu-branches/ubuntu/intrepid/ecl/intrepid

« back to all changes in this revision

Viewing changes to msvc/gmp/mpn/x86i/pentium4/mmx/popham.asm

  • Committer: Bazaar Package Importer
  • Author(s): Peter Van Eynde
  • Date: 2006-05-17 02:46:26 UTC
  • Revision ID: james.westby@ubuntu.com-20060517024626-lljr08ftv9g9vefl
Tags: upstream-0.9h-20060510
ImportĀ upstreamĀ versionĀ 0.9h-20060510

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
%include "..\..\x86i.inc" 
 
24
 
 
25
%define       REG_AAAAAAAAAAAAAAAA    mm7
 
26
%define       REG_3333333333333333    mm6
 
27
%define       REG_0F0F0F0F0F0F0F0F    mm5
 
28
%define       REG_0000000000000000    mm4
 
29
 
 
30
%ifndef PIC
 
31
        section .data
 
32
        align   8
 
33
 
 
34
Lrodata_AAAAAAAAAAAAAAAA: 
 
35
    dd      0xAAAAAAAA
 
36
    dd      0xAAAAAAAA
 
37
 
 
38
Lrodata_3333333333333333: 
 
39
    dd      0x33333333
 
40
    dd      0x33333333
 
41
 
 
42
Lrodata_0F0F0F0F0F0F0F0F: 
 
43
    dd      0x0F0F0F0F
 
44
    dd      0x0F0F0F0F
 
45
%endif
 
46
 
 
47
%macro  ph_fun 1
 
48
        mov             ecx,[PARAM_SIZE]
 
49
        mov             eax,[PARAM_SRC]
 
50
%ifdef  PIC
 
51
        mov             edx,0xAAAAAAAA
 
52
        movd    mm7,edx
 
53
        punpckldq mm7,mm7
 
54
        mov             edx,0x33333333
 
55
        movd    mm6,edx
 
56
        punpckldq mm6,mm6
 
57
        mov             edx,0x0F0F0F0F
 
58
        movd    mm5,edx
 
59
        punpckldq mm5,mm5
 
60
%else
 
61
        movq    mm7,[Lrodata_AAAAAAAAAAAAAAAA]
 
62
        movq    mm6,[Lrodata_3333333333333333]
 
63
        movq    mm5,[Lrodata_0F0F0F0F0F0F0F0F]
 
64
%endif
 
65
 
 
66
%if     %1 == 1
 
67
        mov     edx,[PARAM_SRC2]
 
68
%endif
 
69
        pxor    mm4,mm4
 
70
        pxor    mm0,mm0
 
71
        sub             ecx,1
 
72
        ja              %%Ltop
 
73
 
 
74
%%Llast:
 
75
        movd    mm1,[eax+ecx*4]
 
76
%if     %1 == 1
 
77
        movd    mm2,[edx+ecx*4]
 
78
        pxor    mm1,mm2
 
79
%endif
 
80
        jmp     %%Lloaded
 
81
 
 
82
%%Ltop:
 
83
        movd    mm1,[eax]
 
84
        movd    mm2,[4+eax]
 
85
        punpckldq mm1,mm2
 
86
        add             eax,8
 
87
%if %1 == 1     
 
88
        movd    mm2,[edx]
 
89
        movd    mm3,[4+edx]
 
90
        punpckldq mm2,mm3
 
91
        pxor    mm1,mm2
 
92
        add             edx,8
 
93
%endif
 
94
 
 
95
%%Lloaded:
 
96
        movq    mm2,REG_AAAAAAAAAAAAAAAA
 
97
        pand    mm2,mm1
 
98
        psrlq   mm2,1
 
99
        psubd   mm1,mm2
 
100
        movq    mm2,REG_3333333333333333
 
101
        pand    mm2,mm1
 
102
        psrlq   mm1,2
 
103
        pand    mm1,REG_3333333333333333
 
104
        paddd   mm1,mm2
 
105
 
 
106
        movq    mm2,REG_0F0F0F0F0F0F0F0F
 
107
        pand    mm2,mm1
 
108
        psrlq   mm1,4
 
109
        pand    mm1,mm2
 
110
        paddd   mm1,mm2
 
111
 
 
112
        psadbw  mm1,REG_0000000000000000
 
113
        paddd   mm0,mm1
 
114
 
 
115
        sub             ecx,2
 
116
        jg              %%Ltop
 
117
        jz              %%Llast
 
118
 
 
119
        movd    eax,mm0
 
120
        emms
 
121
        ret
 
122
%endmacro
 
123
 
 
124
        section .text
 
125
        
 
126
%define PARAM_SIZE  esp+frame+8 
 
127
%define PARAM_SRC   esp+frame+4 
 
128
%define frame           0
 
129
 
 
130
        global  ___gmpn_popcount
 
131
%ifdef  DLL
 
132
        export  ___gmpn_popcount
 
133
%endif
 
134
 
 
135
        align   16
 
136
___gmpn_popcount:
 
137
        ph_fun  0
 
138
 
 
139
%define PARAM_SIZE  esp+frame+12 
 
140
%define PARAM_SRC2  esp+frame+8 
 
141
%define PARAM_SRC   esp+frame+4 
 
142
%define frame           0
 
143
 
 
144
        global  ___gmpn_hamdist
 
145
%ifdef  DLL
 
146
        export  ___gmpn_hamdist
 
147
%endif
 
148
 
 
149
        align   16
 
150
___gmpn_hamdist:
 
151
        ph_fun  1
 
152
 
 
153
        end