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