xref: /linux/lib/crypto/sparc/sha512_asm.S (revision 13150742b09e720fdf021de14cd2b98b37415a89)
1*02b35babSEric Biggers/* SPDX-License-Identifier: GPL-2.0 */
2*02b35babSEric Biggers#include <linux/linkage.h>
3*02b35babSEric Biggers#include <asm/opcodes.h>
4*02b35babSEric Biggers#include <asm/visasm.h>
5*02b35babSEric Biggers
6*02b35babSEric BiggersENTRY(sha512_sparc64_transform)
7*02b35babSEric Biggers	/* %o0 = digest, %o1 = data, %o2 = rounds */
8*02b35babSEric Biggers	VISEntry
9*02b35babSEric Biggers	ldd	[%o0 + 0x00], %f0
10*02b35babSEric Biggers	ldd	[%o0 + 0x08], %f2
11*02b35babSEric Biggers	ldd	[%o0 + 0x10], %f4
12*02b35babSEric Biggers	ldd	[%o0 + 0x18], %f6
13*02b35babSEric Biggers	ldd	[%o0 + 0x20], %f8
14*02b35babSEric Biggers	ldd	[%o0 + 0x28], %f10
15*02b35babSEric Biggers	andcc	%o1, 0x7, %g0
16*02b35babSEric Biggers	ldd	[%o0 + 0x30], %f12
17*02b35babSEric Biggers	bne,pn	%xcc, 10f
18*02b35babSEric Biggers	 ldd	[%o0 + 0x38], %f14
19*02b35babSEric Biggers
20*02b35babSEric Biggers1:
21*02b35babSEric Biggers	ldd	[%o1 + 0x00], %f16
22*02b35babSEric Biggers	ldd	[%o1 + 0x08], %f18
23*02b35babSEric Biggers	ldd	[%o1 + 0x10], %f20
24*02b35babSEric Biggers	ldd	[%o1 + 0x18], %f22
25*02b35babSEric Biggers	ldd	[%o1 + 0x20], %f24
26*02b35babSEric Biggers	ldd	[%o1 + 0x28], %f26
27*02b35babSEric Biggers	ldd	[%o1 + 0x30], %f28
28*02b35babSEric Biggers	ldd	[%o1 + 0x38], %f30
29*02b35babSEric Biggers	ldd	[%o1 + 0x40], %f32
30*02b35babSEric Biggers	ldd	[%o1 + 0x48], %f34
31*02b35babSEric Biggers	ldd	[%o1 + 0x50], %f36
32*02b35babSEric Biggers	ldd	[%o1 + 0x58], %f38
33*02b35babSEric Biggers	ldd	[%o1 + 0x60], %f40
34*02b35babSEric Biggers	ldd	[%o1 + 0x68], %f42
35*02b35babSEric Biggers	ldd	[%o1 + 0x70], %f44
36*02b35babSEric Biggers	ldd	[%o1 + 0x78], %f46
37*02b35babSEric Biggers
38*02b35babSEric Biggers	SHA512
39*02b35babSEric Biggers
40*02b35babSEric Biggers	subcc	%o2, 1, %o2
41*02b35babSEric Biggers	bne,pt	%xcc, 1b
42*02b35babSEric Biggers	 add	%o1, 0x80, %o1
43*02b35babSEric Biggers
44*02b35babSEric Biggers5:
45*02b35babSEric Biggers	std	%f0, [%o0 + 0x00]
46*02b35babSEric Biggers	std	%f2, [%o0 + 0x08]
47*02b35babSEric Biggers	std	%f4, [%o0 + 0x10]
48*02b35babSEric Biggers	std	%f6, [%o0 + 0x18]
49*02b35babSEric Biggers	std	%f8, [%o0 + 0x20]
50*02b35babSEric Biggers	std	%f10, [%o0 + 0x28]
51*02b35babSEric Biggers	std	%f12, [%o0 + 0x30]
52*02b35babSEric Biggers	std	%f14, [%o0 + 0x38]
53*02b35babSEric Biggers	retl
54*02b35babSEric Biggers	 VISExit
55*02b35babSEric Biggers10:
56*02b35babSEric Biggers	alignaddr %o1, %g0, %o1
57*02b35babSEric Biggers
58*02b35babSEric Biggers	ldd	[%o1 + 0x00], %f18
59*02b35babSEric Biggers1:
60*02b35babSEric Biggers	ldd	[%o1 + 0x08], %f20
61*02b35babSEric Biggers	ldd	[%o1 + 0x10], %f22
62*02b35babSEric Biggers	ldd	[%o1 + 0x18], %f24
63*02b35babSEric Biggers	ldd	[%o1 + 0x20], %f26
64*02b35babSEric Biggers	ldd	[%o1 + 0x28], %f28
65*02b35babSEric Biggers	ldd	[%o1 + 0x30], %f30
66*02b35babSEric Biggers	ldd	[%o1 + 0x38], %f32
67*02b35babSEric Biggers	ldd	[%o1 + 0x40], %f34
68*02b35babSEric Biggers	ldd	[%o1 + 0x48], %f36
69*02b35babSEric Biggers	ldd	[%o1 + 0x50], %f38
70*02b35babSEric Biggers	ldd	[%o1 + 0x58], %f40
71*02b35babSEric Biggers	ldd	[%o1 + 0x60], %f42
72*02b35babSEric Biggers	ldd	[%o1 + 0x68], %f44
73*02b35babSEric Biggers	ldd	[%o1 + 0x70], %f46
74*02b35babSEric Biggers	ldd	[%o1 + 0x78], %f48
75*02b35babSEric Biggers	ldd	[%o1 + 0x80], %f50
76*02b35babSEric Biggers
77*02b35babSEric Biggers	faligndata %f18, %f20, %f16
78*02b35babSEric Biggers	faligndata %f20, %f22, %f18
79*02b35babSEric Biggers	faligndata %f22, %f24, %f20
80*02b35babSEric Biggers	faligndata %f24, %f26, %f22
81*02b35babSEric Biggers	faligndata %f26, %f28, %f24
82*02b35babSEric Biggers	faligndata %f28, %f30, %f26
83*02b35babSEric Biggers	faligndata %f30, %f32, %f28
84*02b35babSEric Biggers	faligndata %f32, %f34, %f30
85*02b35babSEric Biggers	faligndata %f34, %f36, %f32
86*02b35babSEric Biggers	faligndata %f36, %f38, %f34
87*02b35babSEric Biggers	faligndata %f38, %f40, %f36
88*02b35babSEric Biggers	faligndata %f40, %f42, %f38
89*02b35babSEric Biggers	faligndata %f42, %f44, %f40
90*02b35babSEric Biggers	faligndata %f44, %f46, %f42
91*02b35babSEric Biggers	faligndata %f46, %f48, %f44
92*02b35babSEric Biggers	faligndata %f48, %f50, %f46
93*02b35babSEric Biggers
94*02b35babSEric Biggers	SHA512
95*02b35babSEric Biggers
96*02b35babSEric Biggers	subcc	%o2, 1, %o2
97*02b35babSEric Biggers	fsrc2	%f50, %f18
98*02b35babSEric Biggers	bne,pt	%xcc, 1b
99*02b35babSEric Biggers	 add	%o1, 0x80, %o1
100*02b35babSEric Biggers
101*02b35babSEric Biggers	ba,a,pt	%xcc, 5b
102*02b35babSEric BiggersENDPROC(sha512_sparc64_transform)
103