162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Fast SHA-1 implementation for SPE instruction set (PPC)
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * This code makes use of the SPE SIMD instruction set as defined in
662306a36Sopenharmony_ci * http://cache.freescale.com/files/32bit/doc/ref_manual/SPEPIM.pdf
762306a36Sopenharmony_ci * Implementation is based on optimization guide notes from
862306a36Sopenharmony_ci * http://cache.freescale.com/files/32bit/doc/app_note/AN2665.pdf
962306a36Sopenharmony_ci *
1062306a36Sopenharmony_ci * Copyright (c) 2015 Markus Stockhausen <stockhausen@collogia.de>
1162306a36Sopenharmony_ci */
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#include <asm/ppc_asm.h>
1462306a36Sopenharmony_ci#include <asm/asm-offsets.h>
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#define rHP	r3	/* pointer to hash value			*/
1762306a36Sopenharmony_ci#define rWP	r4	/* pointer to input				*/
1862306a36Sopenharmony_ci#define rKP	r5	/* pointer to constants				*/
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci#define rW0	r14	/* 64 bit round words				*/
2162306a36Sopenharmony_ci#define rW1	r15
2262306a36Sopenharmony_ci#define rW2	r16
2362306a36Sopenharmony_ci#define rW3	r17
2462306a36Sopenharmony_ci#define rW4	r18
2562306a36Sopenharmony_ci#define rW5	r19
2662306a36Sopenharmony_ci#define rW6	r20
2762306a36Sopenharmony_ci#define rW7	r21
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci#define rH0	r6	/* 32 bit hash values 				*/
3062306a36Sopenharmony_ci#define rH1	r7
3162306a36Sopenharmony_ci#define rH2	r8
3262306a36Sopenharmony_ci#define rH3	r9
3362306a36Sopenharmony_ci#define rH4	r10
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci#define rT0	r22	/* 64 bit temporary				*/
3662306a36Sopenharmony_ci#define rT1	r0	/* 32 bit temporaries				*/
3762306a36Sopenharmony_ci#define rT2	r11
3862306a36Sopenharmony_ci#define rT3	r12
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#define rK	r23	/* 64 bit constant in volatile register		*/
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci#define LOAD_K01
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci#define LOAD_K11 \
4562306a36Sopenharmony_ci	evlwwsplat	rK,0(rKP);
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci#define LOAD_K21 \
4862306a36Sopenharmony_ci	evlwwsplat	rK,4(rKP);
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci#define LOAD_K31 \
5162306a36Sopenharmony_ci	evlwwsplat	rK,8(rKP);
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci#define LOAD_K41 \
5462306a36Sopenharmony_ci	evlwwsplat	rK,12(rKP);
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci#define INITIALIZE \
5762306a36Sopenharmony_ci	stwu		r1,-128(r1);	/* create stack frame		*/ \
5862306a36Sopenharmony_ci	evstdw		r14,8(r1);	/* We must save non volatile	*/ \
5962306a36Sopenharmony_ci	evstdw		r15,16(r1);	/* registers. Take the chance	*/ \
6062306a36Sopenharmony_ci	evstdw		r16,24(r1);	/* and save the SPE part too	*/ \
6162306a36Sopenharmony_ci	evstdw		r17,32(r1);					   \
6262306a36Sopenharmony_ci	evstdw		r18,40(r1);					   \
6362306a36Sopenharmony_ci	evstdw		r19,48(r1);					   \
6462306a36Sopenharmony_ci	evstdw		r20,56(r1);					   \
6562306a36Sopenharmony_ci	evstdw		r21,64(r1);					   \
6662306a36Sopenharmony_ci	evstdw		r22,72(r1);					   \
6762306a36Sopenharmony_ci	evstdw		r23,80(r1);
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci#define FINALIZE \
7162306a36Sopenharmony_ci	evldw		r14,8(r1);	/* restore SPE registers	*/ \
7262306a36Sopenharmony_ci	evldw		r15,16(r1);					   \
7362306a36Sopenharmony_ci	evldw		r16,24(r1);					   \
7462306a36Sopenharmony_ci	evldw		r17,32(r1);					   \
7562306a36Sopenharmony_ci	evldw		r18,40(r1);					   \
7662306a36Sopenharmony_ci	evldw		r19,48(r1);					   \
7762306a36Sopenharmony_ci	evldw		r20,56(r1);					   \
7862306a36Sopenharmony_ci	evldw		r21,64(r1);					   \
7962306a36Sopenharmony_ci	evldw		r22,72(r1);					   \
8062306a36Sopenharmony_ci	evldw		r23,80(r1);					   \
8162306a36Sopenharmony_ci	xor		r0,r0,r0;					   \
8262306a36Sopenharmony_ci	stw		r0,8(r1);	/* Delete sensitive data	*/ \
8362306a36Sopenharmony_ci	stw		r0,16(r1);	/* that we might have pushed	*/ \
8462306a36Sopenharmony_ci	stw		r0,24(r1);	/* from other context that runs	*/ \
8562306a36Sopenharmony_ci	stw		r0,32(r1);	/* the same code. Assume that	*/ \
8662306a36Sopenharmony_ci	stw		r0,40(r1);	/* the lower part of the GPRs	*/ \
8762306a36Sopenharmony_ci	stw		r0,48(r1);	/* were already overwritten on	*/ \
8862306a36Sopenharmony_ci	stw		r0,56(r1);	/* the way down to here		*/ \
8962306a36Sopenharmony_ci	stw		r0,64(r1);					   \
9062306a36Sopenharmony_ci	stw		r0,72(r1);					   \
9162306a36Sopenharmony_ci	stw		r0,80(r1);					   \
9262306a36Sopenharmony_ci	addi		r1,r1,128;	/* cleanup stack frame		*/
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ci#ifdef __BIG_ENDIAN__
9562306a36Sopenharmony_ci#define LOAD_DATA(reg, off) \
9662306a36Sopenharmony_ci	lwz		reg,off(rWP);	/* load data			*/
9762306a36Sopenharmony_ci#define NEXT_BLOCK \
9862306a36Sopenharmony_ci	addi		rWP,rWP,64;	/* increment per block		*/
9962306a36Sopenharmony_ci#else
10062306a36Sopenharmony_ci#define LOAD_DATA(reg, off) \
10162306a36Sopenharmony_ci	lwbrx		reg,0,rWP;	/* load data			*/ \
10262306a36Sopenharmony_ci	addi		rWP,rWP,4;	/* increment per word		*/
10362306a36Sopenharmony_ci#define NEXT_BLOCK			/* nothing to do		*/
10462306a36Sopenharmony_ci#endif
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ci#define	R_00_15(a, b, c, d, e, w0, w1, k, off) \
10762306a36Sopenharmony_ci	LOAD_DATA(w0, off)		/* 1: W				*/ \
10862306a36Sopenharmony_ci	and		rT2,b,c;	/* 1: F' = B and C 		*/ \
10962306a36Sopenharmony_ci	LOAD_K##k##1							   \
11062306a36Sopenharmony_ci	andc		rT1,d,b;	/* 1: F" = ~B and D 		*/ \
11162306a36Sopenharmony_ci	rotrwi		rT0,a,27;	/* 1: A' = A rotl 5		*/ \
11262306a36Sopenharmony_ci	or		rT2,rT2,rT1;	/* 1: F = F' or F"		*/ \
11362306a36Sopenharmony_ci	add		e,e,rT0;	/* 1: E = E + A'		*/ \
11462306a36Sopenharmony_ci	rotrwi		b,b,2;		/* 1: B = B rotl 30		*/ \
11562306a36Sopenharmony_ci	add		e,e,w0;		/* 1: E = E + W			*/ \
11662306a36Sopenharmony_ci	LOAD_DATA(w1, off+4)		/* 2: W				*/ \
11762306a36Sopenharmony_ci	add		e,e,rT2;	/* 1: E = E + F			*/ \
11862306a36Sopenharmony_ci	and		rT1,a,b;	/* 2: F' = B and C 		*/ \
11962306a36Sopenharmony_ci	add		e,e,rK;		/* 1: E = E + K			*/ \
12062306a36Sopenharmony_ci	andc		rT2,c,a;	/* 2: F" = ~B and D 		*/ \
12162306a36Sopenharmony_ci	add		d,d,rK;		/* 2: E = E + K			*/ \
12262306a36Sopenharmony_ci	or		rT2,rT2,rT1;	/* 2: F = F' or F"		*/ \
12362306a36Sopenharmony_ci	rotrwi		rT0,e,27;	/* 2: A' = A rotl 5		*/ \
12462306a36Sopenharmony_ci	add		d,d,w1;		/* 2: E = E + W			*/ \
12562306a36Sopenharmony_ci	rotrwi		a,a,2;		/* 2: B = B rotl 30		*/ \
12662306a36Sopenharmony_ci	add		d,d,rT0;	/* 2: E = E + A'		*/ \
12762306a36Sopenharmony_ci	evmergelo	w1,w1,w0;	/*    mix W[0]/W[1]		*/ \
12862306a36Sopenharmony_ci	add		d,d,rT2		/* 2: E = E + F			*/
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_ci#define R_16_19(a, b, c, d, e, w0, w1, w4, w6, w7, k) \
13162306a36Sopenharmony_ci	and		rT2,b,c;	/* 1: F' = B and C 		*/ \
13262306a36Sopenharmony_ci	evmergelohi	rT0,w7,w6;	/*    W[-3]			*/ \
13362306a36Sopenharmony_ci	andc		rT1,d,b;	/* 1: F" = ~B and D 		*/ \
13462306a36Sopenharmony_ci	evxor		w0,w0,rT0;	/*    W = W[-16] xor W[-3]	*/ \
13562306a36Sopenharmony_ci	or		rT1,rT1,rT2;	/* 1: F = F' or F"		*/ \
13662306a36Sopenharmony_ci	evxor		w0,w0,w4;	/*    W = W xor W[-8]		*/ \
13762306a36Sopenharmony_ci	add		e,e,rT1;	/* 1: E = E + F			*/ \
13862306a36Sopenharmony_ci	evxor		w0,w0,w1;	/*    W = W xor W[-14]		*/ \
13962306a36Sopenharmony_ci	rotrwi		rT2,a,27;	/* 1: A' = A rotl 5		*/ \
14062306a36Sopenharmony_ci	evrlwi		w0,w0,1;	/*    W = W rotl 1		*/ \
14162306a36Sopenharmony_ci	add		e,e,rT2;	/* 1: E = E + A'		*/ \
14262306a36Sopenharmony_ci	evaddw		rT0,w0,rK;	/*    WK = W + K		*/ \
14362306a36Sopenharmony_ci	rotrwi		b,b,2;		/* 1: B = B rotl 30		*/ \
14462306a36Sopenharmony_ci	LOAD_K##k##1							   \
14562306a36Sopenharmony_ci	evmergehi	rT1,rT1,rT0;	/*    WK1/WK2			*/ \
14662306a36Sopenharmony_ci	add		e,e,rT0;	/* 1: E = E + WK		*/ \
14762306a36Sopenharmony_ci	add		d,d,rT1;	/* 2: E = E + WK		*/ \
14862306a36Sopenharmony_ci	and		rT2,a,b;	/* 2: F' = B and C 		*/ \
14962306a36Sopenharmony_ci	andc		rT1,c,a;	/* 2: F" = ~B and D 		*/ \
15062306a36Sopenharmony_ci	rotrwi		rT0,e,27;	/* 2: A' = A rotl 5		*/ \
15162306a36Sopenharmony_ci	or		rT1,rT1,rT2;	/* 2: F = F' or F"		*/ \
15262306a36Sopenharmony_ci	add		d,d,rT0;	/* 2: E = E + A'		*/ \
15362306a36Sopenharmony_ci	rotrwi		a,a,2;		/* 2: B = B rotl 30		*/ \
15462306a36Sopenharmony_ci	add		d,d,rT1		/* 2: E = E + F			*/
15562306a36Sopenharmony_ci
15662306a36Sopenharmony_ci#define R_20_39(a, b, c, d, e, w0, w1, w4, w6, w7, k) \
15762306a36Sopenharmony_ci	evmergelohi	rT0,w7,w6;	/*    W[-3]			*/ \
15862306a36Sopenharmony_ci	xor		rT2,b,c;	/* 1: F' = B xor C		*/ \
15962306a36Sopenharmony_ci	evxor		w0,w0,rT0;	/*    W = W[-16] xor W[-3]	*/ \
16062306a36Sopenharmony_ci	xor		rT2,rT2,d;	/* 1: F = F' xor D		*/ \
16162306a36Sopenharmony_ci	evxor		w0,w0,w4;	/*    W = W xor W[-8]		*/ \
16262306a36Sopenharmony_ci	add		e,e,rT2;	/* 1: E = E + F			*/ \
16362306a36Sopenharmony_ci	evxor		w0,w0,w1;	/*    W = W xor W[-14]		*/ \
16462306a36Sopenharmony_ci	rotrwi		rT2,a,27;	/* 1: A' = A rotl 5		*/ \
16562306a36Sopenharmony_ci	evrlwi		w0,w0,1;	/*    W = W rotl 1		*/ \
16662306a36Sopenharmony_ci	add		e,e,rT2;	/* 1: E = E + A'		*/ \
16762306a36Sopenharmony_ci	evaddw		rT0,w0,rK;	/*    WK = W + K		*/ \
16862306a36Sopenharmony_ci	rotrwi		b,b,2;		/* 1: B = B rotl 30		*/ \
16962306a36Sopenharmony_ci	LOAD_K##k##1							   \
17062306a36Sopenharmony_ci	evmergehi	rT1,rT1,rT0;	/*    WK1/WK2			*/ \
17162306a36Sopenharmony_ci	add		e,e,rT0;	/* 1: E = E + WK		*/ \
17262306a36Sopenharmony_ci	xor		rT2,a,b;	/* 2: F' = B xor C		*/ \
17362306a36Sopenharmony_ci	add		d,d,rT1;	/* 2: E = E + WK		*/ \
17462306a36Sopenharmony_ci	xor		rT2,rT2,c;	/* 2: F = F' xor D		*/ \
17562306a36Sopenharmony_ci	rotrwi		rT0,e,27;	/* 2: A' = A rotl 5		*/ \
17662306a36Sopenharmony_ci	add		d,d,rT2;	/* 2: E = E + F			*/ \
17762306a36Sopenharmony_ci	rotrwi		a,a,2;		/* 2: B = B rotl 30		*/ \
17862306a36Sopenharmony_ci	add		d,d,rT0		/* 2: E = E + A'		*/
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci#define R_40_59(a, b, c, d, e, w0, w1, w4, w6, w7, k) \
18162306a36Sopenharmony_ci	and		rT2,b,c;	/* 1: F' = B and C		*/ \
18262306a36Sopenharmony_ci	evmergelohi	rT0,w7,w6;	/*    W[-3]			*/ \
18362306a36Sopenharmony_ci	or		rT1,b,c;	/* 1: F" = B or C		*/ \
18462306a36Sopenharmony_ci	evxor		w0,w0,rT0;	/*    W = W[-16] xor W[-3]	*/ \
18562306a36Sopenharmony_ci	and		rT1,d,rT1;	/* 1: F" = F" and D		*/ \
18662306a36Sopenharmony_ci	evxor		w0,w0,w4;	/*    W = W xor W[-8]		*/ \
18762306a36Sopenharmony_ci	or		rT2,rT2,rT1;	/* 1: F = F' or F"		*/ \
18862306a36Sopenharmony_ci	evxor		w0,w0,w1;	/*    W = W xor W[-14]		*/ \
18962306a36Sopenharmony_ci	add		e,e,rT2;	/* 1: E = E + F			*/ \
19062306a36Sopenharmony_ci	evrlwi		w0,w0,1;	/*    W = W rotl 1		*/ \
19162306a36Sopenharmony_ci	rotrwi		rT2,a,27;	/* 1: A' = A rotl 5		*/ \
19262306a36Sopenharmony_ci	evaddw		rT0,w0,rK;	/*    WK = W + K		*/ \
19362306a36Sopenharmony_ci	add		e,e,rT2;	/* 1: E = E + A'		*/ \
19462306a36Sopenharmony_ci	LOAD_K##k##1							   \
19562306a36Sopenharmony_ci	evmergehi	rT1,rT1,rT0;	/*    WK1/WK2			*/ \
19662306a36Sopenharmony_ci	rotrwi		b,b,2;		/* 1: B = B rotl 30		*/ \
19762306a36Sopenharmony_ci	add		e,e,rT0;	/* 1: E = E + WK		*/ \
19862306a36Sopenharmony_ci	and		rT2,a,b;	/* 2: F' = B and C		*/ \
19962306a36Sopenharmony_ci	or		rT0,a,b;	/* 2: F" = B or C		*/ \
20062306a36Sopenharmony_ci	add		d,d,rT1;	/* 2: E = E + WK		*/ \
20162306a36Sopenharmony_ci	and		rT0,c,rT0;	/* 2: F" = F" and D		*/ \
20262306a36Sopenharmony_ci	rotrwi		a,a,2;		/* 2: B = B rotl 30		*/ \
20362306a36Sopenharmony_ci	or		rT2,rT2,rT0;	/* 2: F = F' or F"		*/ \
20462306a36Sopenharmony_ci	rotrwi		rT0,e,27;	/* 2: A' = A rotl 5		*/ \
20562306a36Sopenharmony_ci	add		d,d,rT2;	/* 2: E = E + F			*/ \
20662306a36Sopenharmony_ci	add		d,d,rT0		/* 2: E = E + A'		*/
20762306a36Sopenharmony_ci
20862306a36Sopenharmony_ci#define R_60_79(a, b, c, d, e, w0, w1, w4, w6, w7, k) \
20962306a36Sopenharmony_ci	R_20_39(a, b, c, d, e, w0, w1, w4, w6, w7, k)
21062306a36Sopenharmony_ci
21162306a36Sopenharmony_ci_GLOBAL(ppc_spe_sha1_transform)
21262306a36Sopenharmony_ci	INITIALIZE
21362306a36Sopenharmony_ci
21462306a36Sopenharmony_ci	lwz		rH0,0(rHP)
21562306a36Sopenharmony_ci	lwz		rH1,4(rHP)
21662306a36Sopenharmony_ci	mtctr		r5
21762306a36Sopenharmony_ci	lwz		rH2,8(rHP)
21862306a36Sopenharmony_ci	lis		rKP,PPC_SPE_SHA1_K@h
21962306a36Sopenharmony_ci	lwz		rH3,12(rHP)
22062306a36Sopenharmony_ci	ori		rKP,rKP,PPC_SPE_SHA1_K@l
22162306a36Sopenharmony_ci	lwz		rH4,16(rHP)
22262306a36Sopenharmony_ci
22362306a36Sopenharmony_cippc_spe_sha1_main:
22462306a36Sopenharmony_ci	R_00_15(rH0, rH1, rH2, rH3, rH4, rW1, rW0, 1, 0)
22562306a36Sopenharmony_ci	R_00_15(rH3, rH4, rH0, rH1, rH2, rW2, rW1, 0, 8)
22662306a36Sopenharmony_ci	R_00_15(rH1, rH2, rH3, rH4, rH0, rW3, rW2, 0, 16)
22762306a36Sopenharmony_ci	R_00_15(rH4, rH0, rH1, rH2, rH3, rW4, rW3, 0, 24)
22862306a36Sopenharmony_ci	R_00_15(rH2, rH3, rH4, rH0, rH1, rW5, rW4, 0, 32)
22962306a36Sopenharmony_ci	R_00_15(rH0, rH1, rH2, rH3, rH4, rW6, rW5, 0, 40)
23062306a36Sopenharmony_ci	R_00_15(rH3, rH4, rH0, rH1, rH2, rT3, rW6, 0, 48)
23162306a36Sopenharmony_ci	R_00_15(rH1, rH2, rH3, rH4, rH0, rT3, rW7, 0, 56)
23262306a36Sopenharmony_ci
23362306a36Sopenharmony_ci	R_16_19(rH4, rH0, rH1, rH2, rH3, rW0, rW1, rW4, rW6, rW7, 0)
23462306a36Sopenharmony_ci	R_16_19(rH2, rH3, rH4, rH0, rH1, rW1, rW2, rW5, rW7, rW0, 2)
23562306a36Sopenharmony_ci
23662306a36Sopenharmony_ci	R_20_39(rH0, rH1, rH2, rH3, rH4, rW2, rW3, rW6, rW0, rW1, 0)
23762306a36Sopenharmony_ci	R_20_39(rH3, rH4, rH0, rH1, rH2, rW3, rW4, rW7, rW1, rW2, 0)
23862306a36Sopenharmony_ci	R_20_39(rH1, rH2, rH3, rH4, rH0, rW4, rW5, rW0, rW2, rW3, 0)
23962306a36Sopenharmony_ci	R_20_39(rH4, rH0, rH1, rH2, rH3, rW5, rW6, rW1, rW3, rW4, 0)
24062306a36Sopenharmony_ci	R_20_39(rH2, rH3, rH4, rH0, rH1, rW6, rW7, rW2, rW4, rW5, 0)
24162306a36Sopenharmony_ci	R_20_39(rH0, rH1, rH2, rH3, rH4, rW7, rW0, rW3, rW5, rW6, 0)
24262306a36Sopenharmony_ci	R_20_39(rH3, rH4, rH0, rH1, rH2, rW0, rW1, rW4, rW6, rW7, 0)
24362306a36Sopenharmony_ci	R_20_39(rH1, rH2, rH3, rH4, rH0, rW1, rW2, rW5, rW7, rW0, 0)
24462306a36Sopenharmony_ci	R_20_39(rH4, rH0, rH1, rH2, rH3, rW2, rW3, rW6, rW0, rW1, 0)
24562306a36Sopenharmony_ci	R_20_39(rH2, rH3, rH4, rH0, rH1, rW3, rW4, rW7, rW1, rW2, 3)
24662306a36Sopenharmony_ci
24762306a36Sopenharmony_ci	R_40_59(rH0, rH1, rH2, rH3, rH4, rW4, rW5, rW0, rW2, rW3, 0)
24862306a36Sopenharmony_ci	R_40_59(rH3, rH4, rH0, rH1, rH2, rW5, rW6, rW1, rW3, rW4, 0)
24962306a36Sopenharmony_ci	R_40_59(rH1, rH2, rH3, rH4, rH0, rW6, rW7, rW2, rW4, rW5, 0)
25062306a36Sopenharmony_ci	R_40_59(rH4, rH0, rH1, rH2, rH3, rW7, rW0, rW3, rW5, rW6, 0)
25162306a36Sopenharmony_ci	R_40_59(rH2, rH3, rH4, rH0, rH1, rW0, rW1, rW4, rW6, rW7, 0)
25262306a36Sopenharmony_ci	R_40_59(rH0, rH1, rH2, rH3, rH4, rW1, rW2, rW5, rW7, rW0, 0)
25362306a36Sopenharmony_ci	R_40_59(rH3, rH4, rH0, rH1, rH2, rW2, rW3, rW6, rW0, rW1, 0)
25462306a36Sopenharmony_ci	R_40_59(rH1, rH2, rH3, rH4, rH0, rW3, rW4, rW7, rW1, rW2, 0)
25562306a36Sopenharmony_ci	R_40_59(rH4, rH0, rH1, rH2, rH3, rW4, rW5, rW0, rW2, rW3, 0)
25662306a36Sopenharmony_ci	R_40_59(rH2, rH3, rH4, rH0, rH1, rW5, rW6, rW1, rW3, rW4, 4)
25762306a36Sopenharmony_ci
25862306a36Sopenharmony_ci	R_60_79(rH0, rH1, rH2, rH3, rH4, rW6, rW7, rW2, rW4, rW5, 0)
25962306a36Sopenharmony_ci	R_60_79(rH3, rH4, rH0, rH1, rH2, rW7, rW0, rW3, rW5, rW6, 0)
26062306a36Sopenharmony_ci	R_60_79(rH1, rH2, rH3, rH4, rH0, rW0, rW1, rW4, rW6, rW7, 0)
26162306a36Sopenharmony_ci	R_60_79(rH4, rH0, rH1, rH2, rH3, rW1, rW2, rW5, rW7, rW0, 0)
26262306a36Sopenharmony_ci	R_60_79(rH2, rH3, rH4, rH0, rH1, rW2, rW3, rW6, rW0, rW1, 0)
26362306a36Sopenharmony_ci	R_60_79(rH0, rH1, rH2, rH3, rH4, rW3, rW4, rW7, rW1, rW2, 0)
26462306a36Sopenharmony_ci	R_60_79(rH3, rH4, rH0, rH1, rH2, rW4, rW5, rW0, rW2, rW3, 0)
26562306a36Sopenharmony_ci	lwz		rT3,0(rHP)
26662306a36Sopenharmony_ci	R_60_79(rH1, rH2, rH3, rH4, rH0, rW5, rW6, rW1, rW3, rW4, 0)
26762306a36Sopenharmony_ci	lwz		rW1,4(rHP)
26862306a36Sopenharmony_ci	R_60_79(rH4, rH0, rH1, rH2, rH3, rW6, rW7, rW2, rW4, rW5, 0)
26962306a36Sopenharmony_ci	lwz		rW2,8(rHP)
27062306a36Sopenharmony_ci	R_60_79(rH2, rH3, rH4, rH0, rH1, rW7, rW0, rW3, rW5, rW6, 0)
27162306a36Sopenharmony_ci	lwz		rW3,12(rHP)
27262306a36Sopenharmony_ci	NEXT_BLOCK
27362306a36Sopenharmony_ci	lwz		rW4,16(rHP)
27462306a36Sopenharmony_ci
27562306a36Sopenharmony_ci	add		rH0,rH0,rT3
27662306a36Sopenharmony_ci	stw		rH0,0(rHP)
27762306a36Sopenharmony_ci	add		rH1,rH1,rW1
27862306a36Sopenharmony_ci	stw		rH1,4(rHP)
27962306a36Sopenharmony_ci	add		rH2,rH2,rW2
28062306a36Sopenharmony_ci	stw		rH2,8(rHP)
28162306a36Sopenharmony_ci	add		rH3,rH3,rW3
28262306a36Sopenharmony_ci	stw		rH3,12(rHP)
28362306a36Sopenharmony_ci	add		rH4,rH4,rW4
28462306a36Sopenharmony_ci	stw		rH4,16(rHP)
28562306a36Sopenharmony_ci
28662306a36Sopenharmony_ci	bdnz		ppc_spe_sha1_main
28762306a36Sopenharmony_ci
28862306a36Sopenharmony_ci	FINALIZE
28962306a36Sopenharmony_ci	blr
29062306a36Sopenharmony_ci
29162306a36Sopenharmony_ci.data
29262306a36Sopenharmony_ci.align 4
29362306a36Sopenharmony_ciPPC_SPE_SHA1_K:
29462306a36Sopenharmony_ci	.long 0x5A827999,0x6ED9EBA1,0x8F1BBCDC,0xCA62C1D6
295