Don't shadow.
[openssl.git] / crypto / bn / asm / x86-bsdi.s
1         .file   "bn_mulw.c"
2         .version        "01.01"
3 gcc2_compiled.:
4 .text
5         .align 4
6 .globl _bn_mul_add_word
7 _bn_mul_add_word:
8         pushl %ebp
9         pushl %edi
10         pushl %esi
11         pushl %ebx
12
13         # ax            L(t)
14         # dx            H(t)
15         # bx            a
16         # cx            w
17         # di            r
18         # si            c
19         # bp            num
20         xorl %esi,%esi          # c=0
21         movl 20(%esp),%edi      # r => edi
22         movl 24(%esp),%ebx      # a => exb
23         movl 32(%esp),%ecx      # w => ecx
24         movl 28(%esp),%ebp      # num => ebp
25
26         shrl $2,%ebp            # num/4
27         je .L910
28
29 #       .align 4
30 .L110:
31         # Round 1
32         movl %ecx,%eax          # w => eax
33         mull (%ebx)             # w * *a 
34         addl (%edi),%eax        # *r+=L(t)
35         adcl $0,%edx            # H(t)+= carry
36         addl %esi,%eax          # L(t)+=c
37         adcl $0,%edx            # H(t)+=carry
38         movl %eax,(%edi)        # *r+=L(t)
39         movl %edx,%esi          # c=H(t)
40
41         # Round 2
42         movl %ecx,%eax          # w => eax
43         mull 4(%ebx)            # w * *a 
44         addl 4(%edi),%eax       # *r+=L(t)
45         adcl $0,%edx            # H(t)+= carry
46         addl %esi,%eax          # L(t)+=c
47         adcl $0,%edx            # H(t)+=carry
48         movl %eax,4(%edi)       # *r+=L(t)
49         movl %edx,%esi          # c=H(t)
50
51         # Round 3
52         movl %ecx,%eax          # w => eax
53         mull 8(%ebx)            # w * *a 
54         addl 8(%edi),%eax       # *r+=L(t)
55         adcl $0,%edx            # H(t)+=carry
56         addl %esi,%eax          # L(t)+=c
57         adcl $0,%edx            # H(t)+=carry
58         movl %eax,8(%edi)       # *r+=L(t)
59         movl %edx,%esi          # c=H(t)
60
61         # Round 4
62         movl %ecx,%eax          # w => eax
63         mull 12(%ebx)           # w * *a 
64         addl 12(%edi),%eax      # *r+=L(t)
65         adcl $0,%edx            # H(t)+=carry
66         addl %esi,%eax          # L(t)+=c
67         adcl $0,%edx            # H(t)+=carry
68         movl %eax,12(%edi)      # *r+=L(t)
69         movl %edx,%esi          # c=H(t)
70
71         addl $16,%ebx           # a+=4 (4 words)
72         addl $16,%edi           # r+=4 (4 words)
73
74         decl %ebp               # --num
75         je .L910
76         jmp .L110
77 #       .align 4
78 .L910:
79         movl 28(%esp),%ebp      # num => ebp
80         andl $3,%ebp
81         je .L111
82
83         # Round 1
84         movl %ecx,%eax          # w => eax
85         mull (%ebx)             # w * *a 
86         addl (%edi),%eax        # *r+=L(t)
87         adcl $0,%edx            # H(t)+=carry
88         addl %esi,%eax          # L(t)+=c
89         adcl $0,%edx            # H(t)+=carry
90         movl %eax,(%edi)        # *r+=L(t)
91         movl %edx,%esi          # c=H(t)
92         decl %ebp               # --num
93         je .L111
94
95         # Round 2
96         movl %ecx,%eax          # w => eax
97         mull 4(%ebx)            # w * *a 
98         addl 4(%edi),%eax       # *r+=L(t)
99         adcl $0,%edx            # H(t)+=carry
100         addl %esi,%eax          # L(t)+=c
101         adcl $0,%edx            # H(t)+=carry
102         movl %eax,4(%edi)       # *r+=L(t)
103         movl %edx,%esi          # c=H(t)
104         decl %ebp               # --num
105         je .L111
106
107         # Round 3
108         movl %ecx,%eax          # w => eax
109         mull 8(%ebx)            # w * *a 
110         addl 8(%edi),%eax       # *r+=L(t)
111         adcl $0,%edx            # H(t)+=carry
112         addl %esi,%eax          # L(t)+=c
113         adcl $0,%edx            # H(t)+=carry
114         movl %eax,8(%edi)       # *r+=L(t)
115         movl %edx,%esi          # c=H(t)
116
117 #       .align 4
118 .L111:
119         movl %esi,%eax          # return(c)
120         popl %ebx
121         popl %esi
122         popl %edi
123         popl %ebp
124         ret
125 .Lfe1:
126         .align 4
127 .globl _bn_mul_word
128 _bn_mul_word:
129         pushl %ebp
130         pushl %edi
131         pushl %esi
132         pushl %ebx
133
134         # ax            L(t)
135         # dx            H(t)
136         # bx            a
137         # cx            w
138         # di            r
139         # num           bp
140         # si            c
141         xorl %esi,%esi          # c=0
142         movl 20(%esp),%edi      # r => edi
143         movl 24(%esp),%ebx      # a => exb
144         movl 28(%esp),%ebp      # num => bp
145         movl 32(%esp),%ecx      # w => ecx
146
147 #       .align 4
148 .L210:
149         movl %ecx,%eax          # w => eax
150         mull (%ebx)             # w * *a 
151         addl %esi,%eax          # L(t)+=c
152         adcl $0,%edx            # H(t)+=carry
153         movl %eax,(%edi)        # *r=L(t)
154         movl %edx,%esi          # c=H(t)
155         decl %ebp               # --num
156         je .L211
157
158         movl %ecx,%eax          # w => eax
159         mull 4(%ebx)            # w * *a 
160         addl %esi,%eax          # L(t)+=c
161         adcl $0,%edx            # H(t)+=carry
162         movl %eax,4(%edi)       # *r=L(t)
163         movl %edx,%esi          # c=H(t)
164         decl %ebp               # --num
165         je .L211
166
167         movl %ecx,%eax          # w => eax
168         mull 8(%ebx)            # w * *a 
169         addl %esi,%eax          # L(t)+=c
170         adcl $0,%edx            # H(t)+=carry
171         movl %eax,8(%edi)       # *r=L(t)
172         movl %edx,%esi          # c=H(t)
173         decl %ebp               # --num
174         je .L211
175
176         movl %ecx,%eax          # w => eax
177         mull 12(%ebx)           # w * *a 
178         addl %esi,%eax          # L(t)+=c
179         adcl $0,%edx            # H(t)+=carry
180         movl %eax,12(%edi)      # *r=L(t)
181         movl %edx,%esi          # c=H(t)
182         decl %ebp               # --num
183         je .L211
184
185         addl $16,%ebx           # a+=4 (4 words)
186         addl $16,%edi           # r+=4 (4 words)
187
188         jmp .L210
189 #       .align 4
190 .L211:
191         movl %esi,%eax          # return(c)
192         popl %ebx
193         popl %esi
194         popl %edi
195         popl %ebp
196         ret
197 .Lfe2:
198         .align 4
199 .globl _bn_sqr_words
200 _bn_sqr_words:
201         pushl %edi
202         pushl %esi
203         pushl %ebx
204         movl 16(%esp),%esi      # r
205         movl 20(%esp),%edi      # a
206         movl 24(%esp),%ebx      # n
207 #       .align 4
208         shrl $2,%ebx
209         jz .L99
210 .L28:
211         movl (%edi),%eax        # get a
212         mull %eax               # a*a
213         movl %eax,(%esi)        # put low into return addr
214         movl %edx,4(%esi)       # put high into return addr
215
216         movl 4(%edi),%eax       # get a
217         mull %eax               # a*a
218         movl %eax,8(%esi)       # put low into return addr
219         movl %edx,12(%esi)      # put high into return addr
220
221         movl 8(%edi),%eax       # get a
222         mull %eax               # a*a
223         movl %eax,16(%esi)      # put low into return addr
224         movl %edx,20(%esi)      # put high into return addr
225
226         movl 12(%edi),%eax      # get a
227         mull %eax               # a*a
228         movl %eax,24(%esi)      # put low into return addr
229         movl %edx,28(%esi)      # put high into return addr
230
231         addl $16,%edi
232         addl $32,%esi
233         decl %ebx               # n-=4;
234         jz .L99
235         jmp .L28
236 #       .align 4
237 .L99:
238         movl 24(%esp),%ebx      # n
239         andl $3,%ebx
240         jz .L29
241         movl (%edi),%eax        # get a
242         mull %eax               # a*a
243         movl %eax,(%esi)        # put low into return addr
244         movl %edx,4(%esi)       # put high into return addr
245         decl %ebx               # n--;
246         jz .L29
247         movl 4(%edi),%eax       # get a
248         mull %eax               # a*a
249         movl %eax,8(%esi)       # put low into return addr
250         movl %edx,12(%esi)      # put high into return addr
251         decl %ebx               # n--;
252         jz .L29
253         movl 8(%edi),%eax       # get a
254         mull %eax               # a*a
255         movl %eax,16(%esi)      # put low into return addr
256         movl %edx,20(%esi)      # put high into return addr
257
258 .L29:
259         popl %ebx
260         popl %esi
261         popl %edi
262         ret
263 .Lfe3:
264         .align 4
265 .globl _bn_div64
266 _bn_div64:
267         movl 4(%esp),%edx       # a
268         movl 8(%esp),%eax       # b
269         divl 12(%esp)           # ab/c
270         ret
271 .Lfe4:
272         .ident  "GCC: (GNU) 2.6.3"