xref: /linux/lib/crypto/sparc/md5_asm.S (revision d8768fb12a14c30436bd0466b4fc28edeef45078)
1*a1848f6eSEric Biggers/* SPDX-License-Identifier: GPL-2.0 */
2*a1848f6eSEric Biggers#include <linux/linkage.h>
3*a1848f6eSEric Biggers#include <asm/opcodes.h>
4*a1848f6eSEric Biggers#include <asm/visasm.h>
5*a1848f6eSEric Biggers
6*a1848f6eSEric BiggersENTRY(md5_sparc64_transform)
7*a1848f6eSEric Biggers	/* %o0 = digest, %o1 = data, %o2 = rounds */
8*a1848f6eSEric Biggers	VISEntryHalf
9*a1848f6eSEric Biggers	ld	[%o0 + 0x00], %f0
10*a1848f6eSEric Biggers	ld	[%o0 + 0x04], %f1
11*a1848f6eSEric Biggers	andcc	%o1, 0x7, %g0
12*a1848f6eSEric Biggers	ld	[%o0 + 0x08], %f2
13*a1848f6eSEric Biggers	bne,pn	%xcc, 10f
14*a1848f6eSEric Biggers	 ld	[%o0 + 0x0c], %f3
15*a1848f6eSEric Biggers
16*a1848f6eSEric Biggers1:
17*a1848f6eSEric Biggers	ldd	[%o1 + 0x00], %f8
18*a1848f6eSEric Biggers	ldd	[%o1 + 0x08], %f10
19*a1848f6eSEric Biggers	ldd	[%o1 + 0x10], %f12
20*a1848f6eSEric Biggers	ldd	[%o1 + 0x18], %f14
21*a1848f6eSEric Biggers	ldd	[%o1 + 0x20], %f16
22*a1848f6eSEric Biggers	ldd	[%o1 + 0x28], %f18
23*a1848f6eSEric Biggers	ldd	[%o1 + 0x30], %f20
24*a1848f6eSEric Biggers	ldd	[%o1 + 0x38], %f22
25*a1848f6eSEric Biggers
26*a1848f6eSEric Biggers	MD5
27*a1848f6eSEric Biggers
28*a1848f6eSEric Biggers	subcc	%o2, 1, %o2
29*a1848f6eSEric Biggers	bne,pt	%xcc, 1b
30*a1848f6eSEric Biggers	 add	%o1, 0x40, %o1
31*a1848f6eSEric Biggers
32*a1848f6eSEric Biggers5:
33*a1848f6eSEric Biggers	st	%f0, [%o0 + 0x00]
34*a1848f6eSEric Biggers	st	%f1, [%o0 + 0x04]
35*a1848f6eSEric Biggers	st	%f2, [%o0 + 0x08]
36*a1848f6eSEric Biggers	st	%f3, [%o0 + 0x0c]
37*a1848f6eSEric Biggers	retl
38*a1848f6eSEric Biggers	 VISExitHalf
39*a1848f6eSEric Biggers10:
40*a1848f6eSEric Biggers	alignaddr %o1, %g0, %o1
41*a1848f6eSEric Biggers
42*a1848f6eSEric Biggers	ldd	[%o1 + 0x00], %f10
43*a1848f6eSEric Biggers1:
44*a1848f6eSEric Biggers	ldd	[%o1 + 0x08], %f12
45*a1848f6eSEric Biggers	ldd	[%o1 + 0x10], %f14
46*a1848f6eSEric Biggers	ldd	[%o1 + 0x18], %f16
47*a1848f6eSEric Biggers	ldd	[%o1 + 0x20], %f18
48*a1848f6eSEric Biggers	ldd	[%o1 + 0x28], %f20
49*a1848f6eSEric Biggers	ldd	[%o1 + 0x30], %f22
50*a1848f6eSEric Biggers	ldd	[%o1 + 0x38], %f24
51*a1848f6eSEric Biggers	ldd	[%o1 + 0x40], %f26
52*a1848f6eSEric Biggers
53*a1848f6eSEric Biggers	faligndata %f10, %f12, %f8
54*a1848f6eSEric Biggers	faligndata %f12, %f14, %f10
55*a1848f6eSEric Biggers	faligndata %f14, %f16, %f12
56*a1848f6eSEric Biggers	faligndata %f16, %f18, %f14
57*a1848f6eSEric Biggers	faligndata %f18, %f20, %f16
58*a1848f6eSEric Biggers	faligndata %f20, %f22, %f18
59*a1848f6eSEric Biggers	faligndata %f22, %f24, %f20
60*a1848f6eSEric Biggers	faligndata %f24, %f26, %f22
61*a1848f6eSEric Biggers
62*a1848f6eSEric Biggers	MD5
63*a1848f6eSEric Biggers
64*a1848f6eSEric Biggers	subcc	%o2, 1, %o2
65*a1848f6eSEric Biggers	fsrc2	%f26, %f10
66*a1848f6eSEric Biggers	bne,pt	%xcc, 1b
67*a1848f6eSEric Biggers	 add	%o1, 0x40, %o1
68*a1848f6eSEric Biggers
69*a1848f6eSEric Biggers	ba,a,pt	%xcc, 5b
70*a1848f6eSEric BiggersENDPROC(md5_sparc64_transform)
71