Added Appro's SSSE3 SHA implementations
[gnutls:gnutls.git] / lib / accelerated / x86 / coff / sha512-ssse3-x86.s
1 # Copyright (c) 2011-2012, Andy Polyakov <appro@openssl.org>
2 # All rights reserved.
3 #
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions
6 # are met:
7
8 #     * Redistributions of source code must retain copyright notices,
9 #      this list of conditions and the following disclaimer.
10 #
11 #     * Redistributions in binary form must reproduce the above
12 #      copyright notice, this list of conditions and the following
13 #      disclaimer in the documentation and/or other materials
14 #      provided with the distribution.
15 #
16 #     * Neither the name of the Andy Polyakov nor the names of its
17 #      copyright holder and contributors may be used to endorse or
18 #      promote products derived from this software without specific
19 #      prior written permission.
20 #
21 # ALTERNATIVELY, provided that this notice is retained in full, this
22 # product may be distributed under the terms of the GNU General Public
23 # License (GPL), in which case the provisions of the GPL apply INSTEAD OF
24 # those given above.
25 #
26 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS
27 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 #
38 # *** This file is auto-generated ***
39 #
40 .file   "sha512-586.s"
41 .text
42 .globl  _sha512_block_data_order
43 .def    _sha512_block_data_order;       .scl    2;      .type   32;     .endef
44 .align  16
45 _sha512_block_data_order:
46 .L_sha512_block_data_order_begin:
47         pushl   %ebp
48         pushl   %ebx
49         pushl   %esi
50         pushl   %edi
51         movl    20(%esp),%esi
52         movl    24(%esp),%edi
53         movl    28(%esp),%eax
54         movl    %esp,%ebx
55         call    .L000pic_point
56 .L000pic_point:
57         popl    %ebp
58         leal    .L001K512-.L000pic_point(%ebp),%ebp
59         subl    $16,%esp
60         andl    $-64,%esp
61         shll    $7,%eax
62         addl    %edi,%eax
63         movl    %esi,(%esp)
64         movl    %edi,4(%esp)
65         movl    %eax,8(%esp)
66         movl    %ebx,12(%esp)
67 .align  16
68 .L002loop_x86:
69         movl    (%edi),%eax
70         movl    4(%edi),%ebx
71         movl    8(%edi),%ecx
72         movl    12(%edi),%edx
73         bswap   %eax
74         bswap   %ebx
75         bswap   %ecx
76         bswap   %edx
77         pushl   %eax
78         pushl   %ebx
79         pushl   %ecx
80         pushl   %edx
81         movl    16(%edi),%eax
82         movl    20(%edi),%ebx
83         movl    24(%edi),%ecx
84         movl    28(%edi),%edx
85         bswap   %eax
86         bswap   %ebx
87         bswap   %ecx
88         bswap   %edx
89         pushl   %eax
90         pushl   %ebx
91         pushl   %ecx
92         pushl   %edx
93         movl    32(%edi),%eax
94         movl    36(%edi),%ebx
95         movl    40(%edi),%ecx
96         movl    44(%edi),%edx
97         bswap   %eax
98         bswap   %ebx
99         bswap   %ecx
100         bswap   %edx
101         pushl   %eax
102         pushl   %ebx
103         pushl   %ecx
104         pushl   %edx
105         movl    48(%edi),%eax
106         movl    52(%edi),%ebx
107         movl    56(%edi),%ecx
108         movl    60(%edi),%edx
109         bswap   %eax
110         bswap   %ebx
111         bswap   %ecx
112         bswap   %edx
113         pushl   %eax
114         pushl   %ebx
115         pushl   %ecx
116         pushl   %edx
117         movl    64(%edi),%eax
118         movl    68(%edi),%ebx
119         movl    72(%edi),%ecx
120         movl    76(%edi),%edx
121         bswap   %eax
122         bswap   %ebx
123         bswap   %ecx
124         bswap   %edx
125         pushl   %eax
126         pushl   %ebx
127         pushl   %ecx
128         pushl   %edx
129         movl    80(%edi),%eax
130         movl    84(%edi),%ebx
131         movl    88(%edi),%ecx
132         movl    92(%edi),%edx
133         bswap   %eax
134         bswap   %ebx
135         bswap   %ecx
136         bswap   %edx
137         pushl   %eax
138         pushl   %ebx
139         pushl   %ecx
140         pushl   %edx
141         movl    96(%edi),%eax
142         movl    100(%edi),%ebx
143         movl    104(%edi),%ecx
144         movl    108(%edi),%edx
145         bswap   %eax
146         bswap   %ebx
147         bswap   %ecx
148         bswap   %edx
149         pushl   %eax
150         pushl   %ebx
151         pushl   %ecx
152         pushl   %edx
153         movl    112(%edi),%eax
154         movl    116(%edi),%ebx
155         movl    120(%edi),%ecx
156         movl    124(%edi),%edx
157         bswap   %eax
158         bswap   %ebx
159         bswap   %ecx
160         bswap   %edx
161         pushl   %eax
162         pushl   %ebx
163         pushl   %ecx
164         pushl   %edx
165         addl    $128,%edi
166         subl    $72,%esp
167         movl    %edi,204(%esp)
168         leal    8(%esp),%edi
169         movl    $16,%ecx
170 .long   2784229001
171 .align  16
172 .L00300_15_x86:
173         movl    40(%esp),%ecx
174         movl    44(%esp),%edx
175         movl    %ecx,%esi
176         shrl    $9,%ecx
177         movl    %edx,%edi
178         shrl    $9,%edx
179         movl    %ecx,%ebx
180         shll    $14,%esi
181         movl    %edx,%eax
182         shll    $14,%edi
183         xorl    %esi,%ebx
184         shrl    $5,%ecx
185         xorl    %edi,%eax
186         shrl    $5,%edx
187         xorl    %ecx,%eax
188         shll    $4,%esi
189         xorl    %edx,%ebx
190         shll    $4,%edi
191         xorl    %esi,%ebx
192         shrl    $4,%ecx
193         xorl    %edi,%eax
194         shrl    $4,%edx
195         xorl    %ecx,%eax
196         shll    $5,%esi
197         xorl    %edx,%ebx
198         shll    $5,%edi
199         xorl    %esi,%eax
200         xorl    %edi,%ebx
201         movl    48(%esp),%ecx
202         movl    52(%esp),%edx
203         movl    56(%esp),%esi
204         movl    60(%esp),%edi
205         addl    64(%esp),%eax
206         adcl    68(%esp),%ebx
207         xorl    %esi,%ecx
208         xorl    %edi,%edx
209         andl    40(%esp),%ecx
210         andl    44(%esp),%edx
211         addl    192(%esp),%eax
212         adcl    196(%esp),%ebx
213         xorl    %esi,%ecx
214         xorl    %edi,%edx
215         movl    (%ebp),%esi
216         movl    4(%ebp),%edi
217         addl    %ecx,%eax
218         adcl    %edx,%ebx
219         movl    32(%esp),%ecx
220         movl    36(%esp),%edx
221         addl    %esi,%eax
222         adcl    %edi,%ebx
223         movl    %eax,(%esp)
224         movl    %ebx,4(%esp)
225         addl    %ecx,%eax
226         adcl    %edx,%ebx
227         movl    8(%esp),%ecx
228         movl    12(%esp),%edx
229         movl    %eax,32(%esp)
230         movl    %ebx,36(%esp)
231         movl    %ecx,%esi
232         shrl    $2,%ecx
233         movl    %edx,%edi
234         shrl    $2,%edx
235         movl    %ecx,%ebx
236         shll    $4,%esi
237         movl    %edx,%eax
238         shll    $4,%edi
239         xorl    %esi,%ebx
240         shrl    $5,%ecx
241         xorl    %edi,%eax
242         shrl    $5,%edx
243         xorl    %ecx,%ebx
244         shll    $21,%esi
245         xorl    %edx,%eax
246         shll    $21,%edi
247         xorl    %esi,%eax
248         shrl    $21,%ecx
249         xorl    %edi,%ebx
250         shrl    $21,%edx
251         xorl    %ecx,%eax
252         shll    $5,%esi
253         xorl    %edx,%ebx
254         shll    $5,%edi
255         xorl    %esi,%eax
256         xorl    %edi,%ebx
257         movl    8(%esp),%ecx
258         movl    12(%esp),%edx
259         movl    16(%esp),%esi
260         movl    20(%esp),%edi
261         addl    (%esp),%eax
262         adcl    4(%esp),%ebx
263         orl     %esi,%ecx
264         orl     %edi,%edx
265         andl    24(%esp),%ecx
266         andl    28(%esp),%edx
267         andl    8(%esp),%esi
268         andl    12(%esp),%edi
269         orl     %esi,%ecx
270         orl     %edi,%edx
271         addl    %ecx,%eax
272         adcl    %edx,%ebx
273         movl    %eax,(%esp)
274         movl    %ebx,4(%esp)
275         movb    (%ebp),%dl
276         subl    $8,%esp
277         leal    8(%ebp),%ebp
278         cmpb    $148,%dl
279         jne     .L00300_15_x86
280 .align  16
281 .L00416_79_x86:
282         movl    312(%esp),%ecx
283         movl    316(%esp),%edx
284         movl    %ecx,%esi
285         shrl    $1,%ecx
286         movl    %edx,%edi
287         shrl    $1,%edx
288         movl    %ecx,%eax
289         shll    $24,%esi
290         movl    %edx,%ebx
291         shll    $24,%edi
292         xorl    %esi,%ebx
293         shrl    $6,%ecx
294         xorl    %edi,%eax
295         shrl    $6,%edx
296         xorl    %ecx,%eax
297         shll    $7,%esi
298         xorl    %edx,%ebx
299         shll    $1,%edi
300         xorl    %esi,%ebx
301         shrl    $1,%ecx
302         xorl    %edi,%eax
303         shrl    $1,%edx
304         xorl    %ecx,%eax
305         shll    $6,%edi
306         xorl    %edx,%ebx
307         xorl    %edi,%eax
308         movl    %eax,(%esp)
309         movl    %ebx,4(%esp)
310         movl    208(%esp),%ecx
311         movl    212(%esp),%edx
312         movl    %ecx,%esi
313         shrl    $6,%ecx
314         movl    %edx,%edi
315         shrl    $6,%edx
316         movl    %ecx,%eax
317         shll    $3,%esi
318         movl    %edx,%ebx
319         shll    $3,%edi
320         xorl    %esi,%eax
321         shrl    $13,%ecx
322         xorl    %edi,%ebx
323         shrl    $13,%edx
324         xorl    %ecx,%eax
325         shll    $10,%esi
326         xorl    %edx,%ebx
327         shll    $10,%edi
328         xorl    %esi,%ebx
329         shrl    $10,%ecx
330         xorl    %edi,%eax
331         shrl    $10,%edx
332         xorl    %ecx,%ebx
333         shll    $13,%edi
334         xorl    %edx,%eax
335         xorl    %edi,%eax
336         movl    320(%esp),%ecx
337         movl    324(%esp),%edx
338         addl    (%esp),%eax
339         adcl    4(%esp),%ebx
340         movl    248(%esp),%esi
341         movl    252(%esp),%edi
342         addl    %ecx,%eax
343         adcl    %edx,%ebx
344         addl    %esi,%eax
345         adcl    %edi,%ebx
346         movl    %eax,192(%esp)
347         movl    %ebx,196(%esp)
348         movl    40(%esp),%ecx
349         movl    44(%esp),%edx
350         movl    %ecx,%esi
351         shrl    $9,%ecx
352         movl    %edx,%edi
353         shrl    $9,%edx
354         movl    %ecx,%ebx
355         shll    $14,%esi
356         movl    %edx,%eax
357         shll    $14,%edi
358         xorl    %esi,%ebx
359         shrl    $5,%ecx
360         xorl    %edi,%eax
361         shrl    $5,%edx
362         xorl    %ecx,%eax
363         shll    $4,%esi
364         xorl    %edx,%ebx
365         shll    $4,%edi
366         xorl    %esi,%ebx
367         shrl    $4,%ecx
368         xorl    %edi,%eax
369         shrl    $4,%edx
370         xorl    %ecx,%eax
371         shll    $5,%esi
372         xorl    %edx,%ebx
373         shll    $5,%edi
374         xorl    %esi,%eax
375         xorl    %edi,%ebx
376         movl    48(%esp),%ecx
377         movl    52(%esp),%edx
378         movl    56(%esp),%esi
379         movl    60(%esp),%edi
380         addl    64(%esp),%eax
381         adcl    68(%esp),%ebx
382         xorl    %esi,%ecx
383         xorl    %edi,%edx
384         andl    40(%esp),%ecx
385         andl    44(%esp),%edx
386         addl    192(%esp),%eax
387         adcl    196(%esp),%ebx
388         xorl    %esi,%ecx
389         xorl    %edi,%edx
390         movl    (%ebp),%esi
391         movl    4(%ebp),%edi
392         addl    %ecx,%eax
393         adcl    %edx,%ebx
394         movl    32(%esp),%ecx
395         movl    36(%esp),%edx
396         addl    %esi,%eax
397         adcl    %edi,%ebx
398         movl    %eax,(%esp)
399         movl    %ebx,4(%esp)
400         addl    %ecx,%eax
401         adcl    %edx,%ebx
402         movl    8(%esp),%ecx
403         movl    12(%esp),%edx
404         movl    %eax,32(%esp)
405         movl    %ebx,36(%esp)
406         movl    %ecx,%esi
407         shrl    $2,%ecx
408         movl    %edx,%edi
409         shrl    $2,%edx
410         movl    %ecx,%ebx
411         shll    $4,%esi
412         movl    %edx,%eax
413         shll    $4,%edi
414         xorl    %esi,%ebx
415         shrl    $5,%ecx
416         xorl    %edi,%eax
417         shrl    $5,%edx
418         xorl    %ecx,%ebx
419         shll    $21,%esi
420         xorl    %edx,%eax
421         shll    $21,%edi
422         xorl    %esi,%eax
423         shrl    $21,%ecx
424         xorl    %edi,%ebx
425         shrl    $21,%edx
426         xorl    %ecx,%eax
427         shll    $5,%esi
428         xorl    %edx,%ebx
429         shll    $5,%edi
430         xorl    %esi,%eax
431         xorl    %edi,%ebx
432         movl    8(%esp),%ecx
433         movl    12(%esp),%edx
434         movl    16(%esp),%esi
435         movl    20(%esp),%edi
436         addl    (%esp),%eax
437         adcl    4(%esp),%ebx
438         orl     %esi,%ecx
439         orl     %edi,%edx
440         andl    24(%esp),%ecx
441         andl    28(%esp),%edx
442         andl    8(%esp),%esi
443         andl    12(%esp),%edi
444         orl     %esi,%ecx
445         orl     %edi,%edx
446         addl    %ecx,%eax
447         adcl    %edx,%ebx
448         movl    %eax,(%esp)
449         movl    %ebx,4(%esp)
450         movb    (%ebp),%dl
451         subl    $8,%esp
452         leal    8(%ebp),%ebp
453         cmpb    $23,%dl
454         jne     .L00416_79_x86
455         movl    840(%esp),%esi
456         movl    844(%esp),%edi
457         movl    (%esi),%eax
458         movl    4(%esi),%ebx
459         movl    8(%esi),%ecx
460         movl    12(%esi),%edx
461         addl    8(%esp),%eax
462         adcl    12(%esp),%ebx
463         movl    %eax,(%esi)
464         movl    %ebx,4(%esi)
465         addl    16(%esp),%ecx
466         adcl    20(%esp),%edx
467         movl    %ecx,8(%esi)
468         movl    %edx,12(%esi)
469         movl    16(%esi),%eax
470         movl    20(%esi),%ebx
471         movl    24(%esi),%ecx
472         movl    28(%esi),%edx
473         addl    24(%esp),%eax
474         adcl    28(%esp),%ebx
475         movl    %eax,16(%esi)
476         movl    %ebx,20(%esi)
477         addl    32(%esp),%ecx
478         adcl    36(%esp),%edx
479         movl    %ecx,24(%esi)
480         movl    %edx,28(%esi)
481         movl    32(%esi),%eax
482         movl    36(%esi),%ebx
483         movl    40(%esi),%ecx
484         movl    44(%esi),%edx
485         addl    40(%esp),%eax
486         adcl    44(%esp),%ebx
487         movl    %eax,32(%esi)
488         movl    %ebx,36(%esi)
489         addl    48(%esp),%ecx
490         adcl    52(%esp),%edx
491         movl    %ecx,40(%esi)
492         movl    %edx,44(%esi)
493         movl    48(%esi),%eax
494         movl    52(%esi),%ebx
495         movl    56(%esi),%ecx
496         movl    60(%esi),%edx
497         addl    56(%esp),%eax
498         adcl    60(%esp),%ebx
499         movl    %eax,48(%esi)
500         movl    %ebx,52(%esi)
501         addl    64(%esp),%ecx
502         adcl    68(%esp),%edx
503         movl    %ecx,56(%esi)
504         movl    %edx,60(%esi)
505         addl    $840,%esp
506         subl    $640,%ebp
507         cmpl    8(%esp),%edi
508         jb      .L002loop_x86
509         movl    12(%esp),%esp
510         popl    %edi
511         popl    %esi
512         popl    %ebx
513         popl    %ebp
514         ret
515 .align  64
516 .L001K512:
517 .long   3609767458,1116352408
518 .long   602891725,1899447441
519 .long   3964484399,3049323471
520 .long   2173295548,3921009573
521 .long   4081628472,961987163
522 .long   3053834265,1508970993
523 .long   2937671579,2453635748
524 .long   3664609560,2870763221
525 .long   2734883394,3624381080
526 .long   1164996542,310598401
527 .long   1323610764,607225278
528 .long   3590304994,1426881987
529 .long   4068182383,1925078388
530 .long   991336113,2162078206
531 .long   633803317,2614888103
532 .long   3479774868,3248222580
533 .long   2666613458,3835390401
534 .long   944711139,4022224774
535 .long   2341262773,264347078
536 .long   2007800933,604807628
537 .long   1495990901,770255983
538 .long   1856431235,1249150122
539 .long   3175218132,1555081692
540 .long   2198950837,1996064986
541 .long   3999719339,2554220882
542 .long   766784016,2821834349
543 .long   2566594879,2952996808
544 .long   3203337956,3210313671
545 .long   1034457026,3336571891
546 .long   2466948901,3584528711
547 .long   3758326383,113926993
548 .long   168717936,338241895
549 .long   1188179964,666307205
550 .long   1546045734,773529912
551 .long   1522805485,1294757372
552 .long   2643833823,1396182291
553 .long   2343527390,1695183700
554 .long   1014477480,1986661051
555 .long   1206759142,2177026350
556 .long   344077627,2456956037
557 .long   1290863460,2730485921
558 .long   3158454273,2820302411
559 .long   3505952657,3259730800
560 .long   106217008,3345764771
561 .long   3606008344,3516065817
562 .long   1432725776,3600352804
563 .long   1467031594,4094571909
564 .long   851169720,275423344
565 .long   3100823752,430227734
566 .long   1363258195,506948616
567 .long   3750685593,659060556
568 .long   3785050280,883997877
569 .long   3318307427,958139571
570 .long   3812723403,1322822218
571 .long   2003034995,1537002063
572 .long   3602036899,1747873779
573 .long   1575990012,1955562222
574 .long   1125592928,2024104815
575 .long   2716904306,2227730452
576 .long   442776044,2361852424
577 .long   593698344,2428436474
578 .long   3733110249,2756734187
579 .long   2999351573,3204031479
580 .long   3815920427,3329325298
581 .long   3928383900,3391569614
582 .long   566280711,3515267271
583 .long   3454069534,3940187606
584 .long   4000239992,4118630271
585 .long   1914138554,116418474
586 .long   2731055270,174292421
587 .long   3203993006,289380356
588 .long   320620315,460393269
589 .long   587496836,685471733
590 .long   1086792851,852142971
591 .long   365543100,1017036298
592 .long   2618297676,1126000580
593 .long   3409855158,1288033470
594 .long   4234509866,1501505948
595 .long   987167468,1607167915
596 .long   1246189591,1816402316
597 .long   67438087,66051
598 .long   202182159,134810123
599 .byte   83,72,65,53,49,50,32,98,108,111,99,107,32,116,114,97
600 .byte   110,115,102,111,114,109,32,102,111,114,32,120,56,54,44,32
601 .byte   67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97
602 .byte   112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103
603 .byte   62,0
604
605 .section .note.GNU-stack,"",%progbits