Update copyright dates with scripts/update-copyrights.
[glibc.git] / sysdeps / sparc / sparc64 / multiarch / sha512-crop.S
blob1aca684b47f4e4792c787ec6372db5d1e60f90e4
1 /* SHA512 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 SHA512          \
23         .word   0x81b02860;
25         .text
26         .align  32
27 ENTRY(__sha512_process_block_crop)
28         /* %o0=buffer, %o1=len, %o2=CTX */
29         ldx     [%o2 + 0x48], %g1
30         add     %g1, %o1, %o4
31         stx     %o4, [%o2 + 0x48]
32         cmp     %o4, %g1
33         bgeu,pt %xcc, 1f
34          nop
35         ldx     [%o2 + 0x40], %g1
36         add     %g1, 1, %g1
37         stx     %g1, [%o2 + 0x40]
39 1:      ldd     [%o2 + 0x00], %f0
40         ldd     [%o2 + 0x08], %f2
41         ldd     [%o2 + 0x10], %f4
42         ldd     [%o2 + 0x18], %f6
43         ldd     [%o2 + 0x20], %f8
44         ldd     [%o2 + 0x28], %f10
45         andcc   %o1, 0x7, %g0
46         ldd     [%o2 + 0x30], %f12
47         bne,pn  %xcc, 10f
48          ldd    [%o2 + 0x38], %f14
51         ldd     [%o0 + 0x00], %f16
52         ldd     [%o0 + 0x08], %f18
53         ldd     [%o0 + 0x10], %f20
54         ldd     [%o0 + 0x18], %f22
55         ldd     [%o0 + 0x20], %f24
56         ldd     [%o0 + 0x28], %f26
57         ldd     [%o0 + 0x30], %f28
58         ldd     [%o0 + 0x38], %f30
59         ldd     [%o0 + 0x40], %f32
60         ldd     [%o0 + 0x48], %f34
61         ldd     [%o0 + 0x50], %f36
62         ldd     [%o0 + 0x58], %f38
63         ldd     [%o0 + 0x60], %f40
64         ldd     [%o0 + 0x68], %f42
65         ldd     [%o0 + 0x70], %f44
66         ldd     [%o0 + 0x78], %f46
68         SHA512
70         subcc   %o1, 0x80, %o1
71         bne,pt  %xcc, 1b
72          add    %o0, 0x80, %o0
75         std     %f0, [%o2 + 0x00]
76         std     %f2, [%o2 + 0x08]
77         std     %f4, [%o2 + 0x10]
78         std     %f6, [%o2 + 0x18]
79         std     %f8, [%o2 + 0x20]
80         std     %f10, [%o2 + 0x28]
81         std     %f12, [%o2 + 0x30]
82         retl
83          std    %f14, [%o2 + 0x38]
84 10:
85         alignaddr %o0, %g0, %o0
87         ldd     [%o0 + 0x00], %f18
89         ldd     [%o0 + 0x08], %f20
90         ldd     [%o0 + 0x10], %f22
91         ldd     [%o0 + 0x18], %f24
92         ldd     [%o0 + 0x20], %f26
93         ldd     [%o0 + 0x28], %f28
94         ldd     [%o0 + 0x30], %f30
95         ldd     [%o0 + 0x38], %f32
96         ldd     [%o0 + 0x40], %f34
97         ldd     [%o0 + 0x48], %f36
98         ldd     [%o0 + 0x50], %f38
99         ldd     [%o0 + 0x58], %f40
100         ldd     [%o0 + 0x60], %f42
101         ldd     [%o0 + 0x68], %f44
102         ldd     [%o0 + 0x70], %f46
103         ldd     [%o0 + 0x78], %f48
104         ldd     [%o0 + 0x80], %f50
106         faligndata %f18, %f20, %f16
107         faligndata %f20, %f22, %f18
108         faligndata %f22, %f24, %f20
109         faligndata %f24, %f26, %f22
110         faligndata %f26, %f28, %f24
111         faligndata %f28, %f30, %f26
112         faligndata %f30, %f32, %f28
113         faligndata %f32, %f34, %f30
114         faligndata %f34, %f36, %f32
115         faligndata %f36, %f38, %f34
116         faligndata %f38, %f40, %f36
117         faligndata %f40, %f42, %f38
118         faligndata %f42, %f44, %f40
119         faligndata %f44, %f46, %f42
120         faligndata %f46, %f48, %f44
121         faligndata %f48, %f50, %f46
123         SHA512
125         subcc   %o1, 0x80, %o1
126         fsrc2   %f50, %f18
127         bne,pt  %xcc, 1b
128          add    %o0, 0x80, %o0
130         ba,a,pt %xcc, 5b
131 END(__sha512_process_block_crop)