1 | %ifidn __OUTPUT_FORMAT__,obj
|
---|
2 | section code use32 class=code align=64
|
---|
3 | %elifidn __OUTPUT_FORMAT__,win32
|
---|
4 | section .text code align=64
|
---|
5 | %else
|
---|
6 | section .text code
|
---|
7 | %endif
|
---|
8 | global _bn_mul_comba8
|
---|
9 | align 16
|
---|
10 | _bn_mul_comba8:
|
---|
11 | L$_bn_mul_comba8_begin:
|
---|
12 | push esi
|
---|
13 | mov esi,DWORD [12+esp]
|
---|
14 | push edi
|
---|
15 | mov edi,DWORD [20+esp]
|
---|
16 | push ebp
|
---|
17 | push ebx
|
---|
18 | xor ebx,ebx
|
---|
19 | mov eax,DWORD [esi]
|
---|
20 | xor ecx,ecx
|
---|
21 | mov edx,DWORD [edi]
|
---|
22 | ; ################## Calculate word 0
|
---|
23 | xor ebp,ebp
|
---|
24 | ; mul a[0]*b[0]
|
---|
25 | mul edx
|
---|
26 | add ebx,eax
|
---|
27 | mov eax,DWORD [20+esp]
|
---|
28 | adc ecx,edx
|
---|
29 | mov edx,DWORD [edi]
|
---|
30 | adc ebp,0
|
---|
31 | mov DWORD [eax],ebx
|
---|
32 | mov eax,DWORD [4+esi]
|
---|
33 | ; saved r[0]
|
---|
34 | ; ################## Calculate word 1
|
---|
35 | xor ebx,ebx
|
---|
36 | ; mul a[1]*b[0]
|
---|
37 | mul edx
|
---|
38 | add ecx,eax
|
---|
39 | mov eax,DWORD [esi]
|
---|
40 | adc ebp,edx
|
---|
41 | mov edx,DWORD [4+edi]
|
---|
42 | adc ebx,0
|
---|
43 | ; mul a[0]*b[1]
|
---|
44 | mul edx
|
---|
45 | add ecx,eax
|
---|
46 | mov eax,DWORD [20+esp]
|
---|
47 | adc ebp,edx
|
---|
48 | mov edx,DWORD [edi]
|
---|
49 | adc ebx,0
|
---|
50 | mov DWORD [4+eax],ecx
|
---|
51 | mov eax,DWORD [8+esi]
|
---|
52 | ; saved r[1]
|
---|
53 | ; ################## Calculate word 2
|
---|
54 | xor ecx,ecx
|
---|
55 | ; mul a[2]*b[0]
|
---|
56 | mul edx
|
---|
57 | add ebp,eax
|
---|
58 | mov eax,DWORD [4+esi]
|
---|
59 | adc ebx,edx
|
---|
60 | mov edx,DWORD [4+edi]
|
---|
61 | adc ecx,0
|
---|
62 | ; mul a[1]*b[1]
|
---|
63 | mul edx
|
---|
64 | add ebp,eax
|
---|
65 | mov eax,DWORD [esi]
|
---|
66 | adc ebx,edx
|
---|
67 | mov edx,DWORD [8+edi]
|
---|
68 | adc ecx,0
|
---|
69 | ; mul a[0]*b[2]
|
---|
70 | mul edx
|
---|
71 | add ebp,eax
|
---|
72 | mov eax,DWORD [20+esp]
|
---|
73 | adc ebx,edx
|
---|
74 | mov edx,DWORD [edi]
|
---|
75 | adc ecx,0
|
---|
76 | mov DWORD [8+eax],ebp
|
---|
77 | mov eax,DWORD [12+esi]
|
---|
78 | ; saved r[2]
|
---|
79 | ; ################## Calculate word 3
|
---|
80 | xor ebp,ebp
|
---|
81 | ; mul a[3]*b[0]
|
---|
82 | mul edx
|
---|
83 | add ebx,eax
|
---|
84 | mov eax,DWORD [8+esi]
|
---|
85 | adc ecx,edx
|
---|
86 | mov edx,DWORD [4+edi]
|
---|
87 | adc ebp,0
|
---|
88 | ; mul a[2]*b[1]
|
---|
89 | mul edx
|
---|
90 | add ebx,eax
|
---|
91 | mov eax,DWORD [4+esi]
|
---|
92 | adc ecx,edx
|
---|
93 | mov edx,DWORD [8+edi]
|
---|
94 | adc ebp,0
|
---|
95 | ; mul a[1]*b[2]
|
---|
96 | mul edx
|
---|
97 | add ebx,eax
|
---|
98 | mov eax,DWORD [esi]
|
---|
99 | adc ecx,edx
|
---|
100 | mov edx,DWORD [12+edi]
|
---|
101 | adc ebp,0
|
---|
102 | ; mul a[0]*b[3]
|
---|
103 | mul edx
|
---|
104 | add ebx,eax
|
---|
105 | mov eax,DWORD [20+esp]
|
---|
106 | adc ecx,edx
|
---|
107 | mov edx,DWORD [edi]
|
---|
108 | adc ebp,0
|
---|
109 | mov DWORD [12+eax],ebx
|
---|
110 | mov eax,DWORD [16+esi]
|
---|
111 | ; saved r[3]
|
---|
112 | ; ################## Calculate word 4
|
---|
113 | xor ebx,ebx
|
---|
114 | ; mul a[4]*b[0]
|
---|
115 | mul edx
|
---|
116 | add ecx,eax
|
---|
117 | mov eax,DWORD [12+esi]
|
---|
118 | adc ebp,edx
|
---|
119 | mov edx,DWORD [4+edi]
|
---|
120 | adc ebx,0
|
---|
121 | ; mul a[3]*b[1]
|
---|
122 | mul edx
|
---|
123 | add ecx,eax
|
---|
124 | mov eax,DWORD [8+esi]
|
---|
125 | adc ebp,edx
|
---|
126 | mov edx,DWORD [8+edi]
|
---|
127 | adc ebx,0
|
---|
128 | ; mul a[2]*b[2]
|
---|
129 | mul edx
|
---|
130 | add ecx,eax
|
---|
131 | mov eax,DWORD [4+esi]
|
---|
132 | adc ebp,edx
|
---|
133 | mov edx,DWORD [12+edi]
|
---|
134 | adc ebx,0
|
---|
135 | ; mul a[1]*b[3]
|
---|
136 | mul edx
|
---|
137 | add ecx,eax
|
---|
138 | mov eax,DWORD [esi]
|
---|
139 | adc ebp,edx
|
---|
140 | mov edx,DWORD [16+edi]
|
---|
141 | adc ebx,0
|
---|
142 | ; mul a[0]*b[4]
|
---|
143 | mul edx
|
---|
144 | add ecx,eax
|
---|
145 | mov eax,DWORD [20+esp]
|
---|
146 | adc ebp,edx
|
---|
147 | mov edx,DWORD [edi]
|
---|
148 | adc ebx,0
|
---|
149 | mov DWORD [16+eax],ecx
|
---|
150 | mov eax,DWORD [20+esi]
|
---|
151 | ; saved r[4]
|
---|
152 | ; ################## Calculate word 5
|
---|
153 | xor ecx,ecx
|
---|
154 | ; mul a[5]*b[0]
|
---|
155 | mul edx
|
---|
156 | add ebp,eax
|
---|
157 | mov eax,DWORD [16+esi]
|
---|
158 | adc ebx,edx
|
---|
159 | mov edx,DWORD [4+edi]
|
---|
160 | adc ecx,0
|
---|
161 | ; mul a[4]*b[1]
|
---|
162 | mul edx
|
---|
163 | add ebp,eax
|
---|
164 | mov eax,DWORD [12+esi]
|
---|
165 | adc ebx,edx
|
---|
166 | mov edx,DWORD [8+edi]
|
---|
167 | adc ecx,0
|
---|
168 | ; mul a[3]*b[2]
|
---|
169 | mul edx
|
---|
170 | add ebp,eax
|
---|
171 | mov eax,DWORD [8+esi]
|
---|
172 | adc ebx,edx
|
---|
173 | mov edx,DWORD [12+edi]
|
---|
174 | adc ecx,0
|
---|
175 | ; mul a[2]*b[3]
|
---|
176 | mul edx
|
---|
177 | add ebp,eax
|
---|
178 | mov eax,DWORD [4+esi]
|
---|
179 | adc ebx,edx
|
---|
180 | mov edx,DWORD [16+edi]
|
---|
181 | adc ecx,0
|
---|
182 | ; mul a[1]*b[4]
|
---|
183 | mul edx
|
---|
184 | add ebp,eax
|
---|
185 | mov eax,DWORD [esi]
|
---|
186 | adc ebx,edx
|
---|
187 | mov edx,DWORD [20+edi]
|
---|
188 | adc ecx,0
|
---|
189 | ; mul a[0]*b[5]
|
---|
190 | mul edx
|
---|
191 | add ebp,eax
|
---|
192 | mov eax,DWORD [20+esp]
|
---|
193 | adc ebx,edx
|
---|
194 | mov edx,DWORD [edi]
|
---|
195 | adc ecx,0
|
---|
196 | mov DWORD [20+eax],ebp
|
---|
197 | mov eax,DWORD [24+esi]
|
---|
198 | ; saved r[5]
|
---|
199 | ; ################## Calculate word 6
|
---|
200 | xor ebp,ebp
|
---|
201 | ; mul a[6]*b[0]
|
---|
202 | mul edx
|
---|
203 | add ebx,eax
|
---|
204 | mov eax,DWORD [20+esi]
|
---|
205 | adc ecx,edx
|
---|
206 | mov edx,DWORD [4+edi]
|
---|
207 | adc ebp,0
|
---|
208 | ; mul a[5]*b[1]
|
---|
209 | mul edx
|
---|
210 | add ebx,eax
|
---|
211 | mov eax,DWORD [16+esi]
|
---|
212 | adc ecx,edx
|
---|
213 | mov edx,DWORD [8+edi]
|
---|
214 | adc ebp,0
|
---|
215 | ; mul a[4]*b[2]
|
---|
216 | mul edx
|
---|
217 | add ebx,eax
|
---|
218 | mov eax,DWORD [12+esi]
|
---|
219 | adc ecx,edx
|
---|
220 | mov edx,DWORD [12+edi]
|
---|
221 | adc ebp,0
|
---|
222 | ; mul a[3]*b[3]
|
---|
223 | mul edx
|
---|
224 | add ebx,eax
|
---|
225 | mov eax,DWORD [8+esi]
|
---|
226 | adc ecx,edx
|
---|
227 | mov edx,DWORD [16+edi]
|
---|
228 | adc ebp,0
|
---|
229 | ; mul a[2]*b[4]
|
---|
230 | mul edx
|
---|
231 | add ebx,eax
|
---|
232 | mov eax,DWORD [4+esi]
|
---|
233 | adc ecx,edx
|
---|
234 | mov edx,DWORD [20+edi]
|
---|
235 | adc ebp,0
|
---|
236 | ; mul a[1]*b[5]
|
---|
237 | mul edx
|
---|
238 | add ebx,eax
|
---|
239 | mov eax,DWORD [esi]
|
---|
240 | adc ecx,edx
|
---|
241 | mov edx,DWORD [24+edi]
|
---|
242 | adc ebp,0
|
---|
243 | ; mul a[0]*b[6]
|
---|
244 | mul edx
|
---|
245 | add ebx,eax
|
---|
246 | mov eax,DWORD [20+esp]
|
---|
247 | adc ecx,edx
|
---|
248 | mov edx,DWORD [edi]
|
---|
249 | adc ebp,0
|
---|
250 | mov DWORD [24+eax],ebx
|
---|
251 | mov eax,DWORD [28+esi]
|
---|
252 | ; saved r[6]
|
---|
253 | ; ################## Calculate word 7
|
---|
254 | xor ebx,ebx
|
---|
255 | ; mul a[7]*b[0]
|
---|
256 | mul edx
|
---|
257 | add ecx,eax
|
---|
258 | mov eax,DWORD [24+esi]
|
---|
259 | adc ebp,edx
|
---|
260 | mov edx,DWORD [4+edi]
|
---|
261 | adc ebx,0
|
---|
262 | ; mul a[6]*b[1]
|
---|
263 | mul edx
|
---|
264 | add ecx,eax
|
---|
265 | mov eax,DWORD [20+esi]
|
---|
266 | adc ebp,edx
|
---|
267 | mov edx,DWORD [8+edi]
|
---|
268 | adc ebx,0
|
---|
269 | ; mul a[5]*b[2]
|
---|
270 | mul edx
|
---|
271 | add ecx,eax
|
---|
272 | mov eax,DWORD [16+esi]
|
---|
273 | adc ebp,edx
|
---|
274 | mov edx,DWORD [12+edi]
|
---|
275 | adc ebx,0
|
---|
276 | ; mul a[4]*b[3]
|
---|
277 | mul edx
|
---|
278 | add ecx,eax
|
---|
279 | mov eax,DWORD [12+esi]
|
---|
280 | adc ebp,edx
|
---|
281 | mov edx,DWORD [16+edi]
|
---|
282 | adc ebx,0
|
---|
283 | ; mul a[3]*b[4]
|
---|
284 | mul edx
|
---|
285 | add ecx,eax
|
---|
286 | mov eax,DWORD [8+esi]
|
---|
287 | adc ebp,edx
|
---|
288 | mov edx,DWORD [20+edi]
|
---|
289 | adc ebx,0
|
---|
290 | ; mul a[2]*b[5]
|
---|
291 | mul edx
|
---|
292 | add ecx,eax
|
---|
293 | mov eax,DWORD [4+esi]
|
---|
294 | adc ebp,edx
|
---|
295 | mov edx,DWORD [24+edi]
|
---|
296 | adc ebx,0
|
---|
297 | ; mul a[1]*b[6]
|
---|
298 | mul edx
|
---|
299 | add ecx,eax
|
---|
300 | mov eax,DWORD [esi]
|
---|
301 | adc ebp,edx
|
---|
302 | mov edx,DWORD [28+edi]
|
---|
303 | adc ebx,0
|
---|
304 | ; mul a[0]*b[7]
|
---|
305 | mul edx
|
---|
306 | add ecx,eax
|
---|
307 | mov eax,DWORD [20+esp]
|
---|
308 | adc ebp,edx
|
---|
309 | mov edx,DWORD [4+edi]
|
---|
310 | adc ebx,0
|
---|
311 | mov DWORD [28+eax],ecx
|
---|
312 | mov eax,DWORD [28+esi]
|
---|
313 | ; saved r[7]
|
---|
314 | ; ################## Calculate word 8
|
---|
315 | xor ecx,ecx
|
---|
316 | ; mul a[7]*b[1]
|
---|
317 | mul edx
|
---|
318 | add ebp,eax
|
---|
319 | mov eax,DWORD [24+esi]
|
---|
320 | adc ebx,edx
|
---|
321 | mov edx,DWORD [8+edi]
|
---|
322 | adc ecx,0
|
---|
323 | ; mul a[6]*b[2]
|
---|
324 | mul edx
|
---|
325 | add ebp,eax
|
---|
326 | mov eax,DWORD [20+esi]
|
---|
327 | adc ebx,edx
|
---|
328 | mov edx,DWORD [12+edi]
|
---|
329 | adc ecx,0
|
---|
330 | ; mul a[5]*b[3]
|
---|
331 | mul edx
|
---|
332 | add ebp,eax
|
---|
333 | mov eax,DWORD [16+esi]
|
---|
334 | adc ebx,edx
|
---|
335 | mov edx,DWORD [16+edi]
|
---|
336 | adc ecx,0
|
---|
337 | ; mul a[4]*b[4]
|
---|
338 | mul edx
|
---|
339 | add ebp,eax
|
---|
340 | mov eax,DWORD [12+esi]
|
---|
341 | adc ebx,edx
|
---|
342 | mov edx,DWORD [20+edi]
|
---|
343 | adc ecx,0
|
---|
344 | ; mul a[3]*b[5]
|
---|
345 | mul edx
|
---|
346 | add ebp,eax
|
---|
347 | mov eax,DWORD [8+esi]
|
---|
348 | adc ebx,edx
|
---|
349 | mov edx,DWORD [24+edi]
|
---|
350 | adc ecx,0
|
---|
351 | ; mul a[2]*b[6]
|
---|
352 | mul edx
|
---|
353 | add ebp,eax
|
---|
354 | mov eax,DWORD [4+esi]
|
---|
355 | adc ebx,edx
|
---|
356 | mov edx,DWORD [28+edi]
|
---|
357 | adc ecx,0
|
---|
358 | ; mul a[1]*b[7]
|
---|
359 | mul edx
|
---|
360 | add ebp,eax
|
---|
361 | mov eax,DWORD [20+esp]
|
---|
362 | adc ebx,edx
|
---|
363 | mov edx,DWORD [8+edi]
|
---|
364 | adc ecx,0
|
---|
365 | mov DWORD [32+eax],ebp
|
---|
366 | mov eax,DWORD [28+esi]
|
---|
367 | ; saved r[8]
|
---|
368 | ; ################## Calculate word 9
|
---|
369 | xor ebp,ebp
|
---|
370 | ; mul a[7]*b[2]
|
---|
371 | mul edx
|
---|
372 | add ebx,eax
|
---|
373 | mov eax,DWORD [24+esi]
|
---|
374 | adc ecx,edx
|
---|
375 | mov edx,DWORD [12+edi]
|
---|
376 | adc ebp,0
|
---|
377 | ; mul a[6]*b[3]
|
---|
378 | mul edx
|
---|
379 | add ebx,eax
|
---|
380 | mov eax,DWORD [20+esi]
|
---|
381 | adc ecx,edx
|
---|
382 | mov edx,DWORD [16+edi]
|
---|
383 | adc ebp,0
|
---|
384 | ; mul a[5]*b[4]
|
---|
385 | mul edx
|
---|
386 | add ebx,eax
|
---|
387 | mov eax,DWORD [16+esi]
|
---|
388 | adc ecx,edx
|
---|
389 | mov edx,DWORD [20+edi]
|
---|
390 | adc ebp,0
|
---|
391 | ; mul a[4]*b[5]
|
---|
392 | mul edx
|
---|
393 | add ebx,eax
|
---|
394 | mov eax,DWORD [12+esi]
|
---|
395 | adc ecx,edx
|
---|
396 | mov edx,DWORD [24+edi]
|
---|
397 | adc ebp,0
|
---|
398 | ; mul a[3]*b[6]
|
---|
399 | mul edx
|
---|
400 | add ebx,eax
|
---|
401 | mov eax,DWORD [8+esi]
|
---|
402 | adc ecx,edx
|
---|
403 | mov edx,DWORD [28+edi]
|
---|
404 | adc ebp,0
|
---|
405 | ; mul a[2]*b[7]
|
---|
406 | mul edx
|
---|
407 | add ebx,eax
|
---|
408 | mov eax,DWORD [20+esp]
|
---|
409 | adc ecx,edx
|
---|
410 | mov edx,DWORD [12+edi]
|
---|
411 | adc ebp,0
|
---|
412 | mov DWORD [36+eax],ebx
|
---|
413 | mov eax,DWORD [28+esi]
|
---|
414 | ; saved r[9]
|
---|
415 | ; ################## Calculate word 10
|
---|
416 | xor ebx,ebx
|
---|
417 | ; mul a[7]*b[3]
|
---|
418 | mul edx
|
---|
419 | add ecx,eax
|
---|
420 | mov eax,DWORD [24+esi]
|
---|
421 | adc ebp,edx
|
---|
422 | mov edx,DWORD [16+edi]
|
---|
423 | adc ebx,0
|
---|
424 | ; mul a[6]*b[4]
|
---|
425 | mul edx
|
---|
426 | add ecx,eax
|
---|
427 | mov eax,DWORD [20+esi]
|
---|
428 | adc ebp,edx
|
---|
429 | mov edx,DWORD [20+edi]
|
---|
430 | adc ebx,0
|
---|
431 | ; mul a[5]*b[5]
|
---|
432 | mul edx
|
---|
433 | add ecx,eax
|
---|
434 | mov eax,DWORD [16+esi]
|
---|
435 | adc ebp,edx
|
---|
436 | mov edx,DWORD [24+edi]
|
---|
437 | adc ebx,0
|
---|
438 | ; mul a[4]*b[6]
|
---|
439 | mul edx
|
---|
440 | add ecx,eax
|
---|
441 | mov eax,DWORD [12+esi]
|
---|
442 | adc ebp,edx
|
---|
443 | mov edx,DWORD [28+edi]
|
---|
444 | adc ebx,0
|
---|
445 | ; mul a[3]*b[7]
|
---|
446 | mul edx
|
---|
447 | add ecx,eax
|
---|
448 | mov eax,DWORD [20+esp]
|
---|
449 | adc ebp,edx
|
---|
450 | mov edx,DWORD [16+edi]
|
---|
451 | adc ebx,0
|
---|
452 | mov DWORD [40+eax],ecx
|
---|
453 | mov eax,DWORD [28+esi]
|
---|
454 | ; saved r[10]
|
---|
455 | ; ################## Calculate word 11
|
---|
456 | xor ecx,ecx
|
---|
457 | ; mul a[7]*b[4]
|
---|
458 | mul edx
|
---|
459 | add ebp,eax
|
---|
460 | mov eax,DWORD [24+esi]
|
---|
461 | adc ebx,edx
|
---|
462 | mov edx,DWORD [20+edi]
|
---|
463 | adc ecx,0
|
---|
464 | ; mul a[6]*b[5]
|
---|
465 | mul edx
|
---|
466 | add ebp,eax
|
---|
467 | mov eax,DWORD [20+esi]
|
---|
468 | adc ebx,edx
|
---|
469 | mov edx,DWORD [24+edi]
|
---|
470 | adc ecx,0
|
---|
471 | ; mul a[5]*b[6]
|
---|
472 | mul edx
|
---|
473 | add ebp,eax
|
---|
474 | mov eax,DWORD [16+esi]
|
---|
475 | adc ebx,edx
|
---|
476 | mov edx,DWORD [28+edi]
|
---|
477 | adc ecx,0
|
---|
478 | ; mul a[4]*b[7]
|
---|
479 | mul edx
|
---|
480 | add ebp,eax
|
---|
481 | mov eax,DWORD [20+esp]
|
---|
482 | adc ebx,edx
|
---|
483 | mov edx,DWORD [20+edi]
|
---|
484 | adc ecx,0
|
---|
485 | mov DWORD [44+eax],ebp
|
---|
486 | mov eax,DWORD [28+esi]
|
---|
487 | ; saved r[11]
|
---|
488 | ; ################## Calculate word 12
|
---|
489 | xor ebp,ebp
|
---|
490 | ; mul a[7]*b[5]
|
---|
491 | mul edx
|
---|
492 | add ebx,eax
|
---|
493 | mov eax,DWORD [24+esi]
|
---|
494 | adc ecx,edx
|
---|
495 | mov edx,DWORD [24+edi]
|
---|
496 | adc ebp,0
|
---|
497 | ; mul a[6]*b[6]
|
---|
498 | mul edx
|
---|
499 | add ebx,eax
|
---|
500 | mov eax,DWORD [20+esi]
|
---|
501 | adc ecx,edx
|
---|
502 | mov edx,DWORD [28+edi]
|
---|
503 | adc ebp,0
|
---|
504 | ; mul a[5]*b[7]
|
---|
505 | mul edx
|
---|
506 | add ebx,eax
|
---|
507 | mov eax,DWORD [20+esp]
|
---|
508 | adc ecx,edx
|
---|
509 | mov edx,DWORD [24+edi]
|
---|
510 | adc ebp,0
|
---|
511 | mov DWORD [48+eax],ebx
|
---|
512 | mov eax,DWORD [28+esi]
|
---|
513 | ; saved r[12]
|
---|
514 | ; ################## Calculate word 13
|
---|
515 | xor ebx,ebx
|
---|
516 | ; mul a[7]*b[6]
|
---|
517 | mul edx
|
---|
518 | add ecx,eax
|
---|
519 | mov eax,DWORD [24+esi]
|
---|
520 | adc ebp,edx
|
---|
521 | mov edx,DWORD [28+edi]
|
---|
522 | adc ebx,0
|
---|
523 | ; mul a[6]*b[7]
|
---|
524 | mul edx
|
---|
525 | add ecx,eax
|
---|
526 | mov eax,DWORD [20+esp]
|
---|
527 | adc ebp,edx
|
---|
528 | mov edx,DWORD [28+edi]
|
---|
529 | adc ebx,0
|
---|
530 | mov DWORD [52+eax],ecx
|
---|
531 | mov eax,DWORD [28+esi]
|
---|
532 | ; saved r[13]
|
---|
533 | ; ################## Calculate word 14
|
---|
534 | xor ecx,ecx
|
---|
535 | ; mul a[7]*b[7]
|
---|
536 | mul edx
|
---|
537 | add ebp,eax
|
---|
538 | mov eax,DWORD [20+esp]
|
---|
539 | adc ebx,edx
|
---|
540 | adc ecx,0
|
---|
541 | mov DWORD [56+eax],ebp
|
---|
542 | ; saved r[14]
|
---|
543 | ; save r[15]
|
---|
544 | mov DWORD [60+eax],ebx
|
---|
545 | pop ebx
|
---|
546 | pop ebp
|
---|
547 | pop edi
|
---|
548 | pop esi
|
---|
549 | ret
|
---|
550 | global _bn_mul_comba4
|
---|
551 | align 16
|
---|
552 | _bn_mul_comba4:
|
---|
553 | L$_bn_mul_comba4_begin:
|
---|
554 | push esi
|
---|
555 | mov esi,DWORD [12+esp]
|
---|
556 | push edi
|
---|
557 | mov edi,DWORD [20+esp]
|
---|
558 | push ebp
|
---|
559 | push ebx
|
---|
560 | xor ebx,ebx
|
---|
561 | mov eax,DWORD [esi]
|
---|
562 | xor ecx,ecx
|
---|
563 | mov edx,DWORD [edi]
|
---|
564 | ; ################## Calculate word 0
|
---|
565 | xor ebp,ebp
|
---|
566 | ; mul a[0]*b[0]
|
---|
567 | mul edx
|
---|
568 | add ebx,eax
|
---|
569 | mov eax,DWORD [20+esp]
|
---|
570 | adc ecx,edx
|
---|
571 | mov edx,DWORD [edi]
|
---|
572 | adc ebp,0
|
---|
573 | mov DWORD [eax],ebx
|
---|
574 | mov eax,DWORD [4+esi]
|
---|
575 | ; saved r[0]
|
---|
576 | ; ################## Calculate word 1
|
---|
577 | xor ebx,ebx
|
---|
578 | ; mul a[1]*b[0]
|
---|
579 | mul edx
|
---|
580 | add ecx,eax
|
---|
581 | mov eax,DWORD [esi]
|
---|
582 | adc ebp,edx
|
---|
583 | mov edx,DWORD [4+edi]
|
---|
584 | adc ebx,0
|
---|
585 | ; mul a[0]*b[1]
|
---|
586 | mul edx
|
---|
587 | add ecx,eax
|
---|
588 | mov eax,DWORD [20+esp]
|
---|
589 | adc ebp,edx
|
---|
590 | mov edx,DWORD [edi]
|
---|
591 | adc ebx,0
|
---|
592 | mov DWORD [4+eax],ecx
|
---|
593 | mov eax,DWORD [8+esi]
|
---|
594 | ; saved r[1]
|
---|
595 | ; ################## Calculate word 2
|
---|
596 | xor ecx,ecx
|
---|
597 | ; mul a[2]*b[0]
|
---|
598 | mul edx
|
---|
599 | add ebp,eax
|
---|
600 | mov eax,DWORD [4+esi]
|
---|
601 | adc ebx,edx
|
---|
602 | mov edx,DWORD [4+edi]
|
---|
603 | adc ecx,0
|
---|
604 | ; mul a[1]*b[1]
|
---|
605 | mul edx
|
---|
606 | add ebp,eax
|
---|
607 | mov eax,DWORD [esi]
|
---|
608 | adc ebx,edx
|
---|
609 | mov edx,DWORD [8+edi]
|
---|
610 | adc ecx,0
|
---|
611 | ; mul a[0]*b[2]
|
---|
612 | mul edx
|
---|
613 | add ebp,eax
|
---|
614 | mov eax,DWORD [20+esp]
|
---|
615 | adc ebx,edx
|
---|
616 | mov edx,DWORD [edi]
|
---|
617 | adc ecx,0
|
---|
618 | mov DWORD [8+eax],ebp
|
---|
619 | mov eax,DWORD [12+esi]
|
---|
620 | ; saved r[2]
|
---|
621 | ; ################## Calculate word 3
|
---|
622 | xor ebp,ebp
|
---|
623 | ; mul a[3]*b[0]
|
---|
624 | mul edx
|
---|
625 | add ebx,eax
|
---|
626 | mov eax,DWORD [8+esi]
|
---|
627 | adc ecx,edx
|
---|
628 | mov edx,DWORD [4+edi]
|
---|
629 | adc ebp,0
|
---|
630 | ; mul a[2]*b[1]
|
---|
631 | mul edx
|
---|
632 | add ebx,eax
|
---|
633 | mov eax,DWORD [4+esi]
|
---|
634 | adc ecx,edx
|
---|
635 | mov edx,DWORD [8+edi]
|
---|
636 | adc ebp,0
|
---|
637 | ; mul a[1]*b[2]
|
---|
638 | mul edx
|
---|
639 | add ebx,eax
|
---|
640 | mov eax,DWORD [esi]
|
---|
641 | adc ecx,edx
|
---|
642 | mov edx,DWORD [12+edi]
|
---|
643 | adc ebp,0
|
---|
644 | ; mul a[0]*b[3]
|
---|
645 | mul edx
|
---|
646 | add ebx,eax
|
---|
647 | mov eax,DWORD [20+esp]
|
---|
648 | adc ecx,edx
|
---|
649 | mov edx,DWORD [4+edi]
|
---|
650 | adc ebp,0
|
---|
651 | mov DWORD [12+eax],ebx
|
---|
652 | mov eax,DWORD [12+esi]
|
---|
653 | ; saved r[3]
|
---|
654 | ; ################## Calculate word 4
|
---|
655 | xor ebx,ebx
|
---|
656 | ; mul a[3]*b[1]
|
---|
657 | mul edx
|
---|
658 | add ecx,eax
|
---|
659 | mov eax,DWORD [8+esi]
|
---|
660 | adc ebp,edx
|
---|
661 | mov edx,DWORD [8+edi]
|
---|
662 | adc ebx,0
|
---|
663 | ; mul a[2]*b[2]
|
---|
664 | mul edx
|
---|
665 | add ecx,eax
|
---|
666 | mov eax,DWORD [4+esi]
|
---|
667 | adc ebp,edx
|
---|
668 | mov edx,DWORD [12+edi]
|
---|
669 | adc ebx,0
|
---|
670 | ; mul a[1]*b[3]
|
---|
671 | mul edx
|
---|
672 | add ecx,eax
|
---|
673 | mov eax,DWORD [20+esp]
|
---|
674 | adc ebp,edx
|
---|
675 | mov edx,DWORD [8+edi]
|
---|
676 | adc ebx,0
|
---|
677 | mov DWORD [16+eax],ecx
|
---|
678 | mov eax,DWORD [12+esi]
|
---|
679 | ; saved r[4]
|
---|
680 | ; ################## Calculate word 5
|
---|
681 | xor ecx,ecx
|
---|
682 | ; mul a[3]*b[2]
|
---|
683 | mul edx
|
---|
684 | add ebp,eax
|
---|
685 | mov eax,DWORD [8+esi]
|
---|
686 | adc ebx,edx
|
---|
687 | mov edx,DWORD [12+edi]
|
---|
688 | adc ecx,0
|
---|
689 | ; mul a[2]*b[3]
|
---|
690 | mul edx
|
---|
691 | add ebp,eax
|
---|
692 | mov eax,DWORD [20+esp]
|
---|
693 | adc ebx,edx
|
---|
694 | mov edx,DWORD [12+edi]
|
---|
695 | adc ecx,0
|
---|
696 | mov DWORD [20+eax],ebp
|
---|
697 | mov eax,DWORD [12+esi]
|
---|
698 | ; saved r[5]
|
---|
699 | ; ################## Calculate word 6
|
---|
700 | xor ebp,ebp
|
---|
701 | ; mul a[3]*b[3]
|
---|
702 | mul edx
|
---|
703 | add ebx,eax
|
---|
704 | mov eax,DWORD [20+esp]
|
---|
705 | adc ecx,edx
|
---|
706 | adc ebp,0
|
---|
707 | mov DWORD [24+eax],ebx
|
---|
708 | ; saved r[6]
|
---|
709 | ; save r[7]
|
---|
710 | mov DWORD [28+eax],ecx
|
---|
711 | pop ebx
|
---|
712 | pop ebp
|
---|
713 | pop edi
|
---|
714 | pop esi
|
---|
715 | ret
|
---|
716 | global _bn_sqr_comba8
|
---|
717 | align 16
|
---|
718 | _bn_sqr_comba8:
|
---|
719 | L$_bn_sqr_comba8_begin:
|
---|
720 | push esi
|
---|
721 | push edi
|
---|
722 | push ebp
|
---|
723 | push ebx
|
---|
724 | mov edi,DWORD [20+esp]
|
---|
725 | mov esi,DWORD [24+esp]
|
---|
726 | xor ebx,ebx
|
---|
727 | xor ecx,ecx
|
---|
728 | mov eax,DWORD [esi]
|
---|
729 | ; ############### Calculate word 0
|
---|
730 | xor ebp,ebp
|
---|
731 | ; sqr a[0]*a[0]
|
---|
732 | mul eax
|
---|
733 | add ebx,eax
|
---|
734 | adc ecx,edx
|
---|
735 | mov edx,DWORD [esi]
|
---|
736 | adc ebp,0
|
---|
737 | mov DWORD [edi],ebx
|
---|
738 | mov eax,DWORD [4+esi]
|
---|
739 | ; saved r[0]
|
---|
740 | ; ############### Calculate word 1
|
---|
741 | xor ebx,ebx
|
---|
742 | ; sqr a[1]*a[0]
|
---|
743 | mul edx
|
---|
744 | add eax,eax
|
---|
745 | adc edx,edx
|
---|
746 | adc ebx,0
|
---|
747 | add ecx,eax
|
---|
748 | adc ebp,edx
|
---|
749 | mov eax,DWORD [8+esi]
|
---|
750 | adc ebx,0
|
---|
751 | mov DWORD [4+edi],ecx
|
---|
752 | mov edx,DWORD [esi]
|
---|
753 | ; saved r[1]
|
---|
754 | ; ############### Calculate word 2
|
---|
755 | xor ecx,ecx
|
---|
756 | ; sqr a[2]*a[0]
|
---|
757 | mul edx
|
---|
758 | add eax,eax
|
---|
759 | adc edx,edx
|
---|
760 | adc ecx,0
|
---|
761 | add ebp,eax
|
---|
762 | adc ebx,edx
|
---|
763 | mov eax,DWORD [4+esi]
|
---|
764 | adc ecx,0
|
---|
765 | ; sqr a[1]*a[1]
|
---|
766 | mul eax
|
---|
767 | add ebp,eax
|
---|
768 | adc ebx,edx
|
---|
769 | mov edx,DWORD [esi]
|
---|
770 | adc ecx,0
|
---|
771 | mov DWORD [8+edi],ebp
|
---|
772 | mov eax,DWORD [12+esi]
|
---|
773 | ; saved r[2]
|
---|
774 | ; ############### Calculate word 3
|
---|
775 | xor ebp,ebp
|
---|
776 | ; sqr a[3]*a[0]
|
---|
777 | mul edx
|
---|
778 | add eax,eax
|
---|
779 | adc edx,edx
|
---|
780 | adc ebp,0
|
---|
781 | add ebx,eax
|
---|
782 | adc ecx,edx
|
---|
783 | mov eax,DWORD [8+esi]
|
---|
784 | adc ebp,0
|
---|
785 | mov edx,DWORD [4+esi]
|
---|
786 | ; sqr a[2]*a[1]
|
---|
787 | mul edx
|
---|
788 | add eax,eax
|
---|
789 | adc edx,edx
|
---|
790 | adc ebp,0
|
---|
791 | add ebx,eax
|
---|
792 | adc ecx,edx
|
---|
793 | mov eax,DWORD [16+esi]
|
---|
794 | adc ebp,0
|
---|
795 | mov DWORD [12+edi],ebx
|
---|
796 | mov edx,DWORD [esi]
|
---|
797 | ; saved r[3]
|
---|
798 | ; ############### Calculate word 4
|
---|
799 | xor ebx,ebx
|
---|
800 | ; sqr a[4]*a[0]
|
---|
801 | mul edx
|
---|
802 | add eax,eax
|
---|
803 | adc edx,edx
|
---|
804 | adc ebx,0
|
---|
805 | add ecx,eax
|
---|
806 | adc ebp,edx
|
---|
807 | mov eax,DWORD [12+esi]
|
---|
808 | adc ebx,0
|
---|
809 | mov edx,DWORD [4+esi]
|
---|
810 | ; sqr a[3]*a[1]
|
---|
811 | mul edx
|
---|
812 | add eax,eax
|
---|
813 | adc edx,edx
|
---|
814 | adc ebx,0
|
---|
815 | add ecx,eax
|
---|
816 | adc ebp,edx
|
---|
817 | mov eax,DWORD [8+esi]
|
---|
818 | adc ebx,0
|
---|
819 | ; sqr a[2]*a[2]
|
---|
820 | mul eax
|
---|
821 | add ecx,eax
|
---|
822 | adc ebp,edx
|
---|
823 | mov edx,DWORD [esi]
|
---|
824 | adc ebx,0
|
---|
825 | mov DWORD [16+edi],ecx
|
---|
826 | mov eax,DWORD [20+esi]
|
---|
827 | ; saved r[4]
|
---|
828 | ; ############### Calculate word 5
|
---|
829 | xor ecx,ecx
|
---|
830 | ; sqr a[5]*a[0]
|
---|
831 | mul edx
|
---|
832 | add eax,eax
|
---|
833 | adc edx,edx
|
---|
834 | adc ecx,0
|
---|
835 | add ebp,eax
|
---|
836 | adc ebx,edx
|
---|
837 | mov eax,DWORD [16+esi]
|
---|
838 | adc ecx,0
|
---|
839 | mov edx,DWORD [4+esi]
|
---|
840 | ; sqr a[4]*a[1]
|
---|
841 | mul edx
|
---|
842 | add eax,eax
|
---|
843 | adc edx,edx
|
---|
844 | adc ecx,0
|
---|
845 | add ebp,eax
|
---|
846 | adc ebx,edx
|
---|
847 | mov eax,DWORD [12+esi]
|
---|
848 | adc ecx,0
|
---|
849 | mov edx,DWORD [8+esi]
|
---|
850 | ; sqr a[3]*a[2]
|
---|
851 | mul edx
|
---|
852 | add eax,eax
|
---|
853 | adc edx,edx
|
---|
854 | adc ecx,0
|
---|
855 | add ebp,eax
|
---|
856 | adc ebx,edx
|
---|
857 | mov eax,DWORD [24+esi]
|
---|
858 | adc ecx,0
|
---|
859 | mov DWORD [20+edi],ebp
|
---|
860 | mov edx,DWORD [esi]
|
---|
861 | ; saved r[5]
|
---|
862 | ; ############### Calculate word 6
|
---|
863 | xor ebp,ebp
|
---|
864 | ; sqr a[6]*a[0]
|
---|
865 | mul edx
|
---|
866 | add eax,eax
|
---|
867 | adc edx,edx
|
---|
868 | adc ebp,0
|
---|
869 | add ebx,eax
|
---|
870 | adc ecx,edx
|
---|
871 | mov eax,DWORD [20+esi]
|
---|
872 | adc ebp,0
|
---|
873 | mov edx,DWORD [4+esi]
|
---|
874 | ; sqr a[5]*a[1]
|
---|
875 | mul edx
|
---|
876 | add eax,eax
|
---|
877 | adc edx,edx
|
---|
878 | adc ebp,0
|
---|
879 | add ebx,eax
|
---|
880 | adc ecx,edx
|
---|
881 | mov eax,DWORD [16+esi]
|
---|
882 | adc ebp,0
|
---|
883 | mov edx,DWORD [8+esi]
|
---|
884 | ; sqr a[4]*a[2]
|
---|
885 | mul edx
|
---|
886 | add eax,eax
|
---|
887 | adc edx,edx
|
---|
888 | adc ebp,0
|
---|
889 | add ebx,eax
|
---|
890 | adc ecx,edx
|
---|
891 | mov eax,DWORD [12+esi]
|
---|
892 | adc ebp,0
|
---|
893 | ; sqr a[3]*a[3]
|
---|
894 | mul eax
|
---|
895 | add ebx,eax
|
---|
896 | adc ecx,edx
|
---|
897 | mov edx,DWORD [esi]
|
---|
898 | adc ebp,0
|
---|
899 | mov DWORD [24+edi],ebx
|
---|
900 | mov eax,DWORD [28+esi]
|
---|
901 | ; saved r[6]
|
---|
902 | ; ############### Calculate word 7
|
---|
903 | xor ebx,ebx
|
---|
904 | ; sqr a[7]*a[0]
|
---|
905 | mul edx
|
---|
906 | add eax,eax
|
---|
907 | adc edx,edx
|
---|
908 | adc ebx,0
|
---|
909 | add ecx,eax
|
---|
910 | adc ebp,edx
|
---|
911 | mov eax,DWORD [24+esi]
|
---|
912 | adc ebx,0
|
---|
913 | mov edx,DWORD [4+esi]
|
---|
914 | ; sqr a[6]*a[1]
|
---|
915 | mul edx
|
---|
916 | add eax,eax
|
---|
917 | adc edx,edx
|
---|
918 | adc ebx,0
|
---|
919 | add ecx,eax
|
---|
920 | adc ebp,edx
|
---|
921 | mov eax,DWORD [20+esi]
|
---|
922 | adc ebx,0
|
---|
923 | mov edx,DWORD [8+esi]
|
---|
924 | ; sqr a[5]*a[2]
|
---|
925 | mul edx
|
---|
926 | add eax,eax
|
---|
927 | adc edx,edx
|
---|
928 | adc ebx,0
|
---|
929 | add ecx,eax
|
---|
930 | adc ebp,edx
|
---|
931 | mov eax,DWORD [16+esi]
|
---|
932 | adc ebx,0
|
---|
933 | mov edx,DWORD [12+esi]
|
---|
934 | ; sqr a[4]*a[3]
|
---|
935 | mul edx
|
---|
936 | add eax,eax
|
---|
937 | adc edx,edx
|
---|
938 | adc ebx,0
|
---|
939 | add ecx,eax
|
---|
940 | adc ebp,edx
|
---|
941 | mov eax,DWORD [28+esi]
|
---|
942 | adc ebx,0
|
---|
943 | mov DWORD [28+edi],ecx
|
---|
944 | mov edx,DWORD [4+esi]
|
---|
945 | ; saved r[7]
|
---|
946 | ; ############### Calculate word 8
|
---|
947 | xor ecx,ecx
|
---|
948 | ; sqr a[7]*a[1]
|
---|
949 | mul edx
|
---|
950 | add eax,eax
|
---|
951 | adc edx,edx
|
---|
952 | adc ecx,0
|
---|
953 | add ebp,eax
|
---|
954 | adc ebx,edx
|
---|
955 | mov eax,DWORD [24+esi]
|
---|
956 | adc ecx,0
|
---|
957 | mov edx,DWORD [8+esi]
|
---|
958 | ; sqr a[6]*a[2]
|
---|
959 | mul edx
|
---|
960 | add eax,eax
|
---|
961 | adc edx,edx
|
---|
962 | adc ecx,0
|
---|
963 | add ebp,eax
|
---|
964 | adc ebx,edx
|
---|
965 | mov eax,DWORD [20+esi]
|
---|
966 | adc ecx,0
|
---|
967 | mov edx,DWORD [12+esi]
|
---|
968 | ; sqr a[5]*a[3]
|
---|
969 | mul edx
|
---|
970 | add eax,eax
|
---|
971 | adc edx,edx
|
---|
972 | adc ecx,0
|
---|
973 | add ebp,eax
|
---|
974 | adc ebx,edx
|
---|
975 | mov eax,DWORD [16+esi]
|
---|
976 | adc ecx,0
|
---|
977 | ; sqr a[4]*a[4]
|
---|
978 | mul eax
|
---|
979 | add ebp,eax
|
---|
980 | adc ebx,edx
|
---|
981 | mov edx,DWORD [8+esi]
|
---|
982 | adc ecx,0
|
---|
983 | mov DWORD [32+edi],ebp
|
---|
984 | mov eax,DWORD [28+esi]
|
---|
985 | ; saved r[8]
|
---|
986 | ; ############### Calculate word 9
|
---|
987 | xor ebp,ebp
|
---|
988 | ; sqr a[7]*a[2]
|
---|
989 | mul edx
|
---|
990 | add eax,eax
|
---|
991 | adc edx,edx
|
---|
992 | adc ebp,0
|
---|
993 | add ebx,eax
|
---|
994 | adc ecx,edx
|
---|
995 | mov eax,DWORD [24+esi]
|
---|
996 | adc ebp,0
|
---|
997 | mov edx,DWORD [12+esi]
|
---|
998 | ; sqr a[6]*a[3]
|
---|
999 | mul edx
|
---|
1000 | add eax,eax
|
---|
1001 | adc edx,edx
|
---|
1002 | adc ebp,0
|
---|
1003 | add ebx,eax
|
---|
1004 | adc ecx,edx
|
---|
1005 | mov eax,DWORD [20+esi]
|
---|
1006 | adc ebp,0
|
---|
1007 | mov edx,DWORD [16+esi]
|
---|
1008 | ; sqr a[5]*a[4]
|
---|
1009 | mul edx
|
---|
1010 | add eax,eax
|
---|
1011 | adc edx,edx
|
---|
1012 | adc ebp,0
|
---|
1013 | add ebx,eax
|
---|
1014 | adc ecx,edx
|
---|
1015 | mov eax,DWORD [28+esi]
|
---|
1016 | adc ebp,0
|
---|
1017 | mov DWORD [36+edi],ebx
|
---|
1018 | mov edx,DWORD [12+esi]
|
---|
1019 | ; saved r[9]
|
---|
1020 | ; ############### Calculate word 10
|
---|
1021 | xor ebx,ebx
|
---|
1022 | ; sqr a[7]*a[3]
|
---|
1023 | mul edx
|
---|
1024 | add eax,eax
|
---|
1025 | adc edx,edx
|
---|
1026 | adc ebx,0
|
---|
1027 | add ecx,eax
|
---|
1028 | adc ebp,edx
|
---|
1029 | mov eax,DWORD [24+esi]
|
---|
1030 | adc ebx,0
|
---|
1031 | mov edx,DWORD [16+esi]
|
---|
1032 | ; sqr a[6]*a[4]
|
---|
1033 | mul edx
|
---|
1034 | add eax,eax
|
---|
1035 | adc edx,edx
|
---|
1036 | adc ebx,0
|
---|
1037 | add ecx,eax
|
---|
1038 | adc ebp,edx
|
---|
1039 | mov eax,DWORD [20+esi]
|
---|
1040 | adc ebx,0
|
---|
1041 | ; sqr a[5]*a[5]
|
---|
1042 | mul eax
|
---|
1043 | add ecx,eax
|
---|
1044 | adc ebp,edx
|
---|
1045 | mov edx,DWORD [16+esi]
|
---|
1046 | adc ebx,0
|
---|
1047 | mov DWORD [40+edi],ecx
|
---|
1048 | mov eax,DWORD [28+esi]
|
---|
1049 | ; saved r[10]
|
---|
1050 | ; ############### Calculate word 11
|
---|
1051 | xor ecx,ecx
|
---|
1052 | ; sqr a[7]*a[4]
|
---|
1053 | mul edx
|
---|
1054 | add eax,eax
|
---|
1055 | adc edx,edx
|
---|
1056 | adc ecx,0
|
---|
1057 | add ebp,eax
|
---|
1058 | adc ebx,edx
|
---|
1059 | mov eax,DWORD [24+esi]
|
---|
1060 | adc ecx,0
|
---|
1061 | mov edx,DWORD [20+esi]
|
---|
1062 | ; sqr a[6]*a[5]
|
---|
1063 | mul edx
|
---|
1064 | add eax,eax
|
---|
1065 | adc edx,edx
|
---|
1066 | adc ecx,0
|
---|
1067 | add ebp,eax
|
---|
1068 | adc ebx,edx
|
---|
1069 | mov eax,DWORD [28+esi]
|
---|
1070 | adc ecx,0
|
---|
1071 | mov DWORD [44+edi],ebp
|
---|
1072 | mov edx,DWORD [20+esi]
|
---|
1073 | ; saved r[11]
|
---|
1074 | ; ############### Calculate word 12
|
---|
1075 | xor ebp,ebp
|
---|
1076 | ; sqr a[7]*a[5]
|
---|
1077 | mul edx
|
---|
1078 | add eax,eax
|
---|
1079 | adc edx,edx
|
---|
1080 | adc ebp,0
|
---|
1081 | add ebx,eax
|
---|
1082 | adc ecx,edx
|
---|
1083 | mov eax,DWORD [24+esi]
|
---|
1084 | adc ebp,0
|
---|
1085 | ; sqr a[6]*a[6]
|
---|
1086 | mul eax
|
---|
1087 | add ebx,eax
|
---|
1088 | adc ecx,edx
|
---|
1089 | mov edx,DWORD [24+esi]
|
---|
1090 | adc ebp,0
|
---|
1091 | mov DWORD [48+edi],ebx
|
---|
1092 | mov eax,DWORD [28+esi]
|
---|
1093 | ; saved r[12]
|
---|
1094 | ; ############### Calculate word 13
|
---|
1095 | xor ebx,ebx
|
---|
1096 | ; sqr a[7]*a[6]
|
---|
1097 | mul edx
|
---|
1098 | add eax,eax
|
---|
1099 | adc edx,edx
|
---|
1100 | adc ebx,0
|
---|
1101 | add ecx,eax
|
---|
1102 | adc ebp,edx
|
---|
1103 | mov eax,DWORD [28+esi]
|
---|
1104 | adc ebx,0
|
---|
1105 | mov DWORD [52+edi],ecx
|
---|
1106 | ; saved r[13]
|
---|
1107 | ; ############### Calculate word 14
|
---|
1108 | xor ecx,ecx
|
---|
1109 | ; sqr a[7]*a[7]
|
---|
1110 | mul eax
|
---|
1111 | add ebp,eax
|
---|
1112 | adc ebx,edx
|
---|
1113 | adc ecx,0
|
---|
1114 | mov DWORD [56+edi],ebp
|
---|
1115 | ; saved r[14]
|
---|
1116 | mov DWORD [60+edi],ebx
|
---|
1117 | pop ebx
|
---|
1118 | pop ebp
|
---|
1119 | pop edi
|
---|
1120 | pop esi
|
---|
1121 | ret
|
---|
1122 | global _bn_sqr_comba4
|
---|
1123 | align 16
|
---|
1124 | _bn_sqr_comba4:
|
---|
1125 | L$_bn_sqr_comba4_begin:
|
---|
1126 | push esi
|
---|
1127 | push edi
|
---|
1128 | push ebp
|
---|
1129 | push ebx
|
---|
1130 | mov edi,DWORD [20+esp]
|
---|
1131 | mov esi,DWORD [24+esp]
|
---|
1132 | xor ebx,ebx
|
---|
1133 | xor ecx,ecx
|
---|
1134 | mov eax,DWORD [esi]
|
---|
1135 | ; ############### Calculate word 0
|
---|
1136 | xor ebp,ebp
|
---|
1137 | ; sqr a[0]*a[0]
|
---|
1138 | mul eax
|
---|
1139 | add ebx,eax
|
---|
1140 | adc ecx,edx
|
---|
1141 | mov edx,DWORD [esi]
|
---|
1142 | adc ebp,0
|
---|
1143 | mov DWORD [edi],ebx
|
---|
1144 | mov eax,DWORD [4+esi]
|
---|
1145 | ; saved r[0]
|
---|
1146 | ; ############### Calculate word 1
|
---|
1147 | xor ebx,ebx
|
---|
1148 | ; sqr a[1]*a[0]
|
---|
1149 | mul edx
|
---|
1150 | add eax,eax
|
---|
1151 | adc edx,edx
|
---|
1152 | adc ebx,0
|
---|
1153 | add ecx,eax
|
---|
1154 | adc ebp,edx
|
---|
1155 | mov eax,DWORD [8+esi]
|
---|
1156 | adc ebx,0
|
---|
1157 | mov DWORD [4+edi],ecx
|
---|
1158 | mov edx,DWORD [esi]
|
---|
1159 | ; saved r[1]
|
---|
1160 | ; ############### Calculate word 2
|
---|
1161 | xor ecx,ecx
|
---|
1162 | ; sqr a[2]*a[0]
|
---|
1163 | mul edx
|
---|
1164 | add eax,eax
|
---|
1165 | adc edx,edx
|
---|
1166 | adc ecx,0
|
---|
1167 | add ebp,eax
|
---|
1168 | adc ebx,edx
|
---|
1169 | mov eax,DWORD [4+esi]
|
---|
1170 | adc ecx,0
|
---|
1171 | ; sqr a[1]*a[1]
|
---|
1172 | mul eax
|
---|
1173 | add ebp,eax
|
---|
1174 | adc ebx,edx
|
---|
1175 | mov edx,DWORD [esi]
|
---|
1176 | adc ecx,0
|
---|
1177 | mov DWORD [8+edi],ebp
|
---|
1178 | mov eax,DWORD [12+esi]
|
---|
1179 | ; saved r[2]
|
---|
1180 | ; ############### Calculate word 3
|
---|
1181 | xor ebp,ebp
|
---|
1182 | ; sqr a[3]*a[0]
|
---|
1183 | mul edx
|
---|
1184 | add eax,eax
|
---|
1185 | adc edx,edx
|
---|
1186 | adc ebp,0
|
---|
1187 | add ebx,eax
|
---|
1188 | adc ecx,edx
|
---|
1189 | mov eax,DWORD [8+esi]
|
---|
1190 | adc ebp,0
|
---|
1191 | mov edx,DWORD [4+esi]
|
---|
1192 | ; sqr a[2]*a[1]
|
---|
1193 | mul edx
|
---|
1194 | add eax,eax
|
---|
1195 | adc edx,edx
|
---|
1196 | adc ebp,0
|
---|
1197 | add ebx,eax
|
---|
1198 | adc ecx,edx
|
---|
1199 | mov eax,DWORD [12+esi]
|
---|
1200 | adc ebp,0
|
---|
1201 | mov DWORD [12+edi],ebx
|
---|
1202 | mov edx,DWORD [4+esi]
|
---|
1203 | ; saved r[3]
|
---|
1204 | ; ############### Calculate word 4
|
---|
1205 | xor ebx,ebx
|
---|
1206 | ; sqr a[3]*a[1]
|
---|
1207 | mul edx
|
---|
1208 | add eax,eax
|
---|
1209 | adc edx,edx
|
---|
1210 | adc ebx,0
|
---|
1211 | add ecx,eax
|
---|
1212 | adc ebp,edx
|
---|
1213 | mov eax,DWORD [8+esi]
|
---|
1214 | adc ebx,0
|
---|
1215 | ; sqr a[2]*a[2]
|
---|
1216 | mul eax
|
---|
1217 | add ecx,eax
|
---|
1218 | adc ebp,edx
|
---|
1219 | mov edx,DWORD [8+esi]
|
---|
1220 | adc ebx,0
|
---|
1221 | mov DWORD [16+edi],ecx
|
---|
1222 | mov eax,DWORD [12+esi]
|
---|
1223 | ; saved r[4]
|
---|
1224 | ; ############### Calculate word 5
|
---|
1225 | xor ecx,ecx
|
---|
1226 | ; sqr a[3]*a[2]
|
---|
1227 | mul edx
|
---|
1228 | add eax,eax
|
---|
1229 | adc edx,edx
|
---|
1230 | adc ecx,0
|
---|
1231 | add ebp,eax
|
---|
1232 | adc ebx,edx
|
---|
1233 | mov eax,DWORD [12+esi]
|
---|
1234 | adc ecx,0
|
---|
1235 | mov DWORD [20+edi],ebp
|
---|
1236 | ; saved r[5]
|
---|
1237 | ; ############### Calculate word 6
|
---|
1238 | xor ebp,ebp
|
---|
1239 | ; sqr a[3]*a[3]
|
---|
1240 | mul eax
|
---|
1241 | add ebx,eax
|
---|
1242 | adc ecx,edx
|
---|
1243 | adc ebp,0
|
---|
1244 | mov DWORD [24+edi],ebx
|
---|
1245 | ; saved r[6]
|
---|
1246 | mov DWORD [28+edi],ecx
|
---|
1247 | pop ebx
|
---|
1248 | pop ebp
|
---|
1249 | pop edi
|
---|
1250 | pop esi
|
---|
1251 | ret
|
---|