]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - secure/lib/libcrypto/amd64/rsaz-x86_64.S
Merge ^/vendor/llvm-libunwind/dist up to its last change, and resolve conflicts.
[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         movq    %rdx,%rbp
35         movq    (%rsi),%rdx
36         movq    8(%rsi),%rax
37         movq    %rcx,128(%rsp)
38         movl    $0x80100,%r11d
39         andl    OPENSSL_ia32cap_P+8(%rip),%r11d
40         cmpl    $0x80100,%r11d
41         je      .Loop_sqrx
42         jmp     .Loop_sqr
43
44 .align  32
45 .Loop_sqr:
46         movl    %r8d,128+8(%rsp)
47
48         movq    %rdx,%rbx
49         mulq    %rdx
50         movq    %rax,%r8
51         movq    16(%rsi),%rax
52         movq    %rdx,%r9
53
54         mulq    %rbx
55         addq    %rax,%r9
56         movq    24(%rsi),%rax
57         movq    %rdx,%r10
58         adcq    $0,%r10
59
60         mulq    %rbx
61         addq    %rax,%r10
62         movq    32(%rsi),%rax
63         movq    %rdx,%r11
64         adcq    $0,%r11
65
66         mulq    %rbx
67         addq    %rax,%r11
68         movq    40(%rsi),%rax
69         movq    %rdx,%r12
70         adcq    $0,%r12
71
72         mulq    %rbx
73         addq    %rax,%r12
74         movq    48(%rsi),%rax
75         movq    %rdx,%r13
76         adcq    $0,%r13
77
78         mulq    %rbx
79         addq    %rax,%r13
80         movq    56(%rsi),%rax
81         movq    %rdx,%r14
82         adcq    $0,%r14
83
84         mulq    %rbx
85         addq    %rax,%r14
86         movq    %rbx,%rax
87         movq    %rdx,%r15
88         adcq    $0,%r15
89
90         addq    %r8,%r8
91         movq    %r9,%rcx
92         adcq    %r9,%r9
93
94         mulq    %rax
95         movq    %rax,(%rsp)
96         addq    %rdx,%r8
97         adcq    $0,%r9
98
99         movq    %r8,8(%rsp)
100         shrq    $63,%rcx
101
102
103         movq    8(%rsi),%r8
104         movq    16(%rsi),%rax
105         mulq    %r8
106         addq    %rax,%r10
107         movq    24(%rsi),%rax
108         movq    %rdx,%rbx
109         adcq    $0,%rbx
110
111         mulq    %r8
112         addq    %rax,%r11
113         movq    32(%rsi),%rax
114         adcq    $0,%rdx
115         addq    %rbx,%r11
116         movq    %rdx,%rbx
117         adcq    $0,%rbx
118
119         mulq    %r8
120         addq    %rax,%r12
121         movq    40(%rsi),%rax
122         adcq    $0,%rdx
123         addq    %rbx,%r12
124         movq    %rdx,%rbx
125         adcq    $0,%rbx
126
127         mulq    %r8
128         addq    %rax,%r13
129         movq    48(%rsi),%rax
130         adcq    $0,%rdx
131         addq    %rbx,%r13
132         movq    %rdx,%rbx
133         adcq    $0,%rbx
134
135         mulq    %r8
136         addq    %rax,%r14
137         movq    56(%rsi),%rax
138         adcq    $0,%rdx
139         addq    %rbx,%r14
140         movq    %rdx,%rbx
141         adcq    $0,%rbx
142
143         mulq    %r8
144         addq    %rax,%r15
145         movq    %r8,%rax
146         adcq    $0,%rdx
147         addq    %rbx,%r15
148         movq    %rdx,%r8
149         movq    %r10,%rdx
150         adcq    $0,%r8
151
152         addq    %rdx,%rdx
153         leaq    (%rcx,%r10,2),%r10
154         movq    %r11,%rbx
155         adcq    %r11,%r11
156
157         mulq    %rax
158         addq    %rax,%r9
159         adcq    %rdx,%r10
160         adcq    $0,%r11
161
162         movq    %r9,16(%rsp)
163         movq    %r10,24(%rsp)
164         shrq    $63,%rbx
165
166
167         movq    16(%rsi),%r9
168         movq    24(%rsi),%rax
169         mulq    %r9
170         addq    %rax,%r12
171         movq    32(%rsi),%rax
172         movq    %rdx,%rcx
173         adcq    $0,%rcx
174
175         mulq    %r9
176         addq    %rax,%r13
177         movq    40(%rsi),%rax
178         adcq    $0,%rdx
179         addq    %rcx,%r13
180         movq    %rdx,%rcx
181         adcq    $0,%rcx
182
183         mulq    %r9
184         addq    %rax,%r14
185         movq    48(%rsi),%rax
186         adcq    $0,%rdx
187         addq    %rcx,%r14
188         movq    %rdx,%rcx
189         adcq    $0,%rcx
190
191         mulq    %r9
192         movq    %r12,%r10
193         leaq    (%rbx,%r12,2),%r12
194         addq    %rax,%r15
195         movq    56(%rsi),%rax
196         adcq    $0,%rdx
197         addq    %rcx,%r15
198         movq    %rdx,%rcx
199         adcq    $0,%rcx
200
201         mulq    %r9
202         shrq    $63,%r10
203         addq    %rax,%r8
204         movq    %r9,%rax
205         adcq    $0,%rdx
206         addq    %rcx,%r8
207         movq    %rdx,%r9
208         adcq    $0,%r9
209
210         movq    %r13,%rcx
211         leaq    (%r10,%r13,2),%r13
212
213         mulq    %rax
214         addq    %rax,%r11
215         adcq    %rdx,%r12
216         adcq    $0,%r13
217
218         movq    %r11,32(%rsp)
219         movq    %r12,40(%rsp)
220         shrq    $63,%rcx
221
222
223         movq    24(%rsi),%r10
224         movq    32(%rsi),%rax
225         mulq    %r10
226         addq    %rax,%r14
227         movq    40(%rsi),%rax
228         movq    %rdx,%rbx
229         adcq    $0,%rbx
230
231         mulq    %r10
232         addq    %rax,%r15
233         movq    48(%rsi),%rax
234         adcq    $0,%rdx
235         addq    %rbx,%r15
236         movq    %rdx,%rbx
237         adcq    $0,%rbx
238
239         mulq    %r10
240         movq    %r14,%r12
241         leaq    (%rcx,%r14,2),%r14
242         addq    %rax,%r8
243         movq    56(%rsi),%rax
244         adcq    $0,%rdx
245         addq    %rbx,%r8
246         movq    %rdx,%rbx
247         adcq    $0,%rbx
248
249         mulq    %r10
250         shrq    $63,%r12
251         addq    %rax,%r9
252         movq    %r10,%rax
253         adcq    $0,%rdx
254         addq    %rbx,%r9
255         movq    %rdx,%r10
256         adcq    $0,%r10
257
258         movq    %r15,%rbx
259         leaq    (%r12,%r15,2),%r15
260
261         mulq    %rax
262         addq    %rax,%r13
263         adcq    %rdx,%r14
264         adcq    $0,%r15
265
266         movq    %r13,48(%rsp)
267         movq    %r14,56(%rsp)
268         shrq    $63,%rbx
269
270
271         movq    32(%rsi),%r11
272         movq    40(%rsi),%rax
273         mulq    %r11
274         addq    %rax,%r8
275         movq    48(%rsi),%rax
276         movq    %rdx,%rcx
277         adcq    $0,%rcx
278
279         mulq    %r11
280         addq    %rax,%r9
281         movq    56(%rsi),%rax
282         adcq    $0,%rdx
283         movq    %r8,%r12
284         leaq    (%rbx,%r8,2),%r8
285         addq    %rcx,%r9
286         movq    %rdx,%rcx
287         adcq    $0,%rcx
288
289         mulq    %r11
290         shrq    $63,%r12
291         addq    %rax,%r10
292         movq    %r11,%rax
293         adcq    $0,%rdx
294         addq    %rcx,%r10
295         movq    %rdx,%r11
296         adcq    $0,%r11
297
298         movq    %r9,%rcx
299         leaq    (%r12,%r9,2),%r9
300
301         mulq    %rax
302         addq    %rax,%r15
303         adcq    %rdx,%r8
304         adcq    $0,%r9
305
306         movq    %r15,64(%rsp)
307         movq    %r8,72(%rsp)
308         shrq    $63,%rcx
309
310
311         movq    40(%rsi),%r12
312         movq    48(%rsi),%rax
313         mulq    %r12
314         addq    %rax,%r10
315         movq    56(%rsi),%rax
316         movq    %rdx,%rbx
317         adcq    $0,%rbx
318
319         mulq    %r12
320         addq    %rax,%r11
321         movq    %r12,%rax
322         movq    %r10,%r15
323         leaq    (%rcx,%r10,2),%r10
324         adcq    $0,%rdx
325         shrq    $63,%r15
326         addq    %rbx,%r11
327         movq    %rdx,%r12
328         adcq    $0,%r12
329
330         movq    %r11,%rbx
331         leaq    (%r15,%r11,2),%r11
332
333         mulq    %rax
334         addq    %rax,%r9
335         adcq    %rdx,%r10
336         adcq    $0,%r11
337
338         movq    %r9,80(%rsp)
339         movq    %r10,88(%rsp)
340
341
342         movq    48(%rsi),%r13
343         movq    56(%rsi),%rax
344         mulq    %r13
345         addq    %rax,%r12
346         movq    %r13,%rax
347         movq    %rdx,%r13
348         adcq    $0,%r13
349
350         xorq    %r14,%r14
351         shlq    $1,%rbx
352         adcq    %r12,%r12
353         adcq    %r13,%r13
354         adcq    %r14,%r14
355
356         mulq    %rax
357         addq    %rax,%r11
358         adcq    %rdx,%r12
359         adcq    $0,%r13
360
361         movq    %r11,96(%rsp)
362         movq    %r12,104(%rsp)
363
364
365         movq    56(%rsi),%rax
366         mulq    %rax
367         addq    %rax,%r13
368         adcq    $0,%rdx
369
370         addq    %rdx,%r14
371
372         movq    %r13,112(%rsp)
373         movq    %r14,120(%rsp)
374
375         movq    (%rsp),%r8
376         movq    8(%rsp),%r9
377         movq    16(%rsp),%r10
378         movq    24(%rsp),%r11
379         movq    32(%rsp),%r12
380         movq    40(%rsp),%r13
381         movq    48(%rsp),%r14
382         movq    56(%rsp),%r15
383
384         call    __rsaz_512_reduce
385
386         addq    64(%rsp),%r8
387         adcq    72(%rsp),%r9
388         adcq    80(%rsp),%r10
389         adcq    88(%rsp),%r11
390         adcq    96(%rsp),%r12
391         adcq    104(%rsp),%r13
392         adcq    112(%rsp),%r14
393         adcq    120(%rsp),%r15
394         sbbq    %rcx,%rcx
395
396         call    __rsaz_512_subtract
397
398         movq    %r8,%rdx
399         movq    %r9,%rax
400         movl    128+8(%rsp),%r8d
401         movq    %rdi,%rsi
402
403         decl    %r8d
404         jnz     .Loop_sqr
405         jmp     .Lsqr_tail
406
407 .align  32
408 .Loop_sqrx:
409         movl    %r8d,128+8(%rsp)
410 .byte   102,72,15,110,199
411 .byte   102,72,15,110,205
412
413         mulxq   %rax,%r8,%r9
414
415         mulxq   16(%rsi),%rcx,%r10
416         xorq    %rbp,%rbp
417
418         mulxq   24(%rsi),%rax,%r11
419         adcxq   %rcx,%r9
420
421         mulxq   32(%rsi),%rcx,%r12
422         adcxq   %rax,%r10
423
424         mulxq   40(%rsi),%rax,%r13
425         adcxq   %rcx,%r11
426
427 .byte   0xc4,0x62,0xf3,0xf6,0xb6,0x30,0x00,0x00,0x00
428         adcxq   %rax,%r12
429         adcxq   %rcx,%r13
430
431 .byte   0xc4,0x62,0xfb,0xf6,0xbe,0x38,0x00,0x00,0x00
432         adcxq   %rax,%r14
433         adcxq   %rbp,%r15
434
435         movq    %r9,%rcx
436         shldq   $1,%r8,%r9
437         shlq    $1,%r8
438
439         xorl    %ebp,%ebp
440         mulxq   %rdx,%rax,%rdx
441         adcxq   %rdx,%r8
442         movq    8(%rsi),%rdx
443         adcxq   %rbp,%r9
444
445         movq    %rax,(%rsp)
446         movq    %r8,8(%rsp)
447
448
449         mulxq   16(%rsi),%rax,%rbx
450         adoxq   %rax,%r10
451         adcxq   %rbx,%r11
452
453 .byte   0xc4,0x62,0xc3,0xf6,0x86,0x18,0x00,0x00,0x00
454         adoxq   %rdi,%r11
455         adcxq   %r8,%r12
456
457         mulxq   32(%rsi),%rax,%rbx
458         adoxq   %rax,%r12
459         adcxq   %rbx,%r13
460
461         mulxq   40(%rsi),%rdi,%r8
462         adoxq   %rdi,%r13
463         adcxq   %r8,%r14
464
465 .byte   0xc4,0xe2,0xfb,0xf6,0x9e,0x30,0x00,0x00,0x00
466         adoxq   %rax,%r14
467         adcxq   %rbx,%r15
468
469 .byte   0xc4,0x62,0xc3,0xf6,0x86,0x38,0x00,0x00,0x00
470         adoxq   %rdi,%r15
471         adcxq   %rbp,%r8
472         adoxq   %rbp,%r8
473
474         movq    %r11,%rbx
475         shldq   $1,%r10,%r11
476         shldq   $1,%rcx,%r10
477
478         xorl    %ebp,%ebp
479         mulxq   %rdx,%rax,%rcx
480         movq    16(%rsi),%rdx
481         adcxq   %rax,%r9
482         adcxq   %rcx,%r10
483         adcxq   %rbp,%r11
484
485         movq    %r9,16(%rsp)
486 .byte   0x4c,0x89,0x94,0x24,0x18,0x00,0x00,0x00
487
488
489 .byte   0xc4,0x62,0xc3,0xf6,0x8e,0x18,0x00,0x00,0x00
490         adoxq   %rdi,%r12
491         adcxq   %r9,%r13
492
493         mulxq   32(%rsi),%rax,%rcx
494         adoxq   %rax,%r13
495         adcxq   %rcx,%r14
496
497         mulxq   40(%rsi),%rdi,%r9
498         adoxq   %rdi,%r14
499         adcxq   %r9,%r15
500
501 .byte   0xc4,0xe2,0xfb,0xf6,0x8e,0x30,0x00,0x00,0x00
502         adoxq   %rax,%r15
503         adcxq   %rcx,%r8
504
505 .byte   0xc4,0x62,0xc3,0xf6,0x8e,0x38,0x00,0x00,0x00
506         adoxq   %rdi,%r8
507         adcxq   %rbp,%r9
508         adoxq   %rbp,%r9
509
510         movq    %r13,%rcx
511         shldq   $1,%r12,%r13
512         shldq   $1,%rbx,%r12
513
514         xorl    %ebp,%ebp
515         mulxq   %rdx,%rax,%rdx
516         adcxq   %rax,%r11
517         adcxq   %rdx,%r12
518         movq    24(%rsi),%rdx
519         adcxq   %rbp,%r13
520
521         movq    %r11,32(%rsp)
522 .byte   0x4c,0x89,0xa4,0x24,0x28,0x00,0x00,0x00
523
524
525 .byte   0xc4,0xe2,0xfb,0xf6,0x9e,0x20,0x00,0x00,0x00
526         adoxq   %rax,%r14
527         adcxq   %rbx,%r15
528
529         mulxq   40(%rsi),%rdi,%r10
530         adoxq   %rdi,%r15
531         adcxq   %r10,%r8
532
533         mulxq   48(%rsi),%rax,%rbx
534         adoxq   %rax,%r8
535         adcxq   %rbx,%r9
536
537         mulxq   56(%rsi),%rdi,%r10
538         adoxq   %rdi,%r9
539         adcxq   %rbp,%r10
540         adoxq   %rbp,%r10
541
542 .byte   0x66
543         movq    %r15,%rbx
544         shldq   $1,%r14,%r15
545         shldq   $1,%rcx,%r14
546
547         xorl    %ebp,%ebp
548         mulxq   %rdx,%rax,%rdx
549         adcxq   %rax,%r13
550         adcxq   %rdx,%r14
551         movq    32(%rsi),%rdx
552         adcxq   %rbp,%r15
553
554         movq    %r13,48(%rsp)
555         movq    %r14,56(%rsp)
556
557
558 .byte   0xc4,0x62,0xc3,0xf6,0x9e,0x28,0x00,0x00,0x00
559         adoxq   %rdi,%r8
560         adcxq   %r11,%r9
561
562         mulxq   48(%rsi),%rax,%rcx
563         adoxq   %rax,%r9
564         adcxq   %rcx,%r10
565
566         mulxq   56(%rsi),%rdi,%r11
567         adoxq   %rdi,%r10
568         adcxq   %rbp,%r11
569         adoxq   %rbp,%r11
570
571         movq    %r9,%rcx
572         shldq   $1,%r8,%r9
573         shldq   $1,%rbx,%r8
574
575         xorl    %ebp,%ebp
576         mulxq   %rdx,%rax,%rdx
577         adcxq   %rax,%r15
578         adcxq   %rdx,%r8
579         movq    40(%rsi),%rdx
580         adcxq   %rbp,%r9
581
582         movq    %r15,64(%rsp)
583         movq    %r8,72(%rsp)
584
585
586 .byte   0xc4,0xe2,0xfb,0xf6,0x9e,0x30,0x00,0x00,0x00
587         adoxq   %rax,%r10
588         adcxq   %rbx,%r11
589
590 .byte   0xc4,0x62,0xc3,0xf6,0xa6,0x38,0x00,0x00,0x00
591         adoxq   %rdi,%r11
592         adcxq   %rbp,%r12
593         adoxq   %rbp,%r12
594
595         movq    %r11,%rbx
596         shldq   $1,%r10,%r11
597         shldq   $1,%rcx,%r10
598
599         xorl    %ebp,%ebp
600         mulxq   %rdx,%rax,%rdx
601         adcxq   %rax,%r9
602         adcxq   %rdx,%r10
603         movq    48(%rsi),%rdx
604         adcxq   %rbp,%r11
605
606         movq    %r9,80(%rsp)
607         movq    %r10,88(%rsp)
608
609
610 .byte   0xc4,0x62,0xfb,0xf6,0xae,0x38,0x00,0x00,0x00
611         adoxq   %rax,%r12
612         adoxq   %rbp,%r13
613
614         xorq    %r14,%r14
615         shldq   $1,%r13,%r14
616         shldq   $1,%r12,%r13
617         shldq   $1,%rbx,%r12
618
619         xorl    %ebp,%ebp
620         mulxq   %rdx,%rax,%rdx
621         adcxq   %rax,%r11
622         adcxq   %rdx,%r12
623         movq    56(%rsi),%rdx
624         adcxq   %rbp,%r13
625
626 .byte   0x4c,0x89,0x9c,0x24,0x60,0x00,0x00,0x00
627 .byte   0x4c,0x89,0xa4,0x24,0x68,0x00,0x00,0x00
628
629
630         mulxq   %rdx,%rax,%rdx
631         adoxq   %rax,%r13
632         adoxq   %rbp,%rdx
633
634 .byte   0x66
635         addq    %rdx,%r14
636
637         movq    %r13,112(%rsp)
638         movq    %r14,120(%rsp)
639 .byte   102,72,15,126,199
640 .byte   102,72,15,126,205
641
642         movq    128(%rsp),%rdx
643         movq    (%rsp),%r8
644         movq    8(%rsp),%r9
645         movq    16(%rsp),%r10
646         movq    24(%rsp),%r11
647         movq    32(%rsp),%r12
648         movq    40(%rsp),%r13
649         movq    48(%rsp),%r14
650         movq    56(%rsp),%r15
651
652         call    __rsaz_512_reducex
653
654         addq    64(%rsp),%r8
655         adcq    72(%rsp),%r9
656         adcq    80(%rsp),%r10
657         adcq    88(%rsp),%r11
658         adcq    96(%rsp),%r12
659         adcq    104(%rsp),%r13
660         adcq    112(%rsp),%r14
661         adcq    120(%rsp),%r15
662         sbbq    %rcx,%rcx
663
664         call    __rsaz_512_subtract
665
666         movq    %r8,%rdx
667         movq    %r9,%rax
668         movl    128+8(%rsp),%r8d
669         movq    %rdi,%rsi
670
671         decl    %r8d
672         jnz     .Loop_sqrx
673
674 .Lsqr_tail:
675
676         leaq    128+24+48(%rsp),%rax
677 .cfi_def_cfa    %rax,8
678         movq    -48(%rax),%r15
679 .cfi_restore    %r15
680         movq    -40(%rax),%r14
681 .cfi_restore    %r14
682         movq    -32(%rax),%r13
683 .cfi_restore    %r13
684         movq    -24(%rax),%r12
685 .cfi_restore    %r12
686         movq    -16(%rax),%rbp
687 .cfi_restore    %rbp
688         movq    -8(%rax),%rbx
689 .cfi_restore    %rbx
690         leaq    (%rax),%rsp
691 .cfi_def_cfa_register   %rsp
692 .Lsqr_epilogue:
693         .byte   0xf3,0xc3
694 .cfi_endproc    
695 .size   rsaz_512_sqr,.-rsaz_512_sqr
696 .globl  rsaz_512_mul
697 .type   rsaz_512_mul,@function
698 .align  32
699 rsaz_512_mul:
700 .cfi_startproc  
701         pushq   %rbx
702 .cfi_adjust_cfa_offset  8
703 .cfi_offset     %rbx,-16
704         pushq   %rbp
705 .cfi_adjust_cfa_offset  8
706 .cfi_offset     %rbp,-24
707         pushq   %r12
708 .cfi_adjust_cfa_offset  8
709 .cfi_offset     %r12,-32
710         pushq   %r13
711 .cfi_adjust_cfa_offset  8
712 .cfi_offset     %r13,-40
713         pushq   %r14
714 .cfi_adjust_cfa_offset  8
715 .cfi_offset     %r14,-48
716         pushq   %r15
717 .cfi_adjust_cfa_offset  8
718 .cfi_offset     %r15,-56
719
720         subq    $128+24,%rsp
721 .cfi_adjust_cfa_offset  128+24
722 .Lmul_body:
723 .byte   102,72,15,110,199
724 .byte   102,72,15,110,201
725         movq    %r8,128(%rsp)
726         movl    $0x80100,%r11d
727         andl    OPENSSL_ia32cap_P+8(%rip),%r11d
728         cmpl    $0x80100,%r11d
729         je      .Lmulx
730         movq    (%rdx),%rbx
731         movq    %rdx,%rbp
732         call    __rsaz_512_mul
733
734 .byte   102,72,15,126,199
735 .byte   102,72,15,126,205
736
737         movq    (%rsp),%r8
738         movq    8(%rsp),%r9
739         movq    16(%rsp),%r10
740         movq    24(%rsp),%r11
741         movq    32(%rsp),%r12
742         movq    40(%rsp),%r13
743         movq    48(%rsp),%r14
744         movq    56(%rsp),%r15
745
746         call    __rsaz_512_reduce
747         jmp     .Lmul_tail
748
749 .align  32
750 .Lmulx:
751         movq    %rdx,%rbp
752         movq    (%rdx),%rdx
753         call    __rsaz_512_mulx
754
755 .byte   102,72,15,126,199
756 .byte   102,72,15,126,205
757
758         movq    128(%rsp),%rdx
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_reducex
769 .Lmul_tail:
770         addq    64(%rsp),%r8
771         adcq    72(%rsp),%r9
772         adcq    80(%rsp),%r10
773         adcq    88(%rsp),%r11
774         adcq    96(%rsp),%r12
775         adcq    104(%rsp),%r13
776         adcq    112(%rsp),%r14
777         adcq    120(%rsp),%r15
778         sbbq    %rcx,%rcx
779
780         call    __rsaz_512_subtract
781
782         leaq    128+24+48(%rsp),%rax
783 .cfi_def_cfa    %rax,8
784         movq    -48(%rax),%r15
785 .cfi_restore    %r15
786         movq    -40(%rax),%r14
787 .cfi_restore    %r14
788         movq    -32(%rax),%r13
789 .cfi_restore    %r13
790         movq    -24(%rax),%r12
791 .cfi_restore    %r12
792         movq    -16(%rax),%rbp
793 .cfi_restore    %rbp
794         movq    -8(%rax),%rbx
795 .cfi_restore    %rbx
796         leaq    (%rax),%rsp
797 .cfi_def_cfa_register   %rsp
798 .Lmul_epilogue:
799         .byte   0xf3,0xc3
800 .cfi_endproc    
801 .size   rsaz_512_mul,.-rsaz_512_mul
802 .globl  rsaz_512_mul_gather4
803 .type   rsaz_512_mul_gather4,@function
804 .align  32
805 rsaz_512_mul_gather4:
806 .cfi_startproc  
807         pushq   %rbx
808 .cfi_adjust_cfa_offset  8
809 .cfi_offset     %rbx,-16
810         pushq   %rbp
811 .cfi_adjust_cfa_offset  8
812 .cfi_offset     %rbp,-24
813         pushq   %r12
814 .cfi_adjust_cfa_offset  8
815 .cfi_offset     %r12,-32
816         pushq   %r13
817 .cfi_adjust_cfa_offset  8
818 .cfi_offset     %r13,-40
819         pushq   %r14
820 .cfi_adjust_cfa_offset  8
821 .cfi_offset     %r14,-48
822         pushq   %r15
823 .cfi_adjust_cfa_offset  8
824 .cfi_offset     %r15,-56
825
826         subq    $152,%rsp
827 .cfi_adjust_cfa_offset  152
828 .Lmul_gather4_body:
829         movd    %r9d,%xmm8
830         movdqa  .Linc+16(%rip),%xmm1
831         movdqa  .Linc(%rip),%xmm0
832
833         pshufd  $0,%xmm8,%xmm8
834         movdqa  %xmm1,%xmm7
835         movdqa  %xmm1,%xmm2
836         paddd   %xmm0,%xmm1
837         pcmpeqd %xmm8,%xmm0
838         movdqa  %xmm7,%xmm3
839         paddd   %xmm1,%xmm2
840         pcmpeqd %xmm8,%xmm1
841         movdqa  %xmm7,%xmm4
842         paddd   %xmm2,%xmm3
843         pcmpeqd %xmm8,%xmm2
844         movdqa  %xmm7,%xmm5
845         paddd   %xmm3,%xmm4
846         pcmpeqd %xmm8,%xmm3
847         movdqa  %xmm7,%xmm6
848         paddd   %xmm4,%xmm5
849         pcmpeqd %xmm8,%xmm4
850         paddd   %xmm5,%xmm6
851         pcmpeqd %xmm8,%xmm5
852         paddd   %xmm6,%xmm7
853         pcmpeqd %xmm8,%xmm6
854         pcmpeqd %xmm8,%xmm7
855
856         movdqa  0(%rdx),%xmm8
857         movdqa  16(%rdx),%xmm9
858         movdqa  32(%rdx),%xmm10
859         movdqa  48(%rdx),%xmm11
860         pand    %xmm0,%xmm8
861         movdqa  64(%rdx),%xmm12
862         pand    %xmm1,%xmm9
863         movdqa  80(%rdx),%xmm13
864         pand    %xmm2,%xmm10
865         movdqa  96(%rdx),%xmm14
866         pand    %xmm3,%xmm11
867         movdqa  112(%rdx),%xmm15
868         leaq    128(%rdx),%rbp
869         pand    %xmm4,%xmm12
870         pand    %xmm5,%xmm13
871         pand    %xmm6,%xmm14
872         pand    %xmm7,%xmm15
873         por     %xmm10,%xmm8
874         por     %xmm11,%xmm9
875         por     %xmm12,%xmm8
876         por     %xmm13,%xmm9
877         por     %xmm14,%xmm8
878         por     %xmm15,%xmm9
879
880         por     %xmm9,%xmm8
881         pshufd  $0x4e,%xmm8,%xmm9
882         por     %xmm9,%xmm8
883         movl    $0x80100,%r11d
884         andl    OPENSSL_ia32cap_P+8(%rip),%r11d
885         cmpl    $0x80100,%r11d
886         je      .Lmulx_gather
887 .byte   102,76,15,126,195
888
889         movq    %r8,128(%rsp)
890         movq    %rdi,128+8(%rsp)
891         movq    %rcx,128+16(%rsp)
892
893         movq    (%rsi),%rax
894         movq    8(%rsi),%rcx
895         mulq    %rbx
896         movq    %rax,(%rsp)
897         movq    %rcx,%rax
898         movq    %rdx,%r8
899
900         mulq    %rbx
901         addq    %rax,%r8
902         movq    16(%rsi),%rax
903         movq    %rdx,%r9
904         adcq    $0,%r9
905
906         mulq    %rbx
907         addq    %rax,%r9
908         movq    24(%rsi),%rax
909         movq    %rdx,%r10
910         adcq    $0,%r10
911
912         mulq    %rbx
913         addq    %rax,%r10
914         movq    32(%rsi),%rax
915         movq    %rdx,%r11
916         adcq    $0,%r11
917
918         mulq    %rbx
919         addq    %rax,%r11
920         movq    40(%rsi),%rax
921         movq    %rdx,%r12
922         adcq    $0,%r12
923
924         mulq    %rbx
925         addq    %rax,%r12
926         movq    48(%rsi),%rax
927         movq    %rdx,%r13
928         adcq    $0,%r13
929
930         mulq    %rbx
931         addq    %rax,%r13
932         movq    56(%rsi),%rax
933         movq    %rdx,%r14
934         adcq    $0,%r14
935
936         mulq    %rbx
937         addq    %rax,%r14
938         movq    (%rsi),%rax
939         movq    %rdx,%r15
940         adcq    $0,%r15
941
942         leaq    8(%rsp),%rdi
943         movl    $7,%ecx
944         jmp     .Loop_mul_gather
945
946 .align  32
947 .Loop_mul_gather:
948         movdqa  0(%rbp),%xmm8
949         movdqa  16(%rbp),%xmm9
950         movdqa  32(%rbp),%xmm10
951         movdqa  48(%rbp),%xmm11
952         pand    %xmm0,%xmm8
953         movdqa  64(%rbp),%xmm12
954         pand    %xmm1,%xmm9
955         movdqa  80(%rbp),%xmm13
956         pand    %xmm2,%xmm10
957         movdqa  96(%rbp),%xmm14
958         pand    %xmm3,%xmm11
959         movdqa  112(%rbp),%xmm15
960         leaq    128(%rbp),%rbp
961         pand    %xmm4,%xmm12
962         pand    %xmm5,%xmm13
963         pand    %xmm6,%xmm14
964         pand    %xmm7,%xmm15
965         por     %xmm10,%xmm8
966         por     %xmm11,%xmm9
967         por     %xmm12,%xmm8
968         por     %xmm13,%xmm9
969         por     %xmm14,%xmm8
970         por     %xmm15,%xmm9
971
972         por     %xmm9,%xmm8
973         pshufd  $0x4e,%xmm8,%xmm9
974         por     %xmm9,%xmm8
975 .byte   102,76,15,126,195
976
977         mulq    %rbx
978         addq    %rax,%r8
979         movq    8(%rsi),%rax
980         movq    %r8,(%rdi)
981         movq    %rdx,%r8
982         adcq    $0,%r8
983
984         mulq    %rbx
985         addq    %rax,%r9
986         movq    16(%rsi),%rax
987         adcq    $0,%rdx
988         addq    %r9,%r8
989         movq    %rdx,%r9
990         adcq    $0,%r9
991
992         mulq    %rbx
993         addq    %rax,%r10
994         movq    24(%rsi),%rax
995         adcq    $0,%rdx
996         addq    %r10,%r9
997         movq    %rdx,%r10
998         adcq    $0,%r10
999
1000         mulq    %rbx
1001         addq    %rax,%r11
1002         movq    32(%rsi),%rax
1003         adcq    $0,%rdx
1004         addq    %r11,%r10
1005         movq    %rdx,%r11
1006         adcq    $0,%r11
1007
1008         mulq    %rbx
1009         addq    %rax,%r12
1010         movq    40(%rsi),%rax
1011         adcq    $0,%rdx
1012         addq    %r12,%r11
1013         movq    %rdx,%r12
1014         adcq    $0,%r12
1015
1016         mulq    %rbx
1017         addq    %rax,%r13
1018         movq    48(%rsi),%rax
1019         adcq    $0,%rdx
1020         addq    %r13,%r12
1021         movq    %rdx,%r13
1022         adcq    $0,%r13
1023
1024         mulq    %rbx
1025         addq    %rax,%r14
1026         movq    56(%rsi),%rax
1027         adcq    $0,%rdx
1028         addq    %r14,%r13
1029         movq    %rdx,%r14
1030         adcq    $0,%r14
1031
1032         mulq    %rbx
1033         addq    %rax,%r15
1034         movq    (%rsi),%rax
1035         adcq    $0,%rdx
1036         addq    %r15,%r14
1037         movq    %rdx,%r15
1038         adcq    $0,%r15
1039
1040         leaq    8(%rdi),%rdi
1041
1042         decl    %ecx
1043         jnz     .Loop_mul_gather
1044
1045         movq    %r8,(%rdi)
1046         movq    %r9,8(%rdi)
1047         movq    %r10,16(%rdi)
1048         movq    %r11,24(%rdi)
1049         movq    %r12,32(%rdi)
1050         movq    %r13,40(%rdi)
1051         movq    %r14,48(%rdi)
1052         movq    %r15,56(%rdi)
1053
1054         movq    128+8(%rsp),%rdi
1055         movq    128+16(%rsp),%rbp
1056
1057         movq    (%rsp),%r8
1058         movq    8(%rsp),%r9
1059         movq    16(%rsp),%r10
1060         movq    24(%rsp),%r11
1061         movq    32(%rsp),%r12
1062         movq    40(%rsp),%r13
1063         movq    48(%rsp),%r14
1064         movq    56(%rsp),%r15
1065
1066         call    __rsaz_512_reduce
1067         jmp     .Lmul_gather_tail
1068
1069 .align  32
1070 .Lmulx_gather:
1071 .byte   102,76,15,126,194
1072
1073         movq    %r8,128(%rsp)
1074         movq    %rdi,128+8(%rsp)
1075         movq    %rcx,128+16(%rsp)
1076
1077         mulxq   (%rsi),%rbx,%r8
1078         movq    %rbx,(%rsp)
1079         xorl    %edi,%edi
1080
1081         mulxq   8(%rsi),%rax,%r9
1082
1083         mulxq   16(%rsi),%rbx,%r10
1084         adcxq   %rax,%r8
1085
1086         mulxq   24(%rsi),%rax,%r11
1087         adcxq   %rbx,%r9
1088
1089         mulxq   32(%rsi),%rbx,%r12
1090         adcxq   %rax,%r10
1091
1092         mulxq   40(%rsi),%rax,%r13
1093         adcxq   %rbx,%r11
1094
1095         mulxq   48(%rsi),%rbx,%r14
1096         adcxq   %rax,%r12
1097
1098         mulxq   56(%rsi),%rax,%r15
1099         adcxq   %rbx,%r13
1100         adcxq   %rax,%r14
1101 .byte   0x67
1102         movq    %r8,%rbx
1103         adcxq   %rdi,%r15
1104
1105         movq    $-7,%rcx
1106         jmp     .Loop_mulx_gather
1107
1108 .align  32
1109 .Loop_mulx_gather:
1110         movdqa  0(%rbp),%xmm8
1111         movdqa  16(%rbp),%xmm9
1112         movdqa  32(%rbp),%xmm10
1113         movdqa  48(%rbp),%xmm11
1114         pand    %xmm0,%xmm8
1115         movdqa  64(%rbp),%xmm12
1116         pand    %xmm1,%xmm9
1117         movdqa  80(%rbp),%xmm13
1118         pand    %xmm2,%xmm10
1119         movdqa  96(%rbp),%xmm14
1120         pand    %xmm3,%xmm11
1121         movdqa  112(%rbp),%xmm15
1122         leaq    128(%rbp),%rbp
1123         pand    %xmm4,%xmm12
1124         pand    %xmm5,%xmm13
1125         pand    %xmm6,%xmm14
1126         pand    %xmm7,%xmm15
1127         por     %xmm10,%xmm8
1128         por     %xmm11,%xmm9
1129         por     %xmm12,%xmm8
1130         por     %xmm13,%xmm9
1131         por     %xmm14,%xmm8
1132         por     %xmm15,%xmm9
1133
1134         por     %xmm9,%xmm8
1135         pshufd  $0x4e,%xmm8,%xmm9
1136         por     %xmm9,%xmm8
1137 .byte   102,76,15,126,194
1138
1139 .byte   0xc4,0x62,0xfb,0xf6,0x86,0x00,0x00,0x00,0x00
1140         adcxq   %rax,%rbx
1141         adoxq   %r9,%r8
1142
1143         mulxq   8(%rsi),%rax,%r9
1144         adcxq   %rax,%r8
1145         adoxq   %r10,%r9
1146
1147         mulxq   16(%rsi),%rax,%r10
1148         adcxq   %rax,%r9
1149         adoxq   %r11,%r10
1150
1151 .byte   0xc4,0x62,0xfb,0xf6,0x9e,0x18,0x00,0x00,0x00
1152         adcxq   %rax,%r10
1153         adoxq   %r12,%r11
1154
1155         mulxq   32(%rsi),%rax,%r12
1156         adcxq   %rax,%r11
1157         adoxq   %r13,%r12
1158
1159         mulxq   40(%rsi),%rax,%r13
1160         adcxq   %rax,%r12
1161         adoxq   %r14,%r13
1162
1163 .byte   0xc4,0x62,0xfb,0xf6,0xb6,0x30,0x00,0x00,0x00
1164         adcxq   %rax,%r13
1165 .byte   0x67
1166         adoxq   %r15,%r14
1167
1168         mulxq   56(%rsi),%rax,%r15
1169         movq    %rbx,64(%rsp,%rcx,8)
1170         adcxq   %rax,%r14
1171         adoxq   %rdi,%r15
1172         movq    %r8,%rbx
1173         adcxq   %rdi,%r15
1174
1175         incq    %rcx
1176         jnz     .Loop_mulx_gather
1177
1178         movq    %r8,64(%rsp)
1179         movq    %r9,64+8(%rsp)
1180         movq    %r10,64+16(%rsp)
1181         movq    %r11,64+24(%rsp)
1182         movq    %r12,64+32(%rsp)
1183         movq    %r13,64+40(%rsp)
1184         movq    %r14,64+48(%rsp)
1185         movq    %r15,64+56(%rsp)
1186
1187         movq    128(%rsp),%rdx
1188         movq    128+8(%rsp),%rdi
1189         movq    128+16(%rsp),%rbp
1190
1191         movq    (%rsp),%r8
1192         movq    8(%rsp),%r9
1193         movq    16(%rsp),%r10
1194         movq    24(%rsp),%r11
1195         movq    32(%rsp),%r12
1196         movq    40(%rsp),%r13
1197         movq    48(%rsp),%r14
1198         movq    56(%rsp),%r15
1199
1200         call    __rsaz_512_reducex
1201
1202 .Lmul_gather_tail:
1203         addq    64(%rsp),%r8
1204         adcq    72(%rsp),%r9
1205         adcq    80(%rsp),%r10
1206         adcq    88(%rsp),%r11
1207         adcq    96(%rsp),%r12
1208         adcq    104(%rsp),%r13
1209         adcq    112(%rsp),%r14
1210         adcq    120(%rsp),%r15
1211         sbbq    %rcx,%rcx
1212
1213         call    __rsaz_512_subtract
1214
1215         leaq    128+24+48(%rsp),%rax
1216 .cfi_def_cfa    %rax,8
1217         movq    -48(%rax),%r15
1218 .cfi_restore    %r15
1219         movq    -40(%rax),%r14
1220 .cfi_restore    %r14
1221         movq    -32(%rax),%r13
1222 .cfi_restore    %r13
1223         movq    -24(%rax),%r12
1224 .cfi_restore    %r12
1225         movq    -16(%rax),%rbp
1226 .cfi_restore    %rbp
1227         movq    -8(%rax),%rbx
1228 .cfi_restore    %rbx
1229         leaq    (%rax),%rsp
1230 .cfi_def_cfa_register   %rsp
1231 .Lmul_gather4_epilogue:
1232         .byte   0xf3,0xc3
1233 .cfi_endproc    
1234 .size   rsaz_512_mul_gather4,.-rsaz_512_mul_gather4
1235 .globl  rsaz_512_mul_scatter4
1236 .type   rsaz_512_mul_scatter4,@function
1237 .align  32
1238 rsaz_512_mul_scatter4:
1239 .cfi_startproc  
1240         pushq   %rbx
1241 .cfi_adjust_cfa_offset  8
1242 .cfi_offset     %rbx,-16
1243         pushq   %rbp
1244 .cfi_adjust_cfa_offset  8
1245 .cfi_offset     %rbp,-24
1246         pushq   %r12
1247 .cfi_adjust_cfa_offset  8
1248 .cfi_offset     %r12,-32
1249         pushq   %r13
1250 .cfi_adjust_cfa_offset  8
1251 .cfi_offset     %r13,-40
1252         pushq   %r14
1253 .cfi_adjust_cfa_offset  8
1254 .cfi_offset     %r14,-48
1255         pushq   %r15
1256 .cfi_adjust_cfa_offset  8
1257 .cfi_offset     %r15,-56
1258
1259         movl    %r9d,%r9d
1260         subq    $128+24,%rsp
1261 .cfi_adjust_cfa_offset  128+24
1262 .Lmul_scatter4_body:
1263         leaq    (%r8,%r9,8),%r8
1264 .byte   102,72,15,110,199
1265 .byte   102,72,15,110,202
1266 .byte   102,73,15,110,208
1267         movq    %rcx,128(%rsp)
1268
1269         movq    %rdi,%rbp
1270         movl    $0x80100,%r11d
1271         andl    OPENSSL_ia32cap_P+8(%rip),%r11d
1272         cmpl    $0x80100,%r11d
1273         je      .Lmulx_scatter
1274         movq    (%rdi),%rbx
1275         call    __rsaz_512_mul
1276
1277 .byte   102,72,15,126,199
1278 .byte   102,72,15,126,205
1279
1280         movq    (%rsp),%r8
1281         movq    8(%rsp),%r9
1282         movq    16(%rsp),%r10
1283         movq    24(%rsp),%r11
1284         movq    32(%rsp),%r12
1285         movq    40(%rsp),%r13
1286         movq    48(%rsp),%r14
1287         movq    56(%rsp),%r15
1288
1289         call    __rsaz_512_reduce
1290         jmp     .Lmul_scatter_tail
1291
1292 .align  32
1293 .Lmulx_scatter:
1294         movq    (%rdi),%rdx
1295         call    __rsaz_512_mulx
1296
1297 .byte   102,72,15,126,199
1298 .byte   102,72,15,126,205
1299
1300         movq    128(%rsp),%rdx
1301         movq    (%rsp),%r8
1302         movq    8(%rsp),%r9
1303         movq    16(%rsp),%r10
1304         movq    24(%rsp),%r11
1305         movq    32(%rsp),%r12
1306         movq    40(%rsp),%r13
1307         movq    48(%rsp),%r14
1308         movq    56(%rsp),%r15
1309
1310         call    __rsaz_512_reducex
1311
1312 .Lmul_scatter_tail:
1313         addq    64(%rsp),%r8
1314         adcq    72(%rsp),%r9
1315         adcq    80(%rsp),%r10
1316         adcq    88(%rsp),%r11
1317         adcq    96(%rsp),%r12
1318         adcq    104(%rsp),%r13
1319         adcq    112(%rsp),%r14
1320         adcq    120(%rsp),%r15
1321 .byte   102,72,15,126,214
1322         sbbq    %rcx,%rcx
1323
1324         call    __rsaz_512_subtract
1325
1326         movq    %r8,0(%rsi)
1327         movq    %r9,128(%rsi)
1328         movq    %r10,256(%rsi)
1329         movq    %r11,384(%rsi)
1330         movq    %r12,512(%rsi)
1331         movq    %r13,640(%rsi)
1332         movq    %r14,768(%rsi)
1333         movq    %r15,896(%rsi)
1334
1335         leaq    128+24+48(%rsp),%rax
1336 .cfi_def_cfa    %rax,8
1337         movq    -48(%rax),%r15
1338 .cfi_restore    %r15
1339         movq    -40(%rax),%r14
1340 .cfi_restore    %r14
1341         movq    -32(%rax),%r13
1342 .cfi_restore    %r13
1343         movq    -24(%rax),%r12
1344 .cfi_restore    %r12
1345         movq    -16(%rax),%rbp
1346 .cfi_restore    %rbp
1347         movq    -8(%rax),%rbx
1348 .cfi_restore    %rbx
1349         leaq    (%rax),%rsp
1350 .cfi_def_cfa_register   %rsp
1351 .Lmul_scatter4_epilogue:
1352         .byte   0xf3,0xc3
1353 .cfi_endproc    
1354 .size   rsaz_512_mul_scatter4,.-rsaz_512_mul_scatter4
1355 .globl  rsaz_512_mul_by_one
1356 .type   rsaz_512_mul_by_one,@function
1357 .align  32
1358 rsaz_512_mul_by_one:
1359 .cfi_startproc  
1360         pushq   %rbx
1361 .cfi_adjust_cfa_offset  8
1362 .cfi_offset     %rbx,-16
1363         pushq   %rbp
1364 .cfi_adjust_cfa_offset  8
1365 .cfi_offset     %rbp,-24
1366         pushq   %r12
1367 .cfi_adjust_cfa_offset  8
1368 .cfi_offset     %r12,-32
1369         pushq   %r13
1370 .cfi_adjust_cfa_offset  8
1371 .cfi_offset     %r13,-40
1372         pushq   %r14
1373 .cfi_adjust_cfa_offset  8
1374 .cfi_offset     %r14,-48
1375         pushq   %r15
1376 .cfi_adjust_cfa_offset  8
1377 .cfi_offset     %r15,-56
1378
1379         subq    $128+24,%rsp
1380 .cfi_adjust_cfa_offset  128+24
1381 .Lmul_by_one_body:
1382         movl    OPENSSL_ia32cap_P+8(%rip),%eax
1383         movq    %rdx,%rbp
1384         movq    %rcx,128(%rsp)
1385
1386         movq    (%rsi),%r8
1387         pxor    %xmm0,%xmm0
1388         movq    8(%rsi),%r9
1389         movq    16(%rsi),%r10
1390         movq    24(%rsi),%r11
1391         movq    32(%rsi),%r12
1392         movq    40(%rsi),%r13
1393         movq    48(%rsi),%r14
1394         movq    56(%rsi),%r15
1395
1396         movdqa  %xmm0,(%rsp)
1397         movdqa  %xmm0,16(%rsp)
1398         movdqa  %xmm0,32(%rsp)
1399         movdqa  %xmm0,48(%rsp)
1400         movdqa  %xmm0,64(%rsp)
1401         movdqa  %xmm0,80(%rsp)
1402         movdqa  %xmm0,96(%rsp)
1403         andl    $0x80100,%eax
1404         cmpl    $0x80100,%eax
1405         je      .Lby_one_callx
1406         call    __rsaz_512_reduce
1407         jmp     .Lby_one_tail
1408 .align  32
1409 .Lby_one_callx:
1410         movq    128(%rsp),%rdx
1411         call    __rsaz_512_reducex
1412 .Lby_one_tail:
1413         movq    %r8,(%rdi)
1414         movq    %r9,8(%rdi)
1415         movq    %r10,16(%rdi)
1416         movq    %r11,24(%rdi)
1417         movq    %r12,32(%rdi)
1418         movq    %r13,40(%rdi)
1419         movq    %r14,48(%rdi)
1420         movq    %r15,56(%rdi)
1421
1422         leaq    128+24+48(%rsp),%rax
1423 .cfi_def_cfa    %rax,8
1424         movq    -48(%rax),%r15
1425 .cfi_restore    %r15
1426         movq    -40(%rax),%r14
1427 .cfi_restore    %r14
1428         movq    -32(%rax),%r13
1429 .cfi_restore    %r13
1430         movq    -24(%rax),%r12
1431 .cfi_restore    %r12
1432         movq    -16(%rax),%rbp
1433 .cfi_restore    %rbp
1434         movq    -8(%rax),%rbx
1435 .cfi_restore    %rbx
1436         leaq    (%rax),%rsp
1437 .cfi_def_cfa_register   %rsp
1438 .Lmul_by_one_epilogue:
1439         .byte   0xf3,0xc3
1440 .cfi_endproc    
1441 .size   rsaz_512_mul_by_one,.-rsaz_512_mul_by_one
1442 .type   __rsaz_512_reduce,@function
1443 .align  32
1444 __rsaz_512_reduce:
1445         movq    %r8,%rbx
1446         imulq   128+8(%rsp),%rbx
1447         movq    0(%rbp),%rax
1448         movl    $8,%ecx
1449         jmp     .Lreduction_loop
1450
1451 .align  32
1452 .Lreduction_loop:
1453         mulq    %rbx
1454         movq    8(%rbp),%rax
1455         negq    %r8
1456         movq    %rdx,%r8
1457         adcq    $0,%r8
1458
1459         mulq    %rbx
1460         addq    %rax,%r9
1461         movq    16(%rbp),%rax
1462         adcq    $0,%rdx
1463         addq    %r9,%r8
1464         movq    %rdx,%r9
1465         adcq    $0,%r9
1466
1467         mulq    %rbx
1468         addq    %rax,%r10
1469         movq    24(%rbp),%rax
1470         adcq    $0,%rdx
1471         addq    %r10,%r9
1472         movq    %rdx,%r10
1473         adcq    $0,%r10
1474
1475         mulq    %rbx
1476         addq    %rax,%r11
1477         movq    32(%rbp),%rax
1478         adcq    $0,%rdx
1479         addq    %r11,%r10
1480         movq    128+8(%rsp),%rsi
1481
1482
1483         adcq    $0,%rdx
1484         movq    %rdx,%r11
1485
1486         mulq    %rbx
1487         addq    %rax,%r12
1488         movq    40(%rbp),%rax
1489         adcq    $0,%rdx
1490         imulq   %r8,%rsi
1491         addq    %r12,%r11
1492         movq    %rdx,%r12
1493         adcq    $0,%r12
1494
1495         mulq    %rbx
1496         addq    %rax,%r13
1497         movq    48(%rbp),%rax
1498         adcq    $0,%rdx
1499         addq    %r13,%r12
1500         movq    %rdx,%r13
1501         adcq    $0,%r13
1502
1503         mulq    %rbx
1504         addq    %rax,%r14
1505         movq    56(%rbp),%rax
1506         adcq    $0,%rdx
1507         addq    %r14,%r13
1508         movq    %rdx,%r14
1509         adcq    $0,%r14
1510
1511         mulq    %rbx
1512         movq    %rsi,%rbx
1513         addq    %rax,%r15
1514         movq    0(%rbp),%rax
1515         adcq    $0,%rdx
1516         addq    %r15,%r14
1517         movq    %rdx,%r15
1518         adcq    $0,%r15
1519
1520         decl    %ecx
1521         jne     .Lreduction_loop
1522
1523         .byte   0xf3,0xc3
1524 .size   __rsaz_512_reduce,.-__rsaz_512_reduce
1525 .type   __rsaz_512_reducex,@function
1526 .align  32
1527 __rsaz_512_reducex:
1528
1529         imulq   %r8,%rdx
1530         xorq    %rsi,%rsi
1531         movl    $8,%ecx
1532         jmp     .Lreduction_loopx
1533
1534 .align  32
1535 .Lreduction_loopx:
1536         movq    %r8,%rbx
1537         mulxq   0(%rbp),%rax,%r8
1538         adcxq   %rbx,%rax
1539         adoxq   %r9,%r8
1540
1541         mulxq   8(%rbp),%rax,%r9
1542         adcxq   %rax,%r8
1543         adoxq   %r10,%r9
1544
1545         mulxq   16(%rbp),%rbx,%r10
1546         adcxq   %rbx,%r9
1547         adoxq   %r11,%r10
1548
1549         mulxq   24(%rbp),%rbx,%r11
1550         adcxq   %rbx,%r10
1551         adoxq   %r12,%r11
1552
1553 .byte   0xc4,0x62,0xe3,0xf6,0xa5,0x20,0x00,0x00,0x00
1554         movq    %rdx,%rax
1555         movq    %r8,%rdx
1556         adcxq   %rbx,%r11
1557         adoxq   %r13,%r12
1558
1559         mulxq   128+8(%rsp),%rbx,%rdx
1560         movq    %rax,%rdx
1561
1562         mulxq   40(%rbp),%rax,%r13
1563         adcxq   %rax,%r12
1564         adoxq   %r14,%r13
1565
1566 .byte   0xc4,0x62,0xfb,0xf6,0xb5,0x30,0x00,0x00,0x00
1567         adcxq   %rax,%r13
1568         adoxq   %r15,%r14
1569
1570         mulxq   56(%rbp),%rax,%r15
1571         movq    %rbx,%rdx
1572         adcxq   %rax,%r14
1573         adoxq   %rsi,%r15
1574         adcxq   %rsi,%r15
1575
1576         decl    %ecx
1577         jne     .Lreduction_loopx
1578
1579         .byte   0xf3,0xc3
1580 .size   __rsaz_512_reducex,.-__rsaz_512_reducex
1581 .type   __rsaz_512_subtract,@function
1582 .align  32
1583 __rsaz_512_subtract:
1584         movq    %r8,(%rdi)
1585         movq    %r9,8(%rdi)
1586         movq    %r10,16(%rdi)
1587         movq    %r11,24(%rdi)
1588         movq    %r12,32(%rdi)
1589         movq    %r13,40(%rdi)
1590         movq    %r14,48(%rdi)
1591         movq    %r15,56(%rdi)
1592
1593         movq    0(%rbp),%r8
1594         movq    8(%rbp),%r9
1595         negq    %r8
1596         notq    %r9
1597         andq    %rcx,%r8
1598         movq    16(%rbp),%r10
1599         andq    %rcx,%r9
1600         notq    %r10
1601         movq    24(%rbp),%r11
1602         andq    %rcx,%r10
1603         notq    %r11
1604         movq    32(%rbp),%r12
1605         andq    %rcx,%r11
1606         notq    %r12
1607         movq    40(%rbp),%r13
1608         andq    %rcx,%r12
1609         notq    %r13
1610         movq    48(%rbp),%r14
1611         andq    %rcx,%r13
1612         notq    %r14
1613         movq    56(%rbp),%r15
1614         andq    %rcx,%r14
1615         notq    %r15
1616         andq    %rcx,%r15
1617
1618         addq    (%rdi),%r8
1619         adcq    8(%rdi),%r9
1620         adcq    16(%rdi),%r10
1621         adcq    24(%rdi),%r11
1622         adcq    32(%rdi),%r12
1623         adcq    40(%rdi),%r13
1624         adcq    48(%rdi),%r14
1625         adcq    56(%rdi),%r15
1626
1627         movq    %r8,(%rdi)
1628         movq    %r9,8(%rdi)
1629         movq    %r10,16(%rdi)
1630         movq    %r11,24(%rdi)
1631         movq    %r12,32(%rdi)
1632         movq    %r13,40(%rdi)
1633         movq    %r14,48(%rdi)
1634         movq    %r15,56(%rdi)
1635
1636         .byte   0xf3,0xc3
1637 .size   __rsaz_512_subtract,.-__rsaz_512_subtract
1638 .type   __rsaz_512_mul,@function
1639 .align  32
1640 __rsaz_512_mul:
1641         leaq    8(%rsp),%rdi
1642
1643         movq    (%rsi),%rax
1644         mulq    %rbx
1645         movq    %rax,(%rdi)
1646         movq    8(%rsi),%rax
1647         movq    %rdx,%r8
1648
1649         mulq    %rbx
1650         addq    %rax,%r8
1651         movq    16(%rsi),%rax
1652         movq    %rdx,%r9
1653         adcq    $0,%r9
1654
1655         mulq    %rbx
1656         addq    %rax,%r9
1657         movq    24(%rsi),%rax
1658         movq    %rdx,%r10
1659         adcq    $0,%r10
1660
1661         mulq    %rbx
1662         addq    %rax,%r10
1663         movq    32(%rsi),%rax
1664         movq    %rdx,%r11
1665         adcq    $0,%r11
1666
1667         mulq    %rbx
1668         addq    %rax,%r11
1669         movq    40(%rsi),%rax
1670         movq    %rdx,%r12
1671         adcq    $0,%r12
1672
1673         mulq    %rbx
1674         addq    %rax,%r12
1675         movq    48(%rsi),%rax
1676         movq    %rdx,%r13
1677         adcq    $0,%r13
1678
1679         mulq    %rbx
1680         addq    %rax,%r13
1681         movq    56(%rsi),%rax
1682         movq    %rdx,%r14
1683         adcq    $0,%r14
1684
1685         mulq    %rbx
1686         addq    %rax,%r14
1687         movq    (%rsi),%rax
1688         movq    %rdx,%r15
1689         adcq    $0,%r15
1690
1691         leaq    8(%rbp),%rbp
1692         leaq    8(%rdi),%rdi
1693
1694         movl    $7,%ecx
1695         jmp     .Loop_mul
1696
1697 .align  32
1698 .Loop_mul:
1699         movq    (%rbp),%rbx
1700         mulq    %rbx
1701         addq    %rax,%r8
1702         movq    8(%rsi),%rax
1703         movq    %r8,(%rdi)
1704         movq    %rdx,%r8
1705         adcq    $0,%r8
1706
1707         mulq    %rbx
1708         addq    %rax,%r9
1709         movq    16(%rsi),%rax
1710         adcq    $0,%rdx
1711         addq    %r9,%r8
1712         movq    %rdx,%r9
1713         adcq    $0,%r9
1714
1715         mulq    %rbx
1716         addq    %rax,%r10
1717         movq    24(%rsi),%rax
1718         adcq    $0,%rdx
1719         addq    %r10,%r9
1720         movq    %rdx,%r10
1721         adcq    $0,%r10
1722
1723         mulq    %rbx
1724         addq    %rax,%r11
1725         movq    32(%rsi),%rax
1726         adcq    $0,%rdx
1727         addq    %r11,%r10
1728         movq    %rdx,%r11
1729         adcq    $0,%r11
1730
1731         mulq    %rbx
1732         addq    %rax,%r12
1733         movq    40(%rsi),%rax
1734         adcq    $0,%rdx
1735         addq    %r12,%r11
1736         movq    %rdx,%r12
1737         adcq    $0,%r12
1738
1739         mulq    %rbx
1740         addq    %rax,%r13
1741         movq    48(%rsi),%rax
1742         adcq    $0,%rdx
1743         addq    %r13,%r12
1744         movq    %rdx,%r13
1745         adcq    $0,%r13
1746
1747         mulq    %rbx
1748         addq    %rax,%r14
1749         movq    56(%rsi),%rax
1750         adcq    $0,%rdx
1751         addq    %r14,%r13
1752         movq    %rdx,%r14
1753         leaq    8(%rbp),%rbp
1754         adcq    $0,%r14
1755
1756         mulq    %rbx
1757         addq    %rax,%r15
1758         movq    (%rsi),%rax
1759         adcq    $0,%rdx
1760         addq    %r15,%r14
1761         movq    %rdx,%r15
1762         adcq    $0,%r15
1763
1764         leaq    8(%rdi),%rdi
1765
1766         decl    %ecx
1767         jnz     .Loop_mul
1768
1769         movq    %r8,(%rdi)
1770         movq    %r9,8(%rdi)
1771         movq    %r10,16(%rdi)
1772         movq    %r11,24(%rdi)
1773         movq    %r12,32(%rdi)
1774         movq    %r13,40(%rdi)
1775         movq    %r14,48(%rdi)
1776         movq    %r15,56(%rdi)
1777
1778         .byte   0xf3,0xc3
1779 .size   __rsaz_512_mul,.-__rsaz_512_mul
1780 .type   __rsaz_512_mulx,@function
1781 .align  32
1782 __rsaz_512_mulx:
1783         mulxq   (%rsi),%rbx,%r8
1784         movq    $-6,%rcx
1785
1786         mulxq   8(%rsi),%rax,%r9
1787         movq    %rbx,8(%rsp)
1788
1789         mulxq   16(%rsi),%rbx,%r10
1790         adcq    %rax,%r8
1791
1792         mulxq   24(%rsi),%rax,%r11
1793         adcq    %rbx,%r9
1794
1795         mulxq   32(%rsi),%rbx,%r12
1796         adcq    %rax,%r10
1797
1798         mulxq   40(%rsi),%rax,%r13
1799         adcq    %rbx,%r11
1800
1801         mulxq   48(%rsi),%rbx,%r14
1802         adcq    %rax,%r12
1803
1804         mulxq   56(%rsi),%rax,%r15
1805         movq    8(%rbp),%rdx
1806         adcq    %rbx,%r13
1807         adcq    %rax,%r14
1808         adcq    $0,%r15
1809
1810         xorq    %rdi,%rdi
1811         jmp     .Loop_mulx
1812
1813 .align  32
1814 .Loop_mulx:
1815         movq    %r8,%rbx
1816         mulxq   (%rsi),%rax,%r8
1817         adcxq   %rax,%rbx
1818         adoxq   %r9,%r8
1819
1820         mulxq   8(%rsi),%rax,%r9
1821         adcxq   %rax,%r8
1822         adoxq   %r10,%r9
1823
1824         mulxq   16(%rsi),%rax,%r10
1825         adcxq   %rax,%r9
1826         adoxq   %r11,%r10
1827
1828         mulxq   24(%rsi),%rax,%r11
1829         adcxq   %rax,%r10
1830         adoxq   %r12,%r11
1831
1832 .byte   0x3e,0xc4,0x62,0xfb,0xf6,0xa6,0x20,0x00,0x00,0x00
1833         adcxq   %rax,%r11
1834         adoxq   %r13,%r12
1835
1836         mulxq   40(%rsi),%rax,%r13
1837         adcxq   %rax,%r12
1838         adoxq   %r14,%r13
1839
1840         mulxq   48(%rsi),%rax,%r14
1841         adcxq   %rax,%r13
1842         adoxq   %r15,%r14
1843
1844         mulxq   56(%rsi),%rax,%r15
1845         movq    64(%rbp,%rcx,8),%rdx
1846         movq    %rbx,8+64-8(%rsp,%rcx,8)
1847         adcxq   %rax,%r14
1848         adoxq   %rdi,%r15
1849         adcxq   %rdi,%r15
1850
1851         incq    %rcx
1852         jnz     .Loop_mulx
1853
1854         movq    %r8,%rbx
1855         mulxq   (%rsi),%rax,%r8
1856         adcxq   %rax,%rbx
1857         adoxq   %r9,%r8
1858
1859 .byte   0xc4,0x62,0xfb,0xf6,0x8e,0x08,0x00,0x00,0x00
1860         adcxq   %rax,%r8
1861         adoxq   %r10,%r9
1862
1863 .byte   0xc4,0x62,0xfb,0xf6,0x96,0x10,0x00,0x00,0x00
1864         adcxq   %rax,%r9
1865         adoxq   %r11,%r10
1866
1867         mulxq   24(%rsi),%rax,%r11
1868         adcxq   %rax,%r10
1869         adoxq   %r12,%r11
1870
1871         mulxq   32(%rsi),%rax,%r12
1872         adcxq   %rax,%r11
1873         adoxq   %r13,%r12
1874
1875         mulxq   40(%rsi),%rax,%r13
1876         adcxq   %rax,%r12
1877         adoxq   %r14,%r13
1878
1879 .byte   0xc4,0x62,0xfb,0xf6,0xb6,0x30,0x00,0x00,0x00
1880         adcxq   %rax,%r13
1881         adoxq   %r15,%r14
1882
1883 .byte   0xc4,0x62,0xfb,0xf6,0xbe,0x38,0x00,0x00,0x00
1884         adcxq   %rax,%r14
1885         adoxq   %rdi,%r15
1886         adcxq   %rdi,%r15
1887
1888         movq    %rbx,8+64-8(%rsp)
1889         movq    %r8,8+64(%rsp)
1890         movq    %r9,8+64+8(%rsp)
1891         movq    %r10,8+64+16(%rsp)
1892         movq    %r11,8+64+24(%rsp)
1893         movq    %r12,8+64+32(%rsp)
1894         movq    %r13,8+64+40(%rsp)
1895         movq    %r14,8+64+48(%rsp)
1896         movq    %r15,8+64+56(%rsp)
1897
1898         .byte   0xf3,0xc3
1899 .size   __rsaz_512_mulx,.-__rsaz_512_mulx
1900 .globl  rsaz_512_scatter4
1901 .type   rsaz_512_scatter4,@function
1902 .align  16
1903 rsaz_512_scatter4:
1904         leaq    (%rdi,%rdx,8),%rdi
1905         movl    $8,%r9d
1906         jmp     .Loop_scatter
1907 .align  16
1908 .Loop_scatter:
1909         movq    (%rsi),%rax
1910         leaq    8(%rsi),%rsi
1911         movq    %rax,(%rdi)
1912         leaq    128(%rdi),%rdi
1913         decl    %r9d
1914         jnz     .Loop_scatter
1915         .byte   0xf3,0xc3
1916 .size   rsaz_512_scatter4,.-rsaz_512_scatter4
1917
1918 .globl  rsaz_512_gather4
1919 .type   rsaz_512_gather4,@function
1920 .align  16
1921 rsaz_512_gather4:
1922         movd    %edx,%xmm8
1923         movdqa  .Linc+16(%rip),%xmm1
1924         movdqa  .Linc(%rip),%xmm0
1925
1926         pshufd  $0,%xmm8,%xmm8
1927         movdqa  %xmm1,%xmm7
1928         movdqa  %xmm1,%xmm2
1929         paddd   %xmm0,%xmm1
1930         pcmpeqd %xmm8,%xmm0
1931         movdqa  %xmm7,%xmm3
1932         paddd   %xmm1,%xmm2
1933         pcmpeqd %xmm8,%xmm1
1934         movdqa  %xmm7,%xmm4
1935         paddd   %xmm2,%xmm3
1936         pcmpeqd %xmm8,%xmm2
1937         movdqa  %xmm7,%xmm5
1938         paddd   %xmm3,%xmm4
1939         pcmpeqd %xmm8,%xmm3
1940         movdqa  %xmm7,%xmm6
1941         paddd   %xmm4,%xmm5
1942         pcmpeqd %xmm8,%xmm4
1943         paddd   %xmm5,%xmm6
1944         pcmpeqd %xmm8,%xmm5
1945         paddd   %xmm6,%xmm7
1946         pcmpeqd %xmm8,%xmm6
1947         pcmpeqd %xmm8,%xmm7
1948         movl    $8,%r9d
1949         jmp     .Loop_gather
1950 .align  16
1951 .Loop_gather:
1952         movdqa  0(%rsi),%xmm8
1953         movdqa  16(%rsi),%xmm9
1954         movdqa  32(%rsi),%xmm10
1955         movdqa  48(%rsi),%xmm11
1956         pand    %xmm0,%xmm8
1957         movdqa  64(%rsi),%xmm12
1958         pand    %xmm1,%xmm9
1959         movdqa  80(%rsi),%xmm13
1960         pand    %xmm2,%xmm10
1961         movdqa  96(%rsi),%xmm14
1962         pand    %xmm3,%xmm11
1963         movdqa  112(%rsi),%xmm15
1964         leaq    128(%rsi),%rsi
1965         pand    %xmm4,%xmm12
1966         pand    %xmm5,%xmm13
1967         pand    %xmm6,%xmm14
1968         pand    %xmm7,%xmm15
1969         por     %xmm10,%xmm8
1970         por     %xmm11,%xmm9
1971         por     %xmm12,%xmm8
1972         por     %xmm13,%xmm9
1973         por     %xmm14,%xmm8
1974         por     %xmm15,%xmm9
1975
1976         por     %xmm9,%xmm8
1977         pshufd  $0x4e,%xmm8,%xmm9
1978         por     %xmm9,%xmm8
1979         movq    %xmm8,(%rdi)
1980         leaq    8(%rdi),%rdi
1981         decl    %r9d
1982         jnz     .Loop_gather
1983         .byte   0xf3,0xc3
1984 .LSEH_end_rsaz_512_gather4:
1985 .size   rsaz_512_gather4,.-rsaz_512_gather4
1986
1987 .align  64
1988 .Linc:
1989 .long   0,0, 1,1
1990 .long   2,2, 2,2