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