Update copyright dates with scripts/update-copyrights.
[glibc.git] / sysdeps / sparc / sparc64 / multiarch / md5-crop.S
blob0a33cc25323e40cd3839cdaee38652ebfcd09145
1 /* MD5 using sparc crypto opcodes.
2    Copyright (C) 2012-2015 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4    Contributed by David S. Miller (davem@davemloft.net)
6    The GNU C Library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2.1 of the License, or (at your option) any later version.
11    The GNU C Library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
16    You should have received a copy of the GNU Lesser General Public
17    License along with the GNU C Library; if not, see
18    <http://www.gnu.org/licenses/>.  */
20 #include <sysdep.h>
22 #define ASI_PL 0x88
24 #define MD5             \
25         .word   0x81b02800;
27         .text
28         .align  32
29 ENTRY(__md5_process_block_crop)
30         /* %o0=buffer, %o1=len, %o2=CTX */
31         ld      [%o2 + 0x10], %g1
32         add     %g1, %o1, %o4
33         st      %o4, [%o2 + 0x10]
34         clr     %o5
35         cmp     %o4, %g1
36         movlu   %icc, 1, %o5
37 #ifdef __arch64__
38         srlx    %o1, 32, %o4
39         add     %o5, %o4, %o5
40 #endif
41         ld      [%o2 + 0x14], %o4
42         add     %o4, %o5, %o4
43         st      %o4, [%o2 + 0x14]
44         lda     [%o2] ASI_PL, %f0
45         add     %o2, 0x4, %g1
46         lda     [%g1] ASI_PL, %f1
47         add     %o2, 0x8, %g1
48         andcc   %o0, 0x7, %g0
49         lda     [%g1] ASI_PL, %f2
50         add     %o2, 0xc, %g1
51         bne,pn  %xcc, 10f
52          lda    [%g1] ASI_PL, %f3
55         ldd     [%o0 + 0x00], %f8
56         ldd     [%o0 + 0x08], %f10
57         ldd     [%o0 + 0x10], %f12
58         ldd     [%o0 + 0x18], %f14
59         ldd     [%o0 + 0x20], %f16
60         ldd     [%o0 + 0x28], %f18
61         ldd     [%o0 + 0x30], %f20
62         ldd     [%o0 + 0x38], %f22
64         MD5
66         subcc   %o1, 64, %o1
67         bne,pt  %xcc, 1b
68          add    %o0, 0x40, %o0
71         sta     %f0, [%o2] ASI_PL
72         add     %o2, 0x4, %g1
73         sta     %f1, [%g1] ASI_PL
74         add     %o2, 0x8, %g1
75         sta     %f2, [%g1] ASI_PL
76         add     %o2, 0xc, %g1
77         retl
78          sta    %f3, [%g1] ASI_PL
79 10:
80         alignaddr %o0, %g0, %o0
82         ldd     [%o0 + 0x00], %f10
84         ldd     [%o0 + 0x08], %f12
85         ldd     [%o0 + 0x10], %f14
86         ldd     [%o0 + 0x18], %f16
87         ldd     [%o0 + 0x20], %f18
88         ldd     [%o0 + 0x28], %f20
89         ldd     [%o0 + 0x30], %f22
90         ldd     [%o0 + 0x38], %f24
91         ldd     [%o0 + 0x40], %f26
93         faligndata %f10, %f12, %f8
94         faligndata %f12, %f14, %f10
95         faligndata %f14, %f16, %f12
96         faligndata %f16, %f18, %f14
97         faligndata %f18, %f20, %f16
98         faligndata %f20, %f22, %f18
99         faligndata %f22, %f24, %f20
100         faligndata %f24, %f26, %f22
102         MD5
104         subcc   %o1, 64, %o1
105         fsrc2   %f26, %f10
106         bne,pt  %xcc, 1b
107          add    %o0, 0x40, %o0
109         ba,a,pt %xcc, 5b
110 END(__md5_process_block_crop)