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