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