xref: /netbsd-src/crypto/external/bsd/openssl.old/lib/libcrypto/arch/sparc/dest4-sparcv9.S (revision 4724848cf0da353df257f730694b7882798e5daf)
1#include "sparc_arch.h"
2
3#ifdef	__arch64__
4.register       %g2,#scratch
5.register       %g3,#scratch
6#endif
7
8.text
9.align	32
10.globl	des_t4_key_expand
11.type	des_t4_key_expand,#function
12des_t4_key_expand:
13	andcc		%o0, 0x7, %g0
14	.word	0x91b20300 !alignaddr	%o0,%g0,%o0
15	bz,pt		%icc, 1f
16	ldd		[%o0 + 0x00], %f0
17	ldd		[%o0 + 0x08], %f2
18	.word	0x81b00902 !faligndata	%f0,%f2,%f0
191:	.word	0x81b026c0 !des_kexpand	%f0,0,%f0,
20	.word	0x85b026c1 !des_kexpand	%f0,1,%f2,
21	std		%f0, [%o1 + 0x00]
22	.word	0x8db0a6c3 !des_kexpand	%f2,3,%f6,
23	std		%f2, [%o1 + 0x08]
24	.word	0x89b0a6c2 !des_kexpand	%f2,2,%f4,
25	.word	0x95b1a6c3 !des_kexpand	%f6,3,%f10,
26	std		%f6, [%o1 + 0x18]
27	.word	0x91b1a6c2 !des_kexpand	%f6,2,%f8,
28	std		%f4, [%o1 + 0x10]
29	.word	0x9db2a6c3 !des_kexpand	%f10,3,%f14,
30	std		%f10, [%o1 + 0x28]
31	.word	0x99b2a6c2 !des_kexpand	%f10,2,%f12,
32	std		%f8, [%o1 + 0x20]
33	.word	0xa1b3a6c1 !des_kexpand	%f14,1,%f16,
34	std		%f14, [%o1 + 0x38]
35	.word	0xa9b426c3 !des_kexpand	%f16,3,%f20,
36	std		%f12, [%o1 + 0x30]
37	.word	0xa5b426c2 !des_kexpand	%f16,2,%f18,
38	std		%f16, [%o1 + 0x40]
39	.word	0xb1b526c3 !des_kexpand	%f20,3,%f24,
40	std		%f20, [%o1 + 0x50]
41	.word	0xadb526c2 !des_kexpand	%f20,2,%f22,
42	std		%f18, [%o1 + 0x48]
43	.word	0xb9b626c3 !des_kexpand	%f24,3,%f28,
44	std		%f24, [%o1 + 0x60]
45	.word	0xb5b626c2 !des_kexpand	%f24,2,%f26,
46	std		%f22, [%o1 + 0x58]
47	.word	0xbdb726c1 !des_kexpand	%f28,1,%f30,
48	std		%f28, [%o1 + 0x70]
49	std		%f26, [%o1 + 0x68]
50	retl
51	std		%f30, [%o1 + 0x78]
52.size	des_t4_key_expand,.-des_t4_key_expand
53.globl	des_t4_cbc_encrypt
54.align	32
55des_t4_cbc_encrypt:
56	cmp		%o2, 0
57	be,pn		SIZE_T_CC, .Lcbc_abort
58	srln		%o2, 0, %o2		! needed on v8+, "nop" on v9
59	ld		[%o4 + 0], %f0	! load ivec
60	ld		[%o4 + 4], %f1
61
62	and		%o0, 7, %g1
63	andn		%o0, 7, %o0
64	sll		%g1, 3, %g1
65	mov		0xff, %g3
66	prefetch	[%o0], 20
67	prefetch	[%o0 + 63], 20
68	sub		%g0, %g1, %g2
69	and		%o1, 7, %g4
70	.word	0x93b24340 !alignaddrl	%o1,%g0,%o1
71	srl		%g3, %g4, %g3
72	srlx		%o2, 3, %o2
73	movrz		%g4, 0, %g3
74	prefetch	[%o1], 22
75
76	ldd		[%o3 + 0x00], %f4	! load key schedule
77	ldd		[%o3 + 0x08], %f6
78	ldd		[%o3 + 0x10], %f8
79	ldd		[%o3 + 0x18], %f10
80	ldd		[%o3 + 0x20], %f12
81	ldd		[%o3 + 0x28], %f14
82	ldd		[%o3 + 0x30], %f16
83	ldd		[%o3 + 0x38], %f18
84	ldd		[%o3 + 0x40], %f20
85	ldd		[%o3 + 0x48], %f22
86	ldd		[%o3 + 0x50], %f24
87	ldd		[%o3 + 0x58], %f26
88	ldd		[%o3 + 0x60], %f28
89	ldd		[%o3 + 0x68], %f30
90	ldd		[%o3 + 0x70], %f32
91	ldd		[%o3 + 0x78], %f34
92
93.Ldes_cbc_enc_loop:
94	ldx		[%o0 + 0], %g4
95	brz,pt		%g1, 4f
96	nop
97
98	ldx		[%o0 + 8], %g5
99	sllx		%g4, %g1, %g4
100	srlx		%g5, %g2, %g5
101	or		%g5, %g4, %g4
1024:
103	.word	0x85b02304 !movxtod	%g4,%f2
104	prefetch	[%o0 + 8+63], 20
105	add		%o0, 8, %o0
106	.word	0x81b08d80 !fxor	%f2,%f0,%f0		! ^= ivec
107	prefetch	[%o1 + 63], 22
108
109	.word	0x81b02680 !des_ip	%f0,%f0,,
110	.word	0x80c90126 !des_round	%f4,%f6,%f0,%f0
111	.word	0x80ca012a !des_round	%f8,%f10,%f0,%f0
112	.word	0x80cb012e !des_round	%f12,%f14,%f0,%f0
113	.word	0x80cc0132 !des_round	%f16,%f18,%f0,%f0
114	.word	0x80cd0136 !des_round	%f20,%f22,%f0,%f0
115	.word	0x80ce013a !des_round	%f24,%f26,%f0,%f0
116	.word	0x80cf013e !des_round	%f28,%f30,%f0,%f0
117	.word	0x80c84123 !des_round	%f32,%f34,%f0,%f0
118	.word	0x81b026a0 !des_iip	%f0,%f0,,
119
120	brnz,pn		%g3, 2f
121	sub		%o2, 1, %o2
122
123	std		%f0, [%o1 + 0]
124	brnz,pt		%o2, .Ldes_cbc_enc_loop
125	add		%o1, 8, %o1
126
127	st		%f0, [%o4 + 0]	! write out ivec
128	retl
129	st		%f1, [%o4 + 4]
130.Lcbc_abort:
131	retl
132	nop
133
134.align	16
1352:	ldxa		[%o0]0x82, %g4		! avoid read-after-write hazard
136						! and ~4x deterioration
137						! in inp==out case
138	.word	0x85b00900 !faligndata	%f0,%f0,%f2		! handle unaligned output
139
140	stda		%f2, [%o1 + %g3]0xc0	! partial store
141	add		%o1, 8, %o1
142	orn		%g0, %g3, %g3
143	stda		%f2, [%o1 + %g3]0xc0	! partial store
144
145	brnz,pt		%o2, .Ldes_cbc_enc_loop+4
146	orn		%g0, %g3, %g3
147
148	st		%f0, [%o4 + 0]	! write out ivec
149	retl
150	st		%f1, [%o4 + 4]
151.type	des_t4_cbc_encrypt,#function
152.size	des_t4_cbc_encrypt,.-des_t4_cbc_encrypt
153
154.globl	des_t4_cbc_decrypt
155.align	32
156des_t4_cbc_decrypt:
157	cmp		%o2, 0
158	be,pn		SIZE_T_CC, .Lcbc_abort
159	srln		%o2, 0, %o2		! needed on v8+, "nop" on v9
160	ld		[%o4 + 0], %f2	! load ivec
161	ld		[%o4 + 4], %f3
162
163	and		%o0, 7, %g1
164	andn		%o0, 7, %o0
165	sll		%g1, 3, %g1
166	mov		0xff, %g3
167	prefetch	[%o0], 20
168	prefetch	[%o0 + 63], 20
169	sub		%g0, %g1, %g2
170	and		%o1, 7, %g4
171	.word	0x93b24340 !alignaddrl	%o1,%g0,%o1
172	srl		%g3, %g4, %g3
173	srlx		%o2, 3, %o2
174	movrz		%g4, 0, %g3
175	prefetch	[%o1], 22
176
177	ldd		[%o3 + 0x78], %f4	! load key schedule
178	ldd		[%o3 + 0x70], %f6
179	ldd		[%o3 + 0x68], %f8
180	ldd		[%o3 + 0x60], %f10
181	ldd		[%o3 + 0x58], %f12
182	ldd		[%o3 + 0x50], %f14
183	ldd		[%o3 + 0x48], %f16
184	ldd		[%o3 + 0x40], %f18
185	ldd		[%o3 + 0x38], %f20
186	ldd		[%o3 + 0x30], %f22
187	ldd		[%o3 + 0x28], %f24
188	ldd		[%o3 + 0x20], %f26
189	ldd		[%o3 + 0x18], %f28
190	ldd		[%o3 + 0x10], %f30
191	ldd		[%o3 + 0x08], %f32
192	ldd		[%o3 + 0x00], %f34
193
194.Ldes_cbc_dec_loop:
195	ldx		[%o0 + 0], %g4
196	brz,pt		%g1, 4f
197	nop
198
199	ldx		[%o0 + 8], %g5
200	sllx		%g4, %g1, %g4
201	srlx		%g5, %g2, %g5
202	or		%g5, %g4, %g4
2034:
204	.word	0x81b02304 !movxtod	%g4,%f0
205	prefetch	[%o0 + 8+63], 20
206	add		%o0, 8, %o0
207	prefetch	[%o1 + 63], 22
208
209	.word	0x81b02680 !des_ip	%f0,%f0,,
210	.word	0x80c90126 !des_round	%f4,%f6,%f0,%f0
211	.word	0x80ca012a !des_round	%f8,%f10,%f0,%f0
212	.word	0x80cb012e !des_round	%f12,%f14,%f0,%f0
213	.word	0x80cc0132 !des_round	%f16,%f18,%f0,%f0
214	.word	0x80cd0136 !des_round	%f20,%f22,%f0,%f0
215	.word	0x80ce013a !des_round	%f24,%f26,%f0,%f0
216	.word	0x80cf013e !des_round	%f28,%f30,%f0,%f0
217	.word	0x80c84123 !des_round	%f32,%f34,%f0,%f0
218	.word	0x81b026a0 !des_iip	%f0,%f0,,
219
220	.word	0x81b08d80 !fxor	%f2,%f0,%f0		! ^= ivec
221	.word	0x85b02304 !movxtod	%g4,%f2
222
223	brnz,pn		%g3, 2f
224	sub		%o2, 1, %o2
225
226	std		%f0, [%o1 + 0]
227	brnz,pt		%o2, .Ldes_cbc_dec_loop
228	add		%o1, 8, %o1
229
230	st		%f2, [%o4 + 0]	! write out ivec
231	retl
232	st		%f3, [%o4 + 4]
233
234.align	16
2352:	ldxa		[%o0]0x82, %g4		! avoid read-after-write hazard
236						! and ~4x deterioration
237						! in inp==out case
238	.word	0x81b00900 !faligndata	%f0,%f0,%f0		! handle unaligned output
239
240	stda		%f0, [%o1 + %g3]0xc0	! partial store
241	add		%o1, 8, %o1
242	orn		%g0, %g3, %g3
243	stda		%f0, [%o1 + %g3]0xc0	! partial store
244
245	brnz,pt		%o2, .Ldes_cbc_dec_loop+4
246	orn		%g0, %g3, %g3
247
248	st		%f2, [%o4 + 0]	! write out ivec
249	retl
250	st		%f3, [%o4 + 4]
251.type	des_t4_cbc_decrypt,#function
252.size	des_t4_cbc_decrypt,.-des_t4_cbc_decrypt
253.globl	des_t4_ede3_cbc_encrypt
254.align	32
255des_t4_ede3_cbc_encrypt:
256	cmp		%o2, 0
257	be,pn		SIZE_T_CC, .Lcbc_abort
258	srln		%o2, 0, %o2		! needed on v8+, "nop" on v9
259	ld		[%o4 + 0], %f0	! load ivec
260	ld		[%o4 + 4], %f1
261
262	and		%o0, 7, %g1
263	andn		%o0, 7, %o0
264	sll		%g1, 3, %g1
265	mov		0xff, %g3
266	prefetch	[%o0], 20
267	prefetch	[%o0 + 63], 20
268	sub		%g0, %g1, %g2
269	and		%o1, 7, %g4
270	.word	0x93b24340 !alignaddrl	%o1,%g0,%o1
271	srl		%g3, %g4, %g3
272	srlx		%o2, 3, %o2
273	movrz		%g4, 0, %g3
274	prefetch	[%o1], 22
275
276	ldd		[%o3 + 0x00], %f4	! load key schedule
277	ldd		[%o3 + 0x08], %f6
278	ldd		[%o3 + 0x10], %f8
279	ldd		[%o3 + 0x18], %f10
280	ldd		[%o3 + 0x20], %f12
281	ldd		[%o3 + 0x28], %f14
282	ldd		[%o3 + 0x30], %f16
283	ldd		[%o3 + 0x38], %f18
284	ldd		[%o3 + 0x40], %f20
285	ldd		[%o3 + 0x48], %f22
286	ldd		[%o3 + 0x50], %f24
287	ldd		[%o3 + 0x58], %f26
288	ldd		[%o3 + 0x60], %f28
289	ldd		[%o3 + 0x68], %f30
290	ldd		[%o3 + 0x70], %f32
291	ldd		[%o3 + 0x78], %f34
292
293.Ldes_ede3_cbc_enc_loop:
294	ldx		[%o0 + 0], %g4
295	brz,pt		%g1, 4f
296	nop
297
298	ldx		[%o0 + 8], %g5
299	sllx		%g4, %g1, %g4
300	srlx		%g5, %g2, %g5
301	or		%g5, %g4, %g4
3024:
303	.word	0x85b02304 !movxtod	%g4,%f2
304	prefetch	[%o0 + 8+63], 20
305	add		%o0, 8, %o0
306	.word	0x81b08d80 !fxor	%f2,%f0,%f0		! ^= ivec
307	prefetch	[%o1 + 63], 22
308
309	.word	0x81b02680 !des_ip	%f0,%f0,,
310	.word	0x80c90126 !des_round	%f4,%f6,%f0,%f0
311	.word	0x80ca012a !des_round	%f8,%f10,%f0,%f0
312	.word	0x80cb012e !des_round	%f12,%f14,%f0,%f0
313	.word	0x80cc0132 !des_round	%f16,%f18,%f0,%f0
314	ldd		[%o3 + 0x100-0x08], %f36
315	ldd		[%o3 + 0x100-0x10], %f38
316	.word	0x80cd0136 !des_round	%f20,%f22,%f0,%f0
317	ldd		[%o3 + 0x100-0x18], %f40
318	ldd		[%o3 + 0x100-0x20], %f42
319	.word	0x80ce013a !des_round	%f24,%f26,%f0,%f0
320	ldd		[%o3 + 0x100-0x28], %f44
321	ldd		[%o3 + 0x100-0x30], %f46
322	.word	0x80cf013e !des_round	%f28,%f30,%f0,%f0
323	ldd		[%o3 + 0x100-0x38], %f48
324	ldd		[%o3 + 0x100-0x40], %f50
325	.word	0x80c84123 !des_round	%f32,%f34,%f0,%f0
326	ldd		[%o3 + 0x100-0x48], %f52
327	ldd		[%o3 + 0x100-0x50], %f54
328	.word	0x81b026a0 !des_iip	%f0,%f0,,
329
330	ldd		[%o3 + 0x100-0x58], %f56
331	ldd		[%o3 + 0x100-0x60], %f58
332	.word	0x81b02680 !des_ip	%f0,%f0,,
333	ldd		[%o3 + 0x100-0x68], %f60
334	ldd		[%o3 + 0x100-0x70], %f62
335	.word	0x80c94127 !des_round	%f36,%f38,%f0,%f0
336	ldd		[%o3 + 0x100-0x78], %f36
337	ldd		[%o3 + 0x100-0x80], %f38
338	.word	0x80ca412b !des_round	%f40,%f42,%f0,%f0
339	.word	0x80cb412f !des_round	%f44,%f46,%f0,%f0
340	.word	0x80cc4133 !des_round	%f48,%f50,%f0,%f0
341	ldd		[%o3 + 0x100+0x00], %f40
342	ldd		[%o3 + 0x100+0x08], %f42
343	.word	0x80cd4137 !des_round	%f52,%f54,%f0,%f0
344	ldd		[%o3 + 0x100+0x10], %f44
345	ldd		[%o3 + 0x100+0x18], %f46
346	.word	0x80ce413b !des_round	%f56,%f58,%f0,%f0
347	ldd		[%o3 + 0x100+0x20], %f48
348	ldd		[%o3 + 0x100+0x28], %f50
349	.word	0x80cf413f !des_round	%f60,%f62,%f0,%f0
350	ldd		[%o3 + 0x100+0x30], %f52
351	ldd		[%o3 + 0x100+0x38], %f54
352	.word	0x80c94127 !des_round	%f36,%f38,%f0,%f0
353	ldd		[%o3 + 0x100+0x40], %f56
354	ldd		[%o3 + 0x100+0x48], %f58
355	.word	0x81b026a0 !des_iip	%f0,%f0,,
356
357	ldd		[%o3 + 0x100+0x50], %f60
358	ldd		[%o3 + 0x100+0x58], %f62
359	.word	0x81b02680 !des_ip	%f0,%f0,,
360	ldd		[%o3 + 0x100+0x60], %f36
361	ldd		[%o3 + 0x100+0x68], %f38
362	.word	0x80ca412b !des_round	%f40,%f42,%f0,%f0
363	ldd		[%o3 + 0x100+0x70], %f40
364	ldd		[%o3 + 0x100+0x78], %f42
365	.word	0x80cb412f !des_round	%f44,%f46,%f0,%f0
366	.word	0x80cc4133 !des_round	%f48,%f50,%f0,%f0
367	.word	0x80cd4137 !des_round	%f52,%f54,%f0,%f0
368	.word	0x80ce413b !des_round	%f56,%f58,%f0,%f0
369	.word	0x80cf413f !des_round	%f60,%f62,%f0,%f0
370	.word	0x80c94127 !des_round	%f36,%f38,%f0,%f0
371	.word	0x80ca412b !des_round	%f40,%f42,%f0,%f0
372	.word	0x81b026a0 !des_iip	%f0,%f0,,
373
374	brnz,pn		%g3, 2f
375	sub		%o2, 1, %o2
376
377	std		%f0, [%o1 + 0]
378	brnz,pt		%o2, .Ldes_ede3_cbc_enc_loop
379	add		%o1, 8, %o1
380
381	st		%f0, [%o4 + 0]	! write out ivec
382	retl
383	st		%f1, [%o4 + 4]
384
385.align	16
3862:	ldxa		[%o0]0x82, %g4		! avoid read-after-write hazard
387						! and ~2x deterioration
388						! in inp==out case
389	.word	0x85b00900 !faligndata	%f0,%f0,%f2		! handle unaligned output
390
391	stda		%f2, [%o1 + %g3]0xc0	! partial store
392	add		%o1, 8, %o1
393	orn		%g0, %g3, %g3
394	stda		%f2, [%o1 + %g3]0xc0	! partial store
395
396	brnz,pt		%o2, .Ldes_ede3_cbc_enc_loop+4
397	orn		%g0, %g3, %g3
398
399	st		%f0, [%o4 + 0]	! write out ivec
400	retl
401	st		%f1, [%o4 + 4]
402.type	des_t4_ede3_cbc_encrypt,#function
403.size	des_t4_ede3_cbc_encrypt,.-des_t4_ede3_cbc_encrypt
404
405.globl	des_t4_ede3_cbc_decrypt
406.align	32
407des_t4_ede3_cbc_decrypt:
408	cmp		%o2, 0
409	be,pn		SIZE_T_CC, .Lcbc_abort
410	srln		%o2, 0, %o2		! needed on v8+, "nop" on v9
411	ld		[%o4 + 0], %f2	! load ivec
412	ld		[%o4 + 4], %f3
413
414	and		%o0, 7, %g1
415	andn		%o0, 7, %o0
416	sll		%g1, 3, %g1
417	mov		0xff, %g3
418	prefetch	[%o0], 20
419	prefetch	[%o0 + 63], 20
420	sub		%g0, %g1, %g2
421	and		%o1, 7, %g4
422	.word	0x93b24340 !alignaddrl	%o1,%g0,%o1
423	srl		%g3, %g4, %g3
424	srlx		%o2, 3, %o2
425	movrz		%g4, 0, %g3
426	prefetch	[%o1], 22
427
428	ldd		[%o3 + 0x100+0x78], %f4	! load key schedule
429	ldd		[%o3 + 0x100+0x70], %f6
430	ldd		[%o3 + 0x100+0x68], %f8
431	ldd		[%o3 + 0x100+0x60], %f10
432	ldd		[%o3 + 0x100+0x58], %f12
433	ldd		[%o3 + 0x100+0x50], %f14
434	ldd		[%o3 + 0x100+0x48], %f16
435	ldd		[%o3 + 0x100+0x40], %f18
436	ldd		[%o3 + 0x100+0x38], %f20
437	ldd		[%o3 + 0x100+0x30], %f22
438	ldd		[%o3 + 0x100+0x28], %f24
439	ldd		[%o3 + 0x100+0x20], %f26
440	ldd		[%o3 + 0x100+0x18], %f28
441	ldd		[%o3 + 0x100+0x10], %f30
442	ldd		[%o3 + 0x100+0x08], %f32
443	ldd		[%o3 + 0x100+0x00], %f34
444
445.Ldes_ede3_cbc_dec_loop:
446	ldx		[%o0 + 0], %g4
447	brz,pt		%g1, 4f
448	nop
449
450	ldx		[%o0 + 8], %g5
451	sllx		%g4, %g1, %g4
452	srlx		%g5, %g2, %g5
453	or		%g5, %g4, %g4
4544:
455	.word	0x81b02304 !movxtod	%g4,%f0
456	prefetch	[%o0 + 8+63], 20
457	add		%o0, 8, %o0
458	prefetch	[%o1 + 63], 22
459
460	.word	0x81b02680 !des_ip	%f0,%f0,,
461	.word	0x80c90126 !des_round	%f4,%f6,%f0,%f0
462	.word	0x80ca012a !des_round	%f8,%f10,%f0,%f0
463	.word	0x80cb012e !des_round	%f12,%f14,%f0,%f0
464	.word	0x80cc0132 !des_round	%f16,%f18,%f0,%f0
465	ldd		[%o3 + 0x80+0x00], %f36
466	ldd		[%o3 + 0x80+0x08], %f38
467	.word	0x80cd0136 !des_round	%f20,%f22,%f0,%f0
468	ldd		[%o3 + 0x80+0x10], %f40
469	ldd		[%o3 + 0x80+0x18], %f42
470	.word	0x80ce013a !des_round	%f24,%f26,%f0,%f0
471	ldd		[%o3 + 0x80+0x20], %f44
472	ldd		[%o3 + 0x80+0x28], %f46
473	.word	0x80cf013e !des_round	%f28,%f30,%f0,%f0
474	ldd		[%o3 + 0x80+0x30], %f48
475	ldd		[%o3 + 0x80+0x38], %f50
476	.word	0x80c84123 !des_round	%f32,%f34,%f0,%f0
477	ldd		[%o3 + 0x80+0x40], %f52
478	ldd		[%o3 + 0x80+0x48], %f54
479	.word	0x81b026a0 !des_iip	%f0,%f0,,
480
481	ldd		[%o3 + 0x80+0x50], %f56
482	ldd		[%o3 + 0x80+0x58], %f58
483	.word	0x81b02680 !des_ip	%f0,%f0,,
484	ldd		[%o3 + 0x80+0x60], %f60
485	ldd		[%o3 + 0x80+0x68], %f62
486	.word	0x80c94127 !des_round	%f36,%f38,%f0,%f0
487	ldd		[%o3 + 0x80+0x70], %f36
488	ldd		[%o3 + 0x80+0x78], %f38
489	.word	0x80ca412b !des_round	%f40,%f42,%f0,%f0
490	.word	0x80cb412f !des_round	%f44,%f46,%f0,%f0
491	.word	0x80cc4133 !des_round	%f48,%f50,%f0,%f0
492	ldd		[%o3 + 0x80-0x08], %f40
493	ldd		[%o3 + 0x80-0x10], %f42
494	.word	0x80cd4137 !des_round	%f52,%f54,%f0,%f0
495	ldd		[%o3 + 0x80-0x18], %f44
496	ldd		[%o3 + 0x80-0x20], %f46
497	.word	0x80ce413b !des_round	%f56,%f58,%f0,%f0
498	ldd		[%o3 + 0x80-0x28], %f48
499	ldd		[%o3 + 0x80-0x30], %f50
500	.word	0x80cf413f !des_round	%f60,%f62,%f0,%f0
501	ldd		[%o3 + 0x80-0x38], %f52
502	ldd		[%o3 + 0x80-0x40], %f54
503	.word	0x80c94127 !des_round	%f36,%f38,%f0,%f0
504	ldd		[%o3 + 0x80-0x48], %f56
505	ldd		[%o3 + 0x80-0x50], %f58
506	.word	0x81b026a0 !des_iip	%f0,%f0,,
507
508	ldd		[%o3 + 0x80-0x58], %f60
509	ldd		[%o3 + 0x80-0x60], %f62
510	.word	0x81b02680 !des_ip	%f0,%f0,,
511	ldd		[%o3 + 0x80-0x68], %f36
512	ldd		[%o3 + 0x80-0x70], %f38
513	.word	0x80ca412b !des_round	%f40,%f42,%f0,%f0
514	ldd		[%o3 + 0x80-0x78], %f40
515	ldd		[%o3 + 0x80-0x80], %f42
516	.word	0x80cb412f !des_round	%f44,%f46,%f0,%f0
517	.word	0x80cc4133 !des_round	%f48,%f50,%f0,%f0
518	.word	0x80cd4137 !des_round	%f52,%f54,%f0,%f0
519	.word	0x80ce413b !des_round	%f56,%f58,%f0,%f0
520	.word	0x80cf413f !des_round	%f60,%f62,%f0,%f0
521	.word	0x80c94127 !des_round	%f36,%f38,%f0,%f0
522	.word	0x80ca412b !des_round	%f40,%f42,%f0,%f0
523	.word	0x81b026a0 !des_iip	%f0,%f0,,
524
525	.word	0x81b08d80 !fxor	%f2,%f0,%f0		! ^= ivec
526	.word	0x85b02304 !movxtod	%g4,%f2
527
528	brnz,pn		%g3, 2f
529	sub		%o2, 1, %o2
530
531	std		%f0, [%o1 + 0]
532	brnz,pt		%o2, .Ldes_ede3_cbc_dec_loop
533	add		%o1, 8, %o1
534
535	st		%f2, [%o4 + 0]	! write out ivec
536	retl
537	st		%f3, [%o4 + 4]
538
539.align	16
5402:	ldxa		[%o0]0x82, %g4		! avoid read-after-write hazard
541						! and ~3x deterioration
542						! in inp==out case
543	.word	0x81b00900 !faligndata	%f0,%f0,%f0		! handle unaligned output
544
545	stda		%f0, [%o1 + %g3]0xc0	! partial store
546	add		%o1, 8, %o1
547	orn		%g0, %g3, %g3
548	stda		%f0, [%o1 + %g3]0xc0	! partial store
549
550	brnz,pt		%o2, .Ldes_ede3_cbc_dec_loop+4
551	orn		%g0, %g3, %g3
552
553	st		%f2, [%o4 + 0]	! write out ivec
554	retl
555	st		%f3, [%o4 + 4]
556.type	des_t4_ede3_cbc_decrypt,#function
557.size	des_t4_ede3_cbc_decrypt,.-des_t4_ede3_cbc_decrypt
558.asciz  "DES for SPARC T4, David S. Miller, Andy Polyakov"
559.align  4
560