Added Mike Hamburg's SSSE3 AES implementation.
[gnutls:gnutls.git] / lib / accelerated / x86 / macosx / sha512-ssse3-x86.s
1 # Copyright (c) 2011-2013, 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 .align  4
44 _sha512_block_data_order:
45 L_sha512_block_data_order_begin:
46         pushl   %ebp
47         pushl   %ebx
48         pushl   %esi
49         pushl   %edi
50         movl    20(%esp),%esi
51         movl    24(%esp),%edi
52         movl    28(%esp),%eax
53         movl    %esp,%ebx
54         call    L000pic_point
55 L000pic_point:
56         popl    %ebp
57         leal    L001K512-L000pic_point(%ebp),%ebp
58         subl    $16,%esp
59         andl    $-64,%esp
60         shll    $7,%eax
61         addl    %edi,%eax
62         movl    %esi,(%esp)
63         movl    %edi,4(%esp)
64         movl    %eax,8(%esp)
65         movl    %ebx,12(%esp)
66 .align  4,0x90
67 L002loop_x86:
68         movl    (%edi),%eax
69         movl    4(%edi),%ebx
70         movl    8(%edi),%ecx
71         movl    12(%edi),%edx
72         bswap   %eax
73         bswap   %ebx
74         bswap   %ecx
75         bswap   %edx
76         pushl   %eax
77         pushl   %ebx
78         pushl   %ecx
79         pushl   %edx
80         movl    16(%edi),%eax
81         movl    20(%edi),%ebx
82         movl    24(%edi),%ecx
83         movl    28(%edi),%edx
84         bswap   %eax
85         bswap   %ebx
86         bswap   %ecx
87         bswap   %edx
88         pushl   %eax
89         pushl   %ebx
90         pushl   %ecx
91         pushl   %edx
92         movl    32(%edi),%eax
93         movl    36(%edi),%ebx
94         movl    40(%edi),%ecx
95         movl    44(%edi),%edx
96         bswap   %eax
97         bswap   %ebx
98         bswap   %ecx
99         bswap   %edx
100         pushl   %eax
101         pushl   %ebx
102         pushl   %ecx
103         pushl   %edx
104         movl    48(%edi),%eax
105         movl    52(%edi),%ebx
106         movl    56(%edi),%ecx
107         movl    60(%edi),%edx
108         bswap   %eax
109         bswap   %ebx
110         bswap   %ecx
111         bswap   %edx
112         pushl   %eax
113         pushl   %ebx
114         pushl   %ecx
115         pushl   %edx
116         movl    64(%edi),%eax
117         movl    68(%edi),%ebx
118         movl    72(%edi),%ecx
119         movl    76(%edi),%edx
120         bswap   %eax
121         bswap   %ebx
122         bswap   %ecx
123         bswap   %edx
124         pushl   %eax
125         pushl   %ebx
126         pushl   %ecx
127         pushl   %edx
128         movl    80(%edi),%eax
129         movl    84(%edi),%ebx
130         movl    88(%edi),%ecx
131         movl    92(%edi),%edx
132         bswap   %eax
133         bswap   %ebx
134         bswap   %ecx
135         bswap   %edx
136         pushl   %eax
137         pushl   %ebx
138         pushl   %ecx
139         pushl   %edx
140         movl    96(%edi),%eax
141         movl    100(%edi),%ebx
142         movl    104(%edi),%ecx
143         movl    108(%edi),%edx
144         bswap   %eax
145         bswap   %ebx
146         bswap   %ecx
147         bswap   %edx
148         pushl   %eax
149         pushl   %ebx
150         pushl   %ecx
151         pushl   %edx
152         movl    112(%edi),%eax
153         movl    116(%edi),%ebx
154         movl    120(%edi),%ecx
155         movl    124(%edi),%edx
156         bswap   %eax
157         bswap   %ebx
158         bswap   %ecx
159         bswap   %edx
160         pushl   %eax
161         pushl   %ebx
162         pushl   %ecx
163         pushl   %edx
164         addl    $128,%edi
165         subl    $72,%esp
166         movl    %edi,204(%esp)
167         leal    8(%esp),%edi
168         movl    $16,%ecx
169 .long   2784229001
170 .align  4,0x90
171 L00300_15_x86:
172         movl    40(%esp),%ecx
173         movl    44(%esp),%edx
174         movl    %ecx,%esi
175         shrl    $9,%ecx
176         movl    %edx,%edi
177         shrl    $9,%edx
178         movl    %ecx,%ebx
179         shll    $14,%esi
180         movl    %edx,%eax
181         shll    $14,%edi
182         xorl    %esi,%ebx
183         shrl    $5,%ecx
184         xorl    %edi,%eax
185         shrl    $5,%edx
186         xorl    %ecx,%eax
187         shll    $4,%esi
188         xorl    %edx,%ebx
189         shll    $4,%edi
190         xorl    %esi,%ebx
191         shrl    $4,%ecx
192         xorl    %edi,%eax
193         shrl    $4,%edx
194         xorl    %ecx,%eax
195         shll    $5,%esi
196         xorl    %edx,%ebx
197         shll    $5,%edi
198         xorl    %esi,%eax
199         xorl    %edi,%ebx
200         movl    48(%esp),%ecx
201         movl    52(%esp),%edx
202         movl    56(%esp),%esi
203         movl    60(%esp),%edi
204         addl    64(%esp),%eax
205         adcl    68(%esp),%ebx
206         xorl    %esi,%ecx
207         xorl    %edi,%edx
208         andl    40(%esp),%ecx
209         andl    44(%esp),%edx
210         addl    192(%esp),%eax
211         adcl    196(%esp),%ebx
212         xorl    %esi,%ecx
213         xorl    %edi,%edx
214         movl    (%ebp),%esi
215         movl    4(%ebp),%edi
216         addl    %ecx,%eax
217         adcl    %edx,%ebx
218         movl    32(%esp),%ecx
219         movl    36(%esp),%edx
220         addl    %esi,%eax
221         adcl    %edi,%ebx
222         movl    %eax,(%esp)
223         movl    %ebx,4(%esp)
224         addl    %ecx,%eax
225         adcl    %edx,%ebx
226         movl    8(%esp),%ecx
227         movl    12(%esp),%edx
228         movl    %eax,32(%esp)
229         movl    %ebx,36(%esp)
230         movl    %ecx,%esi
231         shrl    $2,%ecx
232         movl    %edx,%edi
233         shrl    $2,%edx
234         movl    %ecx,%ebx
235         shll    $4,%esi
236         movl    %edx,%eax
237         shll    $4,%edi
238         xorl    %esi,%ebx
239         shrl    $5,%ecx
240         xorl    %edi,%eax
241         shrl    $5,%edx
242         xorl    %ecx,%ebx
243         shll    $21,%esi
244         xorl    %edx,%eax
245         shll    $21,%edi
246         xorl    %esi,%eax
247         shrl    $21,%ecx
248         xorl    %edi,%ebx
249         shrl    $21,%edx
250         xorl    %ecx,%eax
251         shll    $5,%esi
252         xorl    %edx,%ebx
253         shll    $5,%edi
254         xorl    %esi,%eax
255         xorl    %edi,%ebx
256         movl    8(%esp),%ecx
257         movl    12(%esp),%edx
258         movl    16(%esp),%esi
259         movl    20(%esp),%edi
260         addl    (%esp),%eax
261         adcl    4(%esp),%ebx
262         orl     %esi,%ecx
263         orl     %edi,%edx
264         andl    24(%esp),%ecx
265         andl    28(%esp),%edx
266         andl    8(%esp),%esi
267         andl    12(%esp),%edi
268         orl     %esi,%ecx
269         orl     %edi,%edx
270         addl    %ecx,%eax
271         adcl    %edx,%ebx
272         movl    %eax,(%esp)
273         movl    %ebx,4(%esp)
274         movb    (%ebp),%dl
275         subl    $8,%esp
276         leal    8(%ebp),%ebp
277         cmpb    $148,%dl
278         jne     L00300_15_x86
279 .align  4,0x90
280 L00416_79_x86:
281         movl    312(%esp),%ecx
282         movl    316(%esp),%edx
283         movl    %ecx,%esi
284         shrl    $1,%ecx
285         movl    %edx,%edi
286         shrl    $1,%edx
287         movl    %ecx,%eax
288         shll    $24,%esi
289         movl    %edx,%ebx
290         shll    $24,%edi
291         xorl    %esi,%ebx
292         shrl    $6,%ecx
293         xorl    %edi,%eax
294         shrl    $6,%edx
295         xorl    %ecx,%eax
296         shll    $7,%esi
297         xorl    %edx,%ebx
298         shll    $1,%edi
299         xorl    %esi,%ebx
300         shrl    $1,%ecx
301         xorl    %edi,%eax
302         shrl    $1,%edx
303         xorl    %ecx,%eax
304         shll    $6,%edi
305         xorl    %edx,%ebx
306         xorl    %edi,%eax
307         movl    %eax,(%esp)
308         movl    %ebx,4(%esp)
309         movl    208(%esp),%ecx
310         movl    212(%esp),%edx
311         movl    %ecx,%esi
312         shrl    $6,%ecx
313         movl    %edx,%edi
314         shrl    $6,%edx
315         movl    %ecx,%eax
316         shll    $3,%esi
317         movl    %edx,%ebx
318         shll    $3,%edi
319         xorl    %esi,%eax
320         shrl    $13,%ecx
321         xorl    %edi,%ebx
322         shrl    $13,%edx
323         xorl    %ecx,%eax
324         shll    $10,%esi
325         xorl    %edx,%ebx
326         shll    $10,%edi
327         xorl    %esi,%ebx
328         shrl    $10,%ecx
329         xorl    %edi,%eax
330         shrl    $10,%edx
331         xorl    %ecx,%ebx
332         shll    $13,%edi
333         xorl    %edx,%eax
334         xorl    %edi,%eax
335         movl    320(%esp),%ecx
336         movl    324(%esp),%edx
337         addl    (%esp),%eax
338         adcl    4(%esp),%ebx
339         movl    248(%esp),%esi
340         movl    252(%esp),%edi
341         addl    %ecx,%eax
342         adcl    %edx,%ebx
343         addl    %esi,%eax
344         adcl    %edi,%ebx
345         movl    %eax,192(%esp)
346         movl    %ebx,196(%esp)
347         movl    40(%esp),%ecx
348         movl    44(%esp),%edx
349         movl    %ecx,%esi
350         shrl    $9,%ecx
351         movl    %edx,%edi
352         shrl    $9,%edx
353         movl    %ecx,%ebx
354         shll    $14,%esi
355         movl    %edx,%eax
356         shll    $14,%edi
357         xorl    %esi,%ebx
358         shrl    $5,%ecx
359         xorl    %edi,%eax
360         shrl    $5,%edx
361         xorl    %ecx,%eax
362         shll    $4,%esi
363         xorl    %edx,%ebx
364         shll    $4,%edi
365         xorl    %esi,%ebx
366         shrl    $4,%ecx
367         xorl    %edi,%eax
368         shrl    $4,%edx
369         xorl    %ecx,%eax
370         shll    $5,%esi
371         xorl    %edx,%ebx
372         shll    $5,%edi
373         xorl    %esi,%eax
374         xorl    %edi,%ebx
375         movl    48(%esp),%ecx
376         movl    52(%esp),%edx
377         movl    56(%esp),%esi
378         movl    60(%esp),%edi
379         addl    64(%esp),%eax
380         adcl    68(%esp),%ebx
381         xorl    %esi,%ecx
382         xorl    %edi,%edx
383         andl    40(%esp),%ecx
384         andl    44(%esp),%edx
385         addl    192(%esp),%eax
386         adcl    196(%esp),%ebx
387         xorl    %esi,%ecx
388         xorl    %edi,%edx
389         movl    (%ebp),%esi
390         movl    4(%ebp),%edi
391         addl    %ecx,%eax
392         adcl    %edx,%ebx
393         movl    32(%esp),%ecx
394         movl    36(%esp),%edx
395         addl    %esi,%eax
396         adcl    %edi,%ebx
397         movl    %eax,(%esp)
398         movl    %ebx,4(%esp)
399         addl    %ecx,%eax
400         adcl    %edx,%ebx
401         movl    8(%esp),%ecx
402         movl    12(%esp),%edx
403         movl    %eax,32(%esp)
404         movl    %ebx,36(%esp)
405         movl    %ecx,%esi
406         shrl    $2,%ecx
407         movl    %edx,%edi
408         shrl    $2,%edx
409         movl    %ecx,%ebx
410         shll    $4,%esi
411         movl    %edx,%eax
412         shll    $4,%edi
413         xorl    %esi,%ebx
414         shrl    $5,%ecx
415         xorl    %edi,%eax
416         shrl    $5,%edx
417         xorl    %ecx,%ebx
418         shll    $21,%esi
419         xorl    %edx,%eax
420         shll    $21,%edi
421         xorl    %esi,%eax
422         shrl    $21,%ecx
423         xorl    %edi,%ebx
424         shrl    $21,%edx
425         xorl    %ecx,%eax
426         shll    $5,%esi
427         xorl    %edx,%ebx
428         shll    $5,%edi
429         xorl    %esi,%eax
430         xorl    %edi,%ebx
431         movl    8(%esp),%ecx
432         movl    12(%esp),%edx
433         movl    16(%esp),%esi
434         movl    20(%esp),%edi
435         addl    (%esp),%eax
436         adcl    4(%esp),%ebx
437         orl     %esi,%ecx
438         orl     %edi,%edx
439         andl    24(%esp),%ecx
440         andl    28(%esp),%edx
441         andl    8(%esp),%esi
442         andl    12(%esp),%edi
443         orl     %esi,%ecx
444         orl     %edi,%edx
445         addl    %ecx,%eax
446         adcl    %edx,%ebx
447         movl    %eax,(%esp)
448         movl    %ebx,4(%esp)
449         movb    (%ebp),%dl
450         subl    $8,%esp
451         leal    8(%ebp),%ebp
452         cmpb    $23,%dl
453         jne     L00416_79_x86
454         movl    840(%esp),%esi
455         movl    844(%esp),%edi
456         movl    (%esi),%eax
457         movl    4(%esi),%ebx
458         movl    8(%esi),%ecx
459         movl    12(%esi),%edx
460         addl    8(%esp),%eax
461         adcl    12(%esp),%ebx
462         movl    %eax,(%esi)
463         movl    %ebx,4(%esi)
464         addl    16(%esp),%ecx
465         adcl    20(%esp),%edx
466         movl    %ecx,8(%esi)
467         movl    %edx,12(%esi)
468         movl    16(%esi),%eax
469         movl    20(%esi),%ebx
470         movl    24(%esi),%ecx
471         movl    28(%esi),%edx
472         addl    24(%esp),%eax
473         adcl    28(%esp),%ebx
474         movl    %eax,16(%esi)
475         movl    %ebx,20(%esi)
476         addl    32(%esp),%ecx
477         adcl    36(%esp),%edx
478         movl    %ecx,24(%esi)
479         movl    %edx,28(%esi)
480         movl    32(%esi),%eax
481         movl    36(%esi),%ebx
482         movl    40(%esi),%ecx
483         movl    44(%esi),%edx
484         addl    40(%esp),%eax
485         adcl    44(%esp),%ebx
486         movl    %eax,32(%esi)
487         movl    %ebx,36(%esi)
488         addl    48(%esp),%ecx
489         adcl    52(%esp),%edx
490         movl    %ecx,40(%esi)
491         movl    %edx,44(%esi)
492         movl    48(%esi),%eax
493         movl    52(%esi),%ebx
494         movl    56(%esi),%ecx
495         movl    60(%esi),%edx
496         addl    56(%esp),%eax
497         adcl    60(%esp),%ebx
498         movl    %eax,48(%esi)
499         movl    %ebx,52(%esi)
500         addl    64(%esp),%ecx
501         adcl    68(%esp),%edx
502         movl    %ecx,56(%esi)
503         movl    %edx,60(%esi)
504         addl    $840,%esp
505         subl    $640,%ebp
506         cmpl    8(%esp),%edi
507         jb      L002loop_x86
508         movl    12(%esp),%esp
509         popl    %edi
510         popl    %esi
511         popl    %ebx
512         popl    %ebp
513         ret
514 .align  6,0x90
515 L001K512:
516 .long   3609767458,1116352408
517 .long   602891725,1899447441
518 .long   3964484399,3049323471
519 .long   2173295548,3921009573
520 .long   4081628472,961987163
521 .long   3053834265,1508970993
522 .long   2937671579,2453635748
523 .long   3664609560,2870763221
524 .long   2734883394,3624381080
525 .long   1164996542,310598401
526 .long   1323610764,607225278
527 .long   3590304994,1426881987
528 .long   4068182383,1925078388
529 .long   991336113,2162078206
530 .long   633803317,2614888103
531 .long   3479774868,3248222580
532 .long   2666613458,3835390401
533 .long   944711139,4022224774
534 .long   2341262773,264347078
535 .long   2007800933,604807628
536 .long   1495990901,770255983
537 .long   1856431235,1249150122
538 .long   3175218132,1555081692
539 .long   2198950837,1996064986
540 .long   3999719339,2554220882
541 .long   766784016,2821834349
542 .long   2566594879,2952996808
543 .long   3203337956,3210313671
544 .long   1034457026,3336571891
545 .long   2466948901,3584528711
546 .long   3758326383,113926993
547 .long   168717936,338241895
548 .long   1188179964,666307205
549 .long   1546045734,773529912
550 .long   1522805485,1294757372
551 .long   2643833823,1396182291
552 .long   2343527390,1695183700
553 .long   1014477480,1986661051
554 .long   1206759142,2177026350
555 .long   344077627,2456956037
556 .long   1290863460,2730485921
557 .long   3158454273,2820302411
558 .long   3505952657,3259730800
559 .long   106217008,3345764771
560 .long   3606008344,3516065817
561 .long   1432725776,3600352804
562 .long   1467031594,4094571909
563 .long   851169720,275423344
564 .long   3100823752,430227734
565 .long   1363258195,506948616
566 .long   3750685593,659060556
567 .long   3785050280,883997877
568 .long   3318307427,958139571
569 .long   3812723403,1322822218
570 .long   2003034995,1537002063
571 .long   3602036899,1747873779
572 .long   1575990012,1955562222
573 .long   1125592928,2024104815
574 .long   2716904306,2227730452
575 .long   442776044,2361852424
576 .long   593698344,2428436474
577 .long   3733110249,2756734187
578 .long   2999351573,3204031479
579 .long   3815920427,3329325298
580 .long   3928383900,3391569614
581 .long   566280711,3515267271
582 .long   3454069534,3940187606
583 .long   4000239992,4118630271
584 .long   1914138554,116418474
585 .long   2731055270,174292421
586 .long   3203993006,289380356
587 .long   320620315,460393269
588 .long   587496836,685471733
589 .long   1086792851,852142971
590 .long   365543100,1017036298
591 .long   2618297676,1126000580
592 .long   3409855158,1288033470
593 .long   4234509866,1501505948
594 .long   987167468,1607167915
595 .long   1246189591,1816402316
596 .long   67438087,66051
597 .long   202182159,134810123
598 .byte   83,72,65,53,49,50,32,98,108,111,99,107,32,116,114,97
599 .byte   110,115,102,111,114,109,32,102,111,114,32,120,56,54,44,32
600 .byte   67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97
601 .byte   112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103
602 .byte   62,0
603
604 .section .note.GNU-stack,"",%progbits