Linux Audio

Check our new training course

Loading...
v3.1
  1/*
  2 * arch/sparc64/lib/xor.S
  3 *
  4 * High speed xor_block operation for RAID4/5 utilizing the
  5 * UltraSparc Visual Instruction Set and Niagara store-init/twin-load.
  6 *
  7 * Copyright (C) 1997, 1999 Jakub Jelinek (jj@ultra.linux.cz)
  8 * Copyright (C) 2006 David S. Miller <davem@davemloft.net>
  9 */
 10
 
 11#include <asm/visasm.h>
 12#include <asm/asi.h>
 13#include <asm/dcu.h>
 14#include <asm/spitfire.h>
 15
 16/*
 17 *	Requirements:
 18 *	!(((long)dest | (long)sourceN) & (64 - 1)) &&
 19 *	!(len & 127) && len >= 256
 20 */
 21	.text
 22	.align	32
 23
 24	/* VIS versions. */
 25	.globl	xor_vis_2
 26	.type	xor_vis_2,#function
 27xor_vis_2:
 28	rd	%fprs, %o5
 29	andcc	%o5, FPRS_FEF|FPRS_DU, %g0
 30	be,pt	%icc, 0f
 31	 sethi	%hi(VISenter), %g1
 32	jmpl	%g1 + %lo(VISenter), %g7
 33	 add	%g7, 8, %g7
 340:	wr	%g0, FPRS_FEF, %fprs
 35	rd	%asi, %g1
 36	wr	%g0, ASI_BLK_P, %asi
 37	membar	#LoadStore|#StoreLoad|#StoreStore
 38	sub	%o0, 128, %o0
 39	ldda	[%o1] %asi, %f0
 40	ldda	[%o2] %asi, %f16
 41
 422:	ldda	[%o1 + 64] %asi, %f32
 43	fxor	%f0, %f16, %f16
 44	fxor	%f2, %f18, %f18
 45	fxor	%f4, %f20, %f20
 46	fxor	%f6, %f22, %f22
 47	fxor	%f8, %f24, %f24
 48	fxor	%f10, %f26, %f26
 49	fxor	%f12, %f28, %f28
 50	fxor	%f14, %f30, %f30
 51	stda	%f16, [%o1] %asi
 52	ldda	[%o2 + 64] %asi, %f48
 53	ldda	[%o1 + 128] %asi, %f0
 54	fxor	%f32, %f48, %f48
 55	fxor	%f34, %f50, %f50
 56	add	%o1, 128, %o1
 57	fxor	%f36, %f52, %f52
 58	add	%o2, 128, %o2
 59	fxor	%f38, %f54, %f54
 60	subcc	%o0, 128, %o0
 61	fxor	%f40, %f56, %f56
 62	fxor	%f42, %f58, %f58
 63	fxor	%f44, %f60, %f60
 64	fxor	%f46, %f62, %f62
 65	stda	%f48, [%o1 - 64] %asi
 66	bne,pt	%xcc, 2b
 67	 ldda	[%o2] %asi, %f16
 68
 69	ldda	[%o1 + 64] %asi, %f32
 70	fxor	%f0, %f16, %f16
 71	fxor	%f2, %f18, %f18
 72	fxor	%f4, %f20, %f20
 73	fxor	%f6, %f22, %f22
 74	fxor	%f8, %f24, %f24
 75	fxor	%f10, %f26, %f26
 76	fxor	%f12, %f28, %f28
 77	fxor	%f14, %f30, %f30
 78	stda	%f16, [%o1] %asi
 79	ldda	[%o2 + 64] %asi, %f48
 80	membar	#Sync
 81	fxor	%f32, %f48, %f48
 82	fxor	%f34, %f50, %f50
 83	fxor	%f36, %f52, %f52
 84	fxor	%f38, %f54, %f54
 85	fxor	%f40, %f56, %f56
 86	fxor	%f42, %f58, %f58
 87	fxor	%f44, %f60, %f60
 88	fxor	%f46, %f62, %f62
 89	stda	%f48, [%o1 + 64] %asi
 90	membar	#Sync|#StoreStore|#StoreLoad
 91	wr	%g1, %g0, %asi
 92	retl
 93	  wr	%g0, 0, %fprs
 94	.size	xor_vis_2, .-xor_vis_2
 95
 96	.globl	xor_vis_3
 97	.type	xor_vis_3,#function
 98xor_vis_3:
 99	rd	%fprs, %o5
100	andcc	%o5, FPRS_FEF|FPRS_DU, %g0
101	be,pt	%icc, 0f
102	 sethi	%hi(VISenter), %g1
103	jmpl	%g1 + %lo(VISenter), %g7
104	 add	%g7, 8, %g7
1050:	wr	%g0, FPRS_FEF, %fprs
106	rd	%asi, %g1
107	wr	%g0, ASI_BLK_P, %asi
108	membar	#LoadStore|#StoreLoad|#StoreStore
109	sub	%o0, 64, %o0
110	ldda	[%o1] %asi, %f0
111	ldda	[%o2] %asi, %f16
112
1133:	ldda	[%o3] %asi, %f32
114	fxor	%f0, %f16, %f48
115	fxor	%f2, %f18, %f50
116	add	%o1, 64, %o1
117	fxor	%f4, %f20, %f52
118	fxor	%f6, %f22, %f54
119	add	%o2, 64, %o2
120	fxor	%f8, %f24, %f56
121	fxor	%f10, %f26, %f58
122	fxor	%f12, %f28, %f60
123	fxor	%f14, %f30, %f62
124	ldda	[%o1] %asi, %f0
125	fxor	%f48, %f32, %f48
126	fxor	%f50, %f34, %f50
127	fxor	%f52, %f36, %f52
128	fxor	%f54, %f38, %f54
129	add	%o3, 64, %o3
130	fxor	%f56, %f40, %f56
131	fxor	%f58, %f42, %f58
132	subcc	%o0, 64, %o0
133	fxor	%f60, %f44, %f60
134	fxor	%f62, %f46, %f62
135	stda	%f48, [%o1 - 64] %asi
136	bne,pt	%xcc, 3b
137	 ldda	[%o2] %asi, %f16
138
139	ldda	[%o3] %asi, %f32
140	fxor	%f0, %f16, %f48
141	fxor	%f2, %f18, %f50
142	fxor	%f4, %f20, %f52
143	fxor	%f6, %f22, %f54
144	fxor	%f8, %f24, %f56
145	fxor	%f10, %f26, %f58
146	fxor	%f12, %f28, %f60
147	fxor	%f14, %f30, %f62
148	membar	#Sync
149	fxor	%f48, %f32, %f48
150	fxor	%f50, %f34, %f50
151	fxor	%f52, %f36, %f52
152	fxor	%f54, %f38, %f54
153	fxor	%f56, %f40, %f56
154	fxor	%f58, %f42, %f58
155	fxor	%f60, %f44, %f60
156	fxor	%f62, %f46, %f62
157	stda	%f48, [%o1] %asi
158	membar	#Sync|#StoreStore|#StoreLoad
159	wr	%g1, %g0, %asi
160	retl
161	 wr	%g0, 0, %fprs
162	.size	xor_vis_3, .-xor_vis_3
163
164	.globl	xor_vis_4
165	.type	xor_vis_4,#function
166xor_vis_4:
167	rd	%fprs, %o5
168	andcc	%o5, FPRS_FEF|FPRS_DU, %g0
169	be,pt	%icc, 0f
170	 sethi	%hi(VISenter), %g1
171	jmpl	%g1 + %lo(VISenter), %g7
172	 add	%g7, 8, %g7
1730:	wr	%g0, FPRS_FEF, %fprs
174	rd	%asi, %g1
175	wr	%g0, ASI_BLK_P, %asi
176	membar	#LoadStore|#StoreLoad|#StoreStore
177	sub	%o0, 64, %o0
178	ldda	[%o1] %asi, %f0
179	ldda	[%o2] %asi, %f16
180
1814:	ldda	[%o3] %asi, %f32
182	fxor	%f0, %f16, %f16
183	fxor	%f2, %f18, %f18
184	add	%o1, 64, %o1
185	fxor	%f4, %f20, %f20
186	fxor	%f6, %f22, %f22
187	add	%o2, 64, %o2
188	fxor	%f8, %f24, %f24
189	fxor	%f10, %f26, %f26
190	fxor	%f12, %f28, %f28
191	fxor	%f14, %f30, %f30
192	ldda	[%o4] %asi, %f48
193	fxor	%f16, %f32, %f32
194	fxor	%f18, %f34, %f34
195	fxor	%f20, %f36, %f36
196	fxor	%f22, %f38, %f38
197	add	%o3, 64, %o3
198	fxor	%f24, %f40, %f40
199	fxor	%f26, %f42, %f42
200	fxor	%f28, %f44, %f44
201	fxor	%f30, %f46, %f46
202	ldda	[%o1] %asi, %f0
203	fxor	%f32, %f48, %f48
204	fxor	%f34, %f50, %f50
205	fxor	%f36, %f52, %f52
206	add	%o4, 64, %o4
207	fxor	%f38, %f54, %f54
208	fxor	%f40, %f56, %f56
209	fxor	%f42, %f58, %f58
210	subcc	%o0, 64, %o0
211	fxor	%f44, %f60, %f60
212	fxor	%f46, %f62, %f62
213	stda	%f48, [%o1 - 64] %asi
214	bne,pt	%xcc, 4b
215	 ldda	[%o2] %asi, %f16
216
217	ldda	[%o3] %asi, %f32
218	fxor	%f0, %f16, %f16
219	fxor	%f2, %f18, %f18
220	fxor	%f4, %f20, %f20
221	fxor	%f6, %f22, %f22
222	fxor	%f8, %f24, %f24
223	fxor	%f10, %f26, %f26
224	fxor	%f12, %f28, %f28
225	fxor	%f14, %f30, %f30
226	ldda	[%o4] %asi, %f48
227	fxor	%f16, %f32, %f32
228	fxor	%f18, %f34, %f34
229	fxor	%f20, %f36, %f36
230	fxor	%f22, %f38, %f38
231	fxor	%f24, %f40, %f40
232	fxor	%f26, %f42, %f42
233	fxor	%f28, %f44, %f44
234	fxor	%f30, %f46, %f46
235	membar	#Sync
236	fxor	%f32, %f48, %f48
237	fxor	%f34, %f50, %f50
238	fxor	%f36, %f52, %f52
239	fxor	%f38, %f54, %f54
240	fxor	%f40, %f56, %f56
241	fxor	%f42, %f58, %f58
242	fxor	%f44, %f60, %f60
243	fxor	%f46, %f62, %f62
244	stda	%f48, [%o1] %asi
245	membar	#Sync|#StoreStore|#StoreLoad
246	wr	%g1, %g0, %asi
247	retl
248	 wr	%g0, 0, %fprs
249	.size	xor_vis_4, .-xor_vis_4
250
251	.globl	xor_vis_5
252	.type	xor_vis_5,#function
253xor_vis_5:
254	save	%sp, -192, %sp
255	rd	%fprs, %o5
256	andcc	%o5, FPRS_FEF|FPRS_DU, %g0
257	be,pt	%icc, 0f
258	 sethi	%hi(VISenter), %g1
259	jmpl	%g1 + %lo(VISenter), %g7
260	 add	%g7, 8, %g7
2610:	wr	%g0, FPRS_FEF, %fprs
262	rd	%asi, %g1
263	wr	%g0, ASI_BLK_P, %asi
264	membar	#LoadStore|#StoreLoad|#StoreStore
265	sub	%i0, 64, %i0
266	ldda	[%i1] %asi, %f0
267	ldda	[%i2] %asi, %f16
268
2695:	ldda	[%i3] %asi, %f32
270	fxor	%f0, %f16, %f48
271	fxor	%f2, %f18, %f50
272	add	%i1, 64, %i1
273	fxor	%f4, %f20, %f52
274	fxor	%f6, %f22, %f54
275	add	%i2, 64, %i2
276	fxor	%f8, %f24, %f56
277	fxor	%f10, %f26, %f58
278	fxor	%f12, %f28, %f60
279	fxor	%f14, %f30, %f62
280	ldda	[%i4] %asi, %f16
281	fxor	%f48, %f32, %f48
282	fxor	%f50, %f34, %f50
283	fxor	%f52, %f36, %f52
284	fxor	%f54, %f38, %f54
285	add	%i3, 64, %i3
286	fxor	%f56, %f40, %f56
287	fxor	%f58, %f42, %f58
288	fxor	%f60, %f44, %f60
289	fxor	%f62, %f46, %f62
290	ldda	[%i5] %asi, %f32
291	fxor	%f48, %f16, %f48
292	fxor	%f50, %f18, %f50
293	add	%i4, 64, %i4
294	fxor	%f52, %f20, %f52
295	fxor	%f54, %f22, %f54
296	add	%i5, 64, %i5
297	fxor	%f56, %f24, %f56
298	fxor	%f58, %f26, %f58
299	fxor	%f60, %f28, %f60
300	fxor	%f62, %f30, %f62
301	ldda	[%i1] %asi, %f0
302	fxor	%f48, %f32, %f48
303	fxor	%f50, %f34, %f50
304	fxor	%f52, %f36, %f52
305	fxor	%f54, %f38, %f54
306	fxor	%f56, %f40, %f56
307	fxor	%f58, %f42, %f58
308	subcc	%i0, 64, %i0
309	fxor	%f60, %f44, %f60
310	fxor	%f62, %f46, %f62
311	stda	%f48, [%i1 - 64] %asi
312	bne,pt	%xcc, 5b
313	 ldda	[%i2] %asi, %f16
314
315	ldda	[%i3] %asi, %f32
316	fxor	%f0, %f16, %f48
317	fxor	%f2, %f18, %f50
318	fxor	%f4, %f20, %f52
319	fxor	%f6, %f22, %f54
320	fxor	%f8, %f24, %f56
321	fxor	%f10, %f26, %f58
322	fxor	%f12, %f28, %f60
323	fxor	%f14, %f30, %f62
324	ldda	[%i4] %asi, %f16
325	fxor	%f48, %f32, %f48
326	fxor	%f50, %f34, %f50
327	fxor	%f52, %f36, %f52
328	fxor	%f54, %f38, %f54
329	fxor	%f56, %f40, %f56
330	fxor	%f58, %f42, %f58
331	fxor	%f60, %f44, %f60
332	fxor	%f62, %f46, %f62
333	ldda	[%i5] %asi, %f32
334	fxor	%f48, %f16, %f48
335	fxor	%f50, %f18, %f50
336	fxor	%f52, %f20, %f52
337	fxor	%f54, %f22, %f54
338	fxor	%f56, %f24, %f56
339	fxor	%f58, %f26, %f58
340	fxor	%f60, %f28, %f60
341	fxor	%f62, %f30, %f62
342	membar	#Sync
343	fxor	%f48, %f32, %f48
344	fxor	%f50, %f34, %f50
345	fxor	%f52, %f36, %f52
346	fxor	%f54, %f38, %f54
347	fxor	%f56, %f40, %f56
348	fxor	%f58, %f42, %f58
349	fxor	%f60, %f44, %f60
350	fxor	%f62, %f46, %f62
351	stda	%f48, [%i1] %asi
352	membar	#Sync|#StoreStore|#StoreLoad
353	wr	%g1, %g0, %asi
354	wr	%g0, 0, %fprs
355	ret
356	 restore
357	.size	xor_vis_5, .-xor_vis_5
358
359	/* Niagara versions. */
360	.globl		xor_niagara_2
361	.type		xor_niagara_2,#function
362xor_niagara_2:		/* %o0=bytes, %o1=dest, %o2=src */
363	save		%sp, -192, %sp
364	prefetch	[%i1], #n_writes
365	prefetch	[%i2], #one_read
366	rd		%asi, %g7
367	wr		%g0, ASI_BLK_INIT_QUAD_LDD_P, %asi
368	srlx		%i0, 6, %g1
369	mov		%i1, %i0
370	mov		%i2, %i1
3711:	ldda		[%i1 + 0x00] %asi, %i2	/* %i2/%i3 = src  + 0x00 */
372	ldda		[%i1 + 0x10] %asi, %i4	/* %i4/%i5 = src  + 0x10 */
373	ldda		[%i1 + 0x20] %asi, %g2	/* %g2/%g3 = src  + 0x20 */
374	ldda		[%i1 + 0x30] %asi, %l0	/* %l0/%l1 = src  + 0x30 */
375	prefetch	[%i1 + 0x40], #one_read
376	ldda		[%i0 + 0x00] %asi, %o0  /* %o0/%o1 = dest + 0x00 */
377	ldda		[%i0 + 0x10] %asi, %o2  /* %o2/%o3 = dest + 0x10 */
378	ldda		[%i0 + 0x20] %asi, %o4  /* %o4/%o5 = dest + 0x20 */
379	ldda		[%i0 + 0x30] %asi, %l2  /* %l2/%l3 = dest + 0x30 */
380	prefetch	[%i0 + 0x40], #n_writes
381	xor		%o0, %i2, %o0
382	xor		%o1, %i3, %o1
383	stxa		%o0, [%i0 + 0x00] %asi
384	stxa		%o1, [%i0 + 0x08] %asi
385	xor		%o2, %i4, %o2
386	xor		%o3, %i5, %o3
387	stxa		%o2, [%i0 + 0x10] %asi
388	stxa		%o3, [%i0 + 0x18] %asi
389	xor		%o4, %g2, %o4
390	xor		%o5, %g3, %o5
391	stxa		%o4, [%i0 + 0x20] %asi
392	stxa		%o5, [%i0 + 0x28] %asi
393	xor		%l2, %l0, %l2
394	xor		%l3, %l1, %l3
395	stxa		%l2, [%i0 + 0x30] %asi
396	stxa		%l3, [%i0 + 0x38] %asi
397	add		%i0, 0x40, %i0
398	subcc		%g1, 1, %g1
399	bne,pt		%xcc, 1b
400	 add		%i1, 0x40, %i1
401	membar		#Sync
402	wr		%g7, 0x0, %asi
403	ret
404	 restore
405	.size		xor_niagara_2, .-xor_niagara_2
406
407	.globl		xor_niagara_3
408	.type		xor_niagara_3,#function
409xor_niagara_3:		/* %o0=bytes, %o1=dest, %o2=src1, %o3=src2 */
410	save		%sp, -192, %sp
411	prefetch	[%i1], #n_writes
412	prefetch	[%i2], #one_read
413	prefetch	[%i3], #one_read
414	rd		%asi, %g7
415	wr		%g0, ASI_BLK_INIT_QUAD_LDD_P, %asi
416	srlx		%i0, 6, %g1
417	mov		%i1, %i0
418	mov		%i2, %i1
419	mov		%i3, %l7
4201:	ldda		[%i1 + 0x00] %asi, %i2	/* %i2/%i3 = src1 + 0x00 */
421	ldda		[%i1 + 0x10] %asi, %i4	/* %i4/%i5 = src1 + 0x10 */
422	ldda		[%l7 + 0x00] %asi, %g2	/* %g2/%g3 = src2 + 0x00 */
423	ldda		[%l7 + 0x10] %asi, %l0	/* %l0/%l1 = src2 + 0x10 */
424	ldda		[%i0 + 0x00] %asi, %o0  /* %o0/%o1 = dest + 0x00 */
425	ldda		[%i0 + 0x10] %asi, %o2  /* %o2/%o3 = dest + 0x10 */
426	xor		%g2, %i2, %g2
427	xor		%g3, %i3, %g3
428	xor		%o0, %g2, %o0
429	xor		%o1, %g3, %o1
430	stxa		%o0, [%i0 + 0x00] %asi
431	stxa		%o1, [%i0 + 0x08] %asi
432	ldda		[%i1 + 0x20] %asi, %i2	/* %i2/%i3 = src1 + 0x20 */
433	ldda		[%l7 + 0x20] %asi, %g2	/* %g2/%g3 = src2 + 0x20 */
434	ldda		[%i0 + 0x20] %asi, %o0	/* %o0/%o1 = dest + 0x20 */
435	xor		%l0, %i4, %l0
436	xor		%l1, %i5, %l1
437	xor		%o2, %l0, %o2
438	xor		%o3, %l1, %o3
439	stxa		%o2, [%i0 + 0x10] %asi
440	stxa		%o3, [%i0 + 0x18] %asi
441	ldda		[%i1 + 0x30] %asi, %i4	/* %i4/%i5 = src1 + 0x30 */
442	ldda		[%l7 + 0x30] %asi, %l0	/* %l0/%l1 = src2 + 0x30 */
443	ldda		[%i0 + 0x30] %asi, %o2	/* %o2/%o3 = dest + 0x30 */
444	prefetch	[%i1 + 0x40], #one_read
445	prefetch	[%l7 + 0x40], #one_read
446	prefetch	[%i0 + 0x40], #n_writes
447	xor		%g2, %i2, %g2
448	xor		%g3, %i3, %g3
449	xor		%o0, %g2, %o0
450	xor		%o1, %g3, %o1
451	stxa		%o0, [%i0 + 0x20] %asi
452	stxa		%o1, [%i0 + 0x28] %asi
453	xor		%l0, %i4, %l0
454	xor		%l1, %i5, %l1
455	xor		%o2, %l0, %o2
456	xor		%o3, %l1, %o3
457	stxa		%o2, [%i0 + 0x30] %asi
458	stxa		%o3, [%i0 + 0x38] %asi
459	add		%i0, 0x40, %i0
460	add		%i1, 0x40, %i1
461	subcc		%g1, 1, %g1
462	bne,pt		%xcc, 1b
463	 add		%l7, 0x40, %l7
464	membar		#Sync
465	wr		%g7, 0x0, %asi
466	ret
467	 restore
468	.size		xor_niagara_3, .-xor_niagara_3
469
470	.globl		xor_niagara_4
471	.type		xor_niagara_4,#function
472xor_niagara_4:		/* %o0=bytes, %o1=dest, %o2=src1, %o3=src2, %o4=src3 */
473	save		%sp, -192, %sp
474	prefetch	[%i1], #n_writes
475	prefetch	[%i2], #one_read
476	prefetch	[%i3], #one_read
477	prefetch	[%i4], #one_read
478	rd		%asi, %g7
479	wr		%g0, ASI_BLK_INIT_QUAD_LDD_P, %asi
480	srlx		%i0, 6, %g1
481	mov		%i1, %i0
482	mov		%i2, %i1
483	mov		%i3, %l7
484	mov		%i4, %l6
4851:	ldda		[%i1 + 0x00] %asi, %i2	/* %i2/%i3 = src1 + 0x00 */
486	ldda		[%l7 + 0x00] %asi, %i4	/* %i4/%i5 = src2 + 0x00 */
487	ldda		[%l6 + 0x00] %asi, %g2	/* %g2/%g3 = src3 + 0x00 */
488	ldda		[%i0 + 0x00] %asi, %l0	/* %l0/%l1 = dest + 0x00 */
489	xor		%i4, %i2, %i4
490	xor		%i5, %i3, %i5
491	ldda		[%i1 + 0x10] %asi, %i2	/* %i2/%i3 = src1 + 0x10 */
492	xor		%g2, %i4, %g2
493	xor		%g3, %i5, %g3
494	ldda		[%l7 + 0x10] %asi, %i4	/* %i4/%i5 = src2 + 0x10 */
495	xor		%l0, %g2, %l0
496	xor		%l1, %g3, %l1
497	stxa		%l0, [%i0 + 0x00] %asi
498	stxa		%l1, [%i0 + 0x08] %asi
499	ldda		[%l6 + 0x10] %asi, %g2	/* %g2/%g3 = src3 + 0x10 */
500	ldda		[%i0 + 0x10] %asi, %l0	/* %l0/%l1 = dest + 0x10 */
501
502	xor		%i4, %i2, %i4
503	xor		%i5, %i3, %i5
504	ldda		[%i1 + 0x20] %asi, %i2	/* %i2/%i3 = src1 + 0x20 */
505	xor		%g2, %i4, %g2
506	xor		%g3, %i5, %g3
507	ldda		[%l7 + 0x20] %asi, %i4	/* %i4/%i5 = src2 + 0x20 */
508	xor		%l0, %g2, %l0
509	xor		%l1, %g3, %l1
510	stxa		%l0, [%i0 + 0x10] %asi
511	stxa		%l1, [%i0 + 0x18] %asi
512	ldda		[%l6 + 0x20] %asi, %g2	/* %g2/%g3 = src3 + 0x20 */
513	ldda		[%i0 + 0x20] %asi, %l0	/* %l0/%l1 = dest + 0x20 */
514
515	xor		%i4, %i2, %i4
516	xor		%i5, %i3, %i5
517	ldda		[%i1 + 0x30] %asi, %i2	/* %i2/%i3 = src1 + 0x30 */
518	xor		%g2, %i4, %g2
519	xor		%g3, %i5, %g3
520	ldda		[%l7 + 0x30] %asi, %i4	/* %i4/%i5 = src2 + 0x30 */
521	xor		%l0, %g2, %l0
522	xor		%l1, %g3, %l1
523	stxa		%l0, [%i0 + 0x20] %asi
524	stxa		%l1, [%i0 + 0x28] %asi
525	ldda		[%l6 + 0x30] %asi, %g2	/* %g2/%g3 = src3 + 0x30 */
526	ldda		[%i0 + 0x30] %asi, %l0	/* %l0/%l1 = dest + 0x30 */
527
528	prefetch	[%i1 + 0x40], #one_read
529	prefetch	[%l7 + 0x40], #one_read
530	prefetch	[%l6 + 0x40], #one_read
531	prefetch	[%i0 + 0x40], #n_writes
532
533	xor		%i4, %i2, %i4
534	xor		%i5, %i3, %i5
535	xor		%g2, %i4, %g2
536	xor		%g3, %i5, %g3
537	xor		%l0, %g2, %l0
538	xor		%l1, %g3, %l1
539	stxa		%l0, [%i0 + 0x30] %asi
540	stxa		%l1, [%i0 + 0x38] %asi
541
542	add		%i0, 0x40, %i0
543	add		%i1, 0x40, %i1
544	add		%l7, 0x40, %l7
545	subcc		%g1, 1, %g1
546	bne,pt		%xcc, 1b
547	 add		%l6, 0x40, %l6
548	membar		#Sync
549	wr		%g7, 0x0, %asi
550	ret
551	 restore
552	.size		xor_niagara_4, .-xor_niagara_4
553
554	.globl		xor_niagara_5
555	.type		xor_niagara_5,#function
556xor_niagara_5:		/* %o0=bytes, %o1=dest, %o2=src1, %o3=src2, %o4=src3, %o5=src4 */
557	save		%sp, -192, %sp
558	prefetch	[%i1], #n_writes
559	prefetch	[%i2], #one_read
560	prefetch	[%i3], #one_read
561	prefetch	[%i4], #one_read
562	prefetch	[%i5], #one_read
563	rd		%asi, %g7
564	wr		%g0, ASI_BLK_INIT_QUAD_LDD_P, %asi
565	srlx		%i0, 6, %g1
566	mov		%i1, %i0
567	mov		%i2, %i1
568	mov		%i3, %l7
569	mov		%i4, %l6
570	mov		%i5, %l5
5711:	ldda		[%i1 + 0x00] %asi, %i2	/* %i2/%i3 = src1 + 0x00 */
572	ldda		[%l7 + 0x00] %asi, %i4	/* %i4/%i5 = src2 + 0x00 */
573	ldda		[%l6 + 0x00] %asi, %g2	/* %g2/%g3 = src3 + 0x00 */
574	ldda		[%l5 + 0x00] %asi, %l0	/* %l0/%l1 = src4 + 0x00 */
575	ldda		[%i0 + 0x00] %asi, %l2	/* %l2/%l3 = dest + 0x00 */
576	xor		%i4, %i2, %i4
577	xor		%i5, %i3, %i5
578	ldda		[%i1 + 0x10] %asi, %i2	/* %i2/%i3 = src1 + 0x10 */
579	xor		%g2, %i4, %g2
580	xor		%g3, %i5, %g3
581	ldda		[%l7 + 0x10] %asi, %i4	/* %i4/%i5 = src2 + 0x10 */
582	xor		%l0, %g2, %l0
583	xor		%l1, %g3, %l1
584	ldda		[%l6 + 0x10] %asi, %g2	/* %g2/%g3 = src3 + 0x10 */
585	xor		%l2, %l0, %l2
586	xor		%l3, %l1, %l3
587	stxa		%l2, [%i0 + 0x00] %asi
588	stxa		%l3, [%i0 + 0x08] %asi
589	ldda		[%l5 + 0x10] %asi, %l0	/* %l0/%l1 = src4 + 0x10 */
590	ldda		[%i0 + 0x10] %asi, %l2	/* %l2/%l3 = dest + 0x10 */
591
592	xor		%i4, %i2, %i4
593	xor		%i5, %i3, %i5
594	ldda		[%i1 + 0x20] %asi, %i2	/* %i2/%i3 = src1 + 0x20 */
595	xor		%g2, %i4, %g2
596	xor		%g3, %i5, %g3
597	ldda		[%l7 + 0x20] %asi, %i4	/* %i4/%i5 = src2 + 0x20 */
598	xor		%l0, %g2, %l0
599	xor		%l1, %g3, %l1
600	ldda		[%l6 + 0x20] %asi, %g2	/* %g2/%g3 = src3 + 0x20 */
601	xor		%l2, %l0, %l2
602	xor		%l3, %l1, %l3
603	stxa		%l2, [%i0 + 0x10] %asi
604	stxa		%l3, [%i0 + 0x18] %asi
605	ldda		[%l5 + 0x20] %asi, %l0	/* %l0/%l1 = src4 + 0x20 */
606	ldda		[%i0 + 0x20] %asi, %l2	/* %l2/%l3 = dest + 0x20 */
607
608	xor		%i4, %i2, %i4
609	xor		%i5, %i3, %i5
610	ldda		[%i1 + 0x30] %asi, %i2	/* %i2/%i3 = src1 + 0x30 */
611	xor		%g2, %i4, %g2
612	xor		%g3, %i5, %g3
613	ldda		[%l7 + 0x30] %asi, %i4	/* %i4/%i5 = src2 + 0x30 */
614	xor		%l0, %g2, %l0
615	xor		%l1, %g3, %l1
616	ldda		[%l6 + 0x30] %asi, %g2	/* %g2/%g3 = src3 + 0x30 */
617	xor		%l2, %l0, %l2
618	xor		%l3, %l1, %l3
619	stxa		%l2, [%i0 + 0x20] %asi
620	stxa		%l3, [%i0 + 0x28] %asi
621	ldda		[%l5 + 0x30] %asi, %l0	/* %l0/%l1 = src4 + 0x30 */
622	ldda		[%i0 + 0x30] %asi, %l2	/* %l2/%l3 = dest + 0x30 */
623
624	prefetch	[%i1 + 0x40], #one_read
625	prefetch	[%l7 + 0x40], #one_read
626	prefetch	[%l6 + 0x40], #one_read
627	prefetch	[%l5 + 0x40], #one_read
628	prefetch	[%i0 + 0x40], #n_writes
629
630	xor		%i4, %i2, %i4
631	xor		%i5, %i3, %i5
632	xor		%g2, %i4, %g2
633	xor		%g3, %i5, %g3
634	xor		%l0, %g2, %l0
635	xor		%l1, %g3, %l1
636	xor		%l2, %l0, %l2
637	xor		%l3, %l1, %l3
638	stxa		%l2, [%i0 + 0x30] %asi
639	stxa		%l3, [%i0 + 0x38] %asi
640
641	add		%i0, 0x40, %i0
642	add		%i1, 0x40, %i1
643	add		%l7, 0x40, %l7
644	add		%l6, 0x40, %l6
645	subcc		%g1, 1, %g1
646	bne,pt		%xcc, 1b
647	 add		%l5, 0x40, %l5
648	membar		#Sync
649	wr		%g7, 0x0, %asi
650	ret
651	 restore
652	.size		xor_niagara_5, .-xor_niagara_5
v3.15
  1/*
  2 * arch/sparc64/lib/xor.S
  3 *
  4 * High speed xor_block operation for RAID4/5 utilizing the
  5 * UltraSparc Visual Instruction Set and Niagara store-init/twin-load.
  6 *
  7 * Copyright (C) 1997, 1999 Jakub Jelinek (jj@ultra.linux.cz)
  8 * Copyright (C) 2006 David S. Miller <davem@davemloft.net>
  9 */
 10
 11#include <linux/linkage.h>
 12#include <asm/visasm.h>
 13#include <asm/asi.h>
 14#include <asm/dcu.h>
 15#include <asm/spitfire.h>
 16
 17/*
 18 *	Requirements:
 19 *	!(((long)dest | (long)sourceN) & (64 - 1)) &&
 20 *	!(len & 127) && len >= 256
 21 */
 22	.text
 
 23
 24	/* VIS versions. */
 25ENTRY(xor_vis_2)
 
 
 26	rd	%fprs, %o5
 27	andcc	%o5, FPRS_FEF|FPRS_DU, %g0
 28	be,pt	%icc, 0f
 29	 sethi	%hi(VISenter), %g1
 30	jmpl	%g1 + %lo(VISenter), %g7
 31	 add	%g7, 8, %g7
 320:	wr	%g0, FPRS_FEF, %fprs
 33	rd	%asi, %g1
 34	wr	%g0, ASI_BLK_P, %asi
 35	membar	#LoadStore|#StoreLoad|#StoreStore
 36	sub	%o0, 128, %o0
 37	ldda	[%o1] %asi, %f0
 38	ldda	[%o2] %asi, %f16
 39
 402:	ldda	[%o1 + 64] %asi, %f32
 41	fxor	%f0, %f16, %f16
 42	fxor	%f2, %f18, %f18
 43	fxor	%f4, %f20, %f20
 44	fxor	%f6, %f22, %f22
 45	fxor	%f8, %f24, %f24
 46	fxor	%f10, %f26, %f26
 47	fxor	%f12, %f28, %f28
 48	fxor	%f14, %f30, %f30
 49	stda	%f16, [%o1] %asi
 50	ldda	[%o2 + 64] %asi, %f48
 51	ldda	[%o1 + 128] %asi, %f0
 52	fxor	%f32, %f48, %f48
 53	fxor	%f34, %f50, %f50
 54	add	%o1, 128, %o1
 55	fxor	%f36, %f52, %f52
 56	add	%o2, 128, %o2
 57	fxor	%f38, %f54, %f54
 58	subcc	%o0, 128, %o0
 59	fxor	%f40, %f56, %f56
 60	fxor	%f42, %f58, %f58
 61	fxor	%f44, %f60, %f60
 62	fxor	%f46, %f62, %f62
 63	stda	%f48, [%o1 - 64] %asi
 64	bne,pt	%xcc, 2b
 65	 ldda	[%o2] %asi, %f16
 66
 67	ldda	[%o1 + 64] %asi, %f32
 68	fxor	%f0, %f16, %f16
 69	fxor	%f2, %f18, %f18
 70	fxor	%f4, %f20, %f20
 71	fxor	%f6, %f22, %f22
 72	fxor	%f8, %f24, %f24
 73	fxor	%f10, %f26, %f26
 74	fxor	%f12, %f28, %f28
 75	fxor	%f14, %f30, %f30
 76	stda	%f16, [%o1] %asi
 77	ldda	[%o2 + 64] %asi, %f48
 78	membar	#Sync
 79	fxor	%f32, %f48, %f48
 80	fxor	%f34, %f50, %f50
 81	fxor	%f36, %f52, %f52
 82	fxor	%f38, %f54, %f54
 83	fxor	%f40, %f56, %f56
 84	fxor	%f42, %f58, %f58
 85	fxor	%f44, %f60, %f60
 86	fxor	%f46, %f62, %f62
 87	stda	%f48, [%o1 + 64] %asi
 88	membar	#Sync|#StoreStore|#StoreLoad
 89	wr	%g1, %g0, %asi
 90	retl
 91	  wr	%g0, 0, %fprs
 92ENDPROC(xor_vis_2)
 93
 94ENTRY(xor_vis_3)
 
 
 95	rd	%fprs, %o5
 96	andcc	%o5, FPRS_FEF|FPRS_DU, %g0
 97	be,pt	%icc, 0f
 98	 sethi	%hi(VISenter), %g1
 99	jmpl	%g1 + %lo(VISenter), %g7
100	 add	%g7, 8, %g7
1010:	wr	%g0, FPRS_FEF, %fprs
102	rd	%asi, %g1
103	wr	%g0, ASI_BLK_P, %asi
104	membar	#LoadStore|#StoreLoad|#StoreStore
105	sub	%o0, 64, %o0
106	ldda	[%o1] %asi, %f0
107	ldda	[%o2] %asi, %f16
108
1093:	ldda	[%o3] %asi, %f32
110	fxor	%f0, %f16, %f48
111	fxor	%f2, %f18, %f50
112	add	%o1, 64, %o1
113	fxor	%f4, %f20, %f52
114	fxor	%f6, %f22, %f54
115	add	%o2, 64, %o2
116	fxor	%f8, %f24, %f56
117	fxor	%f10, %f26, %f58
118	fxor	%f12, %f28, %f60
119	fxor	%f14, %f30, %f62
120	ldda	[%o1] %asi, %f0
121	fxor	%f48, %f32, %f48
122	fxor	%f50, %f34, %f50
123	fxor	%f52, %f36, %f52
124	fxor	%f54, %f38, %f54
125	add	%o3, 64, %o3
126	fxor	%f56, %f40, %f56
127	fxor	%f58, %f42, %f58
128	subcc	%o0, 64, %o0
129	fxor	%f60, %f44, %f60
130	fxor	%f62, %f46, %f62
131	stda	%f48, [%o1 - 64] %asi
132	bne,pt	%xcc, 3b
133	 ldda	[%o2] %asi, %f16
134
135	ldda	[%o3] %asi, %f32
136	fxor	%f0, %f16, %f48
137	fxor	%f2, %f18, %f50
138	fxor	%f4, %f20, %f52
139	fxor	%f6, %f22, %f54
140	fxor	%f8, %f24, %f56
141	fxor	%f10, %f26, %f58
142	fxor	%f12, %f28, %f60
143	fxor	%f14, %f30, %f62
144	membar	#Sync
145	fxor	%f48, %f32, %f48
146	fxor	%f50, %f34, %f50
147	fxor	%f52, %f36, %f52
148	fxor	%f54, %f38, %f54
149	fxor	%f56, %f40, %f56
150	fxor	%f58, %f42, %f58
151	fxor	%f60, %f44, %f60
152	fxor	%f62, %f46, %f62
153	stda	%f48, [%o1] %asi
154	membar	#Sync|#StoreStore|#StoreLoad
155	wr	%g1, %g0, %asi
156	retl
157	 wr	%g0, 0, %fprs
158ENDPROC(xor_vis_3)
159
160ENTRY(xor_vis_4)
 
 
161	rd	%fprs, %o5
162	andcc	%o5, FPRS_FEF|FPRS_DU, %g0
163	be,pt	%icc, 0f
164	 sethi	%hi(VISenter), %g1
165	jmpl	%g1 + %lo(VISenter), %g7
166	 add	%g7, 8, %g7
1670:	wr	%g0, FPRS_FEF, %fprs
168	rd	%asi, %g1
169	wr	%g0, ASI_BLK_P, %asi
170	membar	#LoadStore|#StoreLoad|#StoreStore
171	sub	%o0, 64, %o0
172	ldda	[%o1] %asi, %f0
173	ldda	[%o2] %asi, %f16
174
1754:	ldda	[%o3] %asi, %f32
176	fxor	%f0, %f16, %f16
177	fxor	%f2, %f18, %f18
178	add	%o1, 64, %o1
179	fxor	%f4, %f20, %f20
180	fxor	%f6, %f22, %f22
181	add	%o2, 64, %o2
182	fxor	%f8, %f24, %f24
183	fxor	%f10, %f26, %f26
184	fxor	%f12, %f28, %f28
185	fxor	%f14, %f30, %f30
186	ldda	[%o4] %asi, %f48
187	fxor	%f16, %f32, %f32
188	fxor	%f18, %f34, %f34
189	fxor	%f20, %f36, %f36
190	fxor	%f22, %f38, %f38
191	add	%o3, 64, %o3
192	fxor	%f24, %f40, %f40
193	fxor	%f26, %f42, %f42
194	fxor	%f28, %f44, %f44
195	fxor	%f30, %f46, %f46
196	ldda	[%o1] %asi, %f0
197	fxor	%f32, %f48, %f48
198	fxor	%f34, %f50, %f50
199	fxor	%f36, %f52, %f52
200	add	%o4, 64, %o4
201	fxor	%f38, %f54, %f54
202	fxor	%f40, %f56, %f56
203	fxor	%f42, %f58, %f58
204	subcc	%o0, 64, %o0
205	fxor	%f44, %f60, %f60
206	fxor	%f46, %f62, %f62
207	stda	%f48, [%o1 - 64] %asi
208	bne,pt	%xcc, 4b
209	 ldda	[%o2] %asi, %f16
210
211	ldda	[%o3] %asi, %f32
212	fxor	%f0, %f16, %f16
213	fxor	%f2, %f18, %f18
214	fxor	%f4, %f20, %f20
215	fxor	%f6, %f22, %f22
216	fxor	%f8, %f24, %f24
217	fxor	%f10, %f26, %f26
218	fxor	%f12, %f28, %f28
219	fxor	%f14, %f30, %f30
220	ldda	[%o4] %asi, %f48
221	fxor	%f16, %f32, %f32
222	fxor	%f18, %f34, %f34
223	fxor	%f20, %f36, %f36
224	fxor	%f22, %f38, %f38
225	fxor	%f24, %f40, %f40
226	fxor	%f26, %f42, %f42
227	fxor	%f28, %f44, %f44
228	fxor	%f30, %f46, %f46
229	membar	#Sync
230	fxor	%f32, %f48, %f48
231	fxor	%f34, %f50, %f50
232	fxor	%f36, %f52, %f52
233	fxor	%f38, %f54, %f54
234	fxor	%f40, %f56, %f56
235	fxor	%f42, %f58, %f58
236	fxor	%f44, %f60, %f60
237	fxor	%f46, %f62, %f62
238	stda	%f48, [%o1] %asi
239	membar	#Sync|#StoreStore|#StoreLoad
240	wr	%g1, %g0, %asi
241	retl
242	 wr	%g0, 0, %fprs
243ENDPROC(xor_vis_4)
244
245ENTRY(xor_vis_5)
 
 
246	save	%sp, -192, %sp
247	rd	%fprs, %o5
248	andcc	%o5, FPRS_FEF|FPRS_DU, %g0
249	be,pt	%icc, 0f
250	 sethi	%hi(VISenter), %g1
251	jmpl	%g1 + %lo(VISenter), %g7
252	 add	%g7, 8, %g7
2530:	wr	%g0, FPRS_FEF, %fprs
254	rd	%asi, %g1
255	wr	%g0, ASI_BLK_P, %asi
256	membar	#LoadStore|#StoreLoad|#StoreStore
257	sub	%i0, 64, %i0
258	ldda	[%i1] %asi, %f0
259	ldda	[%i2] %asi, %f16
260
2615:	ldda	[%i3] %asi, %f32
262	fxor	%f0, %f16, %f48
263	fxor	%f2, %f18, %f50
264	add	%i1, 64, %i1
265	fxor	%f4, %f20, %f52
266	fxor	%f6, %f22, %f54
267	add	%i2, 64, %i2
268	fxor	%f8, %f24, %f56
269	fxor	%f10, %f26, %f58
270	fxor	%f12, %f28, %f60
271	fxor	%f14, %f30, %f62
272	ldda	[%i4] %asi, %f16
273	fxor	%f48, %f32, %f48
274	fxor	%f50, %f34, %f50
275	fxor	%f52, %f36, %f52
276	fxor	%f54, %f38, %f54
277	add	%i3, 64, %i3
278	fxor	%f56, %f40, %f56
279	fxor	%f58, %f42, %f58
280	fxor	%f60, %f44, %f60
281	fxor	%f62, %f46, %f62
282	ldda	[%i5] %asi, %f32
283	fxor	%f48, %f16, %f48
284	fxor	%f50, %f18, %f50
285	add	%i4, 64, %i4
286	fxor	%f52, %f20, %f52
287	fxor	%f54, %f22, %f54
288	add	%i5, 64, %i5
289	fxor	%f56, %f24, %f56
290	fxor	%f58, %f26, %f58
291	fxor	%f60, %f28, %f60
292	fxor	%f62, %f30, %f62
293	ldda	[%i1] %asi, %f0
294	fxor	%f48, %f32, %f48
295	fxor	%f50, %f34, %f50
296	fxor	%f52, %f36, %f52
297	fxor	%f54, %f38, %f54
298	fxor	%f56, %f40, %f56
299	fxor	%f58, %f42, %f58
300	subcc	%i0, 64, %i0
301	fxor	%f60, %f44, %f60
302	fxor	%f62, %f46, %f62
303	stda	%f48, [%i1 - 64] %asi
304	bne,pt	%xcc, 5b
305	 ldda	[%i2] %asi, %f16
306
307	ldda	[%i3] %asi, %f32
308	fxor	%f0, %f16, %f48
309	fxor	%f2, %f18, %f50
310	fxor	%f4, %f20, %f52
311	fxor	%f6, %f22, %f54
312	fxor	%f8, %f24, %f56
313	fxor	%f10, %f26, %f58
314	fxor	%f12, %f28, %f60
315	fxor	%f14, %f30, %f62
316	ldda	[%i4] %asi, %f16
317	fxor	%f48, %f32, %f48
318	fxor	%f50, %f34, %f50
319	fxor	%f52, %f36, %f52
320	fxor	%f54, %f38, %f54
321	fxor	%f56, %f40, %f56
322	fxor	%f58, %f42, %f58
323	fxor	%f60, %f44, %f60
324	fxor	%f62, %f46, %f62
325	ldda	[%i5] %asi, %f32
326	fxor	%f48, %f16, %f48
327	fxor	%f50, %f18, %f50
328	fxor	%f52, %f20, %f52
329	fxor	%f54, %f22, %f54
330	fxor	%f56, %f24, %f56
331	fxor	%f58, %f26, %f58
332	fxor	%f60, %f28, %f60
333	fxor	%f62, %f30, %f62
334	membar	#Sync
335	fxor	%f48, %f32, %f48
336	fxor	%f50, %f34, %f50
337	fxor	%f52, %f36, %f52
338	fxor	%f54, %f38, %f54
339	fxor	%f56, %f40, %f56
340	fxor	%f58, %f42, %f58
341	fxor	%f60, %f44, %f60
342	fxor	%f62, %f46, %f62
343	stda	%f48, [%i1] %asi
344	membar	#Sync|#StoreStore|#StoreLoad
345	wr	%g1, %g0, %asi
346	wr	%g0, 0, %fprs
347	ret
348	 restore
349ENDPROC(xor_vis_5)
350
351	/* Niagara versions. */
352ENTRY(xor_niagara_2) /* %o0=bytes, %o1=dest, %o2=src */
 
 
353	save		%sp, -192, %sp
354	prefetch	[%i1], #n_writes
355	prefetch	[%i2], #one_read
356	rd		%asi, %g7
357	wr		%g0, ASI_BLK_INIT_QUAD_LDD_P, %asi
358	srlx		%i0, 6, %g1
359	mov		%i1, %i0
360	mov		%i2, %i1
3611:	ldda		[%i1 + 0x00] %asi, %i2	/* %i2/%i3 = src  + 0x00 */
362	ldda		[%i1 + 0x10] %asi, %i4	/* %i4/%i5 = src  + 0x10 */
363	ldda		[%i1 + 0x20] %asi, %g2	/* %g2/%g3 = src  + 0x20 */
364	ldda		[%i1 + 0x30] %asi, %l0	/* %l0/%l1 = src  + 0x30 */
365	prefetch	[%i1 + 0x40], #one_read
366	ldda		[%i0 + 0x00] %asi, %o0  /* %o0/%o1 = dest + 0x00 */
367	ldda		[%i0 + 0x10] %asi, %o2  /* %o2/%o3 = dest + 0x10 */
368	ldda		[%i0 + 0x20] %asi, %o4  /* %o4/%o5 = dest + 0x20 */
369	ldda		[%i0 + 0x30] %asi, %l2  /* %l2/%l3 = dest + 0x30 */
370	prefetch	[%i0 + 0x40], #n_writes
371	xor		%o0, %i2, %o0
372	xor		%o1, %i3, %o1
373	stxa		%o0, [%i0 + 0x00] %asi
374	stxa		%o1, [%i0 + 0x08] %asi
375	xor		%o2, %i4, %o2
376	xor		%o3, %i5, %o3
377	stxa		%o2, [%i0 + 0x10] %asi
378	stxa		%o3, [%i0 + 0x18] %asi
379	xor		%o4, %g2, %o4
380	xor		%o5, %g3, %o5
381	stxa		%o4, [%i0 + 0x20] %asi
382	stxa		%o5, [%i0 + 0x28] %asi
383	xor		%l2, %l0, %l2
384	xor		%l3, %l1, %l3
385	stxa		%l2, [%i0 + 0x30] %asi
386	stxa		%l3, [%i0 + 0x38] %asi
387	add		%i0, 0x40, %i0
388	subcc		%g1, 1, %g1
389	bne,pt		%xcc, 1b
390	 add		%i1, 0x40, %i1
391	membar		#Sync
392	wr		%g7, 0x0, %asi
393	ret
394	 restore
395ENDPROC(xor_niagara_2)
396
397ENTRY(xor_niagara_3) /* %o0=bytes, %o1=dest, %o2=src1, %o3=src2 */
 
 
398	save		%sp, -192, %sp
399	prefetch	[%i1], #n_writes
400	prefetch	[%i2], #one_read
401	prefetch	[%i3], #one_read
402	rd		%asi, %g7
403	wr		%g0, ASI_BLK_INIT_QUAD_LDD_P, %asi
404	srlx		%i0, 6, %g1
405	mov		%i1, %i0
406	mov		%i2, %i1
407	mov		%i3, %l7
4081:	ldda		[%i1 + 0x00] %asi, %i2	/* %i2/%i3 = src1 + 0x00 */
409	ldda		[%i1 + 0x10] %asi, %i4	/* %i4/%i5 = src1 + 0x10 */
410	ldda		[%l7 + 0x00] %asi, %g2	/* %g2/%g3 = src2 + 0x00 */
411	ldda		[%l7 + 0x10] %asi, %l0	/* %l0/%l1 = src2 + 0x10 */
412	ldda		[%i0 + 0x00] %asi, %o0  /* %o0/%o1 = dest + 0x00 */
413	ldda		[%i0 + 0x10] %asi, %o2  /* %o2/%o3 = dest + 0x10 */
414	xor		%g2, %i2, %g2
415	xor		%g3, %i3, %g3
416	xor		%o0, %g2, %o0
417	xor		%o1, %g3, %o1
418	stxa		%o0, [%i0 + 0x00] %asi
419	stxa		%o1, [%i0 + 0x08] %asi
420	ldda		[%i1 + 0x20] %asi, %i2	/* %i2/%i3 = src1 + 0x20 */
421	ldda		[%l7 + 0x20] %asi, %g2	/* %g2/%g3 = src2 + 0x20 */
422	ldda		[%i0 + 0x20] %asi, %o0	/* %o0/%o1 = dest + 0x20 */
423	xor		%l0, %i4, %l0
424	xor		%l1, %i5, %l1
425	xor		%o2, %l0, %o2
426	xor		%o3, %l1, %o3
427	stxa		%o2, [%i0 + 0x10] %asi
428	stxa		%o3, [%i0 + 0x18] %asi
429	ldda		[%i1 + 0x30] %asi, %i4	/* %i4/%i5 = src1 + 0x30 */
430	ldda		[%l7 + 0x30] %asi, %l0	/* %l0/%l1 = src2 + 0x30 */
431	ldda		[%i0 + 0x30] %asi, %o2	/* %o2/%o3 = dest + 0x30 */
432	prefetch	[%i1 + 0x40], #one_read
433	prefetch	[%l7 + 0x40], #one_read
434	prefetch	[%i0 + 0x40], #n_writes
435	xor		%g2, %i2, %g2
436	xor		%g3, %i3, %g3
437	xor		%o0, %g2, %o0
438	xor		%o1, %g3, %o1
439	stxa		%o0, [%i0 + 0x20] %asi
440	stxa		%o1, [%i0 + 0x28] %asi
441	xor		%l0, %i4, %l0
442	xor		%l1, %i5, %l1
443	xor		%o2, %l0, %o2
444	xor		%o3, %l1, %o3
445	stxa		%o2, [%i0 + 0x30] %asi
446	stxa		%o3, [%i0 + 0x38] %asi
447	add		%i0, 0x40, %i0
448	add		%i1, 0x40, %i1
449	subcc		%g1, 1, %g1
450	bne,pt		%xcc, 1b
451	 add		%l7, 0x40, %l7
452	membar		#Sync
453	wr		%g7, 0x0, %asi
454	ret
455	 restore
456ENDPROC(xor_niagara_3)
457
458ENTRY(xor_niagara_4) /* %o0=bytes, %o1=dest, %o2=src1, %o3=src2, %o4=src3 */
 
 
459	save		%sp, -192, %sp
460	prefetch	[%i1], #n_writes
461	prefetch	[%i2], #one_read
462	prefetch	[%i3], #one_read
463	prefetch	[%i4], #one_read
464	rd		%asi, %g7
465	wr		%g0, ASI_BLK_INIT_QUAD_LDD_P, %asi
466	srlx		%i0, 6, %g1
467	mov		%i1, %i0
468	mov		%i2, %i1
469	mov		%i3, %l7
470	mov		%i4, %l6
4711:	ldda		[%i1 + 0x00] %asi, %i2	/* %i2/%i3 = src1 + 0x00 */
472	ldda		[%l7 + 0x00] %asi, %i4	/* %i4/%i5 = src2 + 0x00 */
473	ldda		[%l6 + 0x00] %asi, %g2	/* %g2/%g3 = src3 + 0x00 */
474	ldda		[%i0 + 0x00] %asi, %l0	/* %l0/%l1 = dest + 0x00 */
475	xor		%i4, %i2, %i4
476	xor		%i5, %i3, %i5
477	ldda		[%i1 + 0x10] %asi, %i2	/* %i2/%i3 = src1 + 0x10 */
478	xor		%g2, %i4, %g2
479	xor		%g3, %i5, %g3
480	ldda		[%l7 + 0x10] %asi, %i4	/* %i4/%i5 = src2 + 0x10 */
481	xor		%l0, %g2, %l0
482	xor		%l1, %g3, %l1
483	stxa		%l0, [%i0 + 0x00] %asi
484	stxa		%l1, [%i0 + 0x08] %asi
485	ldda		[%l6 + 0x10] %asi, %g2	/* %g2/%g3 = src3 + 0x10 */
486	ldda		[%i0 + 0x10] %asi, %l0	/* %l0/%l1 = dest + 0x10 */
487
488	xor		%i4, %i2, %i4
489	xor		%i5, %i3, %i5
490	ldda		[%i1 + 0x20] %asi, %i2	/* %i2/%i3 = src1 + 0x20 */
491	xor		%g2, %i4, %g2
492	xor		%g3, %i5, %g3
493	ldda		[%l7 + 0x20] %asi, %i4	/* %i4/%i5 = src2 + 0x20 */
494	xor		%l0, %g2, %l0
495	xor		%l1, %g3, %l1
496	stxa		%l0, [%i0 + 0x10] %asi
497	stxa		%l1, [%i0 + 0x18] %asi
498	ldda		[%l6 + 0x20] %asi, %g2	/* %g2/%g3 = src3 + 0x20 */
499	ldda		[%i0 + 0x20] %asi, %l0	/* %l0/%l1 = dest + 0x20 */
500
501	xor		%i4, %i2, %i4
502	xor		%i5, %i3, %i5
503	ldda		[%i1 + 0x30] %asi, %i2	/* %i2/%i3 = src1 + 0x30 */
504	xor		%g2, %i4, %g2
505	xor		%g3, %i5, %g3
506	ldda		[%l7 + 0x30] %asi, %i4	/* %i4/%i5 = src2 + 0x30 */
507	xor		%l0, %g2, %l0
508	xor		%l1, %g3, %l1
509	stxa		%l0, [%i0 + 0x20] %asi
510	stxa		%l1, [%i0 + 0x28] %asi
511	ldda		[%l6 + 0x30] %asi, %g2	/* %g2/%g3 = src3 + 0x30 */
512	ldda		[%i0 + 0x30] %asi, %l0	/* %l0/%l1 = dest + 0x30 */
513
514	prefetch	[%i1 + 0x40], #one_read
515	prefetch	[%l7 + 0x40], #one_read
516	prefetch	[%l6 + 0x40], #one_read
517	prefetch	[%i0 + 0x40], #n_writes
518
519	xor		%i4, %i2, %i4
520	xor		%i5, %i3, %i5
521	xor		%g2, %i4, %g2
522	xor		%g3, %i5, %g3
523	xor		%l0, %g2, %l0
524	xor		%l1, %g3, %l1
525	stxa		%l0, [%i0 + 0x30] %asi
526	stxa		%l1, [%i0 + 0x38] %asi
527
528	add		%i0, 0x40, %i0
529	add		%i1, 0x40, %i1
530	add		%l7, 0x40, %l7
531	subcc		%g1, 1, %g1
532	bne,pt		%xcc, 1b
533	 add		%l6, 0x40, %l6
534	membar		#Sync
535	wr		%g7, 0x0, %asi
536	ret
537	 restore
538ENDPROC(xor_niagara_4)
539
540ENTRY(xor_niagara_5) /* %o0=bytes, %o1=dest, %o2=src1, %o3=src2, %o4=src3, %o5=src4 */
 
 
541	save		%sp, -192, %sp
542	prefetch	[%i1], #n_writes
543	prefetch	[%i2], #one_read
544	prefetch	[%i3], #one_read
545	prefetch	[%i4], #one_read
546	prefetch	[%i5], #one_read
547	rd		%asi, %g7
548	wr		%g0, ASI_BLK_INIT_QUAD_LDD_P, %asi
549	srlx		%i0, 6, %g1
550	mov		%i1, %i0
551	mov		%i2, %i1
552	mov		%i3, %l7
553	mov		%i4, %l6
554	mov		%i5, %l5
5551:	ldda		[%i1 + 0x00] %asi, %i2	/* %i2/%i3 = src1 + 0x00 */
556	ldda		[%l7 + 0x00] %asi, %i4	/* %i4/%i5 = src2 + 0x00 */
557	ldda		[%l6 + 0x00] %asi, %g2	/* %g2/%g3 = src3 + 0x00 */
558	ldda		[%l5 + 0x00] %asi, %l0	/* %l0/%l1 = src4 + 0x00 */
559	ldda		[%i0 + 0x00] %asi, %l2	/* %l2/%l3 = dest + 0x00 */
560	xor		%i4, %i2, %i4
561	xor		%i5, %i3, %i5
562	ldda		[%i1 + 0x10] %asi, %i2	/* %i2/%i3 = src1 + 0x10 */
563	xor		%g2, %i4, %g2
564	xor		%g3, %i5, %g3
565	ldda		[%l7 + 0x10] %asi, %i4	/* %i4/%i5 = src2 + 0x10 */
566	xor		%l0, %g2, %l0
567	xor		%l1, %g3, %l1
568	ldda		[%l6 + 0x10] %asi, %g2	/* %g2/%g3 = src3 + 0x10 */
569	xor		%l2, %l0, %l2
570	xor		%l3, %l1, %l3
571	stxa		%l2, [%i0 + 0x00] %asi
572	stxa		%l3, [%i0 + 0x08] %asi
573	ldda		[%l5 + 0x10] %asi, %l0	/* %l0/%l1 = src4 + 0x10 */
574	ldda		[%i0 + 0x10] %asi, %l2	/* %l2/%l3 = dest + 0x10 */
575
576	xor		%i4, %i2, %i4
577	xor		%i5, %i3, %i5
578	ldda		[%i1 + 0x20] %asi, %i2	/* %i2/%i3 = src1 + 0x20 */
579	xor		%g2, %i4, %g2
580	xor		%g3, %i5, %g3
581	ldda		[%l7 + 0x20] %asi, %i4	/* %i4/%i5 = src2 + 0x20 */
582	xor		%l0, %g2, %l0
583	xor		%l1, %g3, %l1
584	ldda		[%l6 + 0x20] %asi, %g2	/* %g2/%g3 = src3 + 0x20 */
585	xor		%l2, %l0, %l2
586	xor		%l3, %l1, %l3
587	stxa		%l2, [%i0 + 0x10] %asi
588	stxa		%l3, [%i0 + 0x18] %asi
589	ldda		[%l5 + 0x20] %asi, %l0	/* %l0/%l1 = src4 + 0x20 */
590	ldda		[%i0 + 0x20] %asi, %l2	/* %l2/%l3 = dest + 0x20 */
591
592	xor		%i4, %i2, %i4
593	xor		%i5, %i3, %i5
594	ldda		[%i1 + 0x30] %asi, %i2	/* %i2/%i3 = src1 + 0x30 */
595	xor		%g2, %i4, %g2
596	xor		%g3, %i5, %g3
597	ldda		[%l7 + 0x30] %asi, %i4	/* %i4/%i5 = src2 + 0x30 */
598	xor		%l0, %g2, %l0
599	xor		%l1, %g3, %l1
600	ldda		[%l6 + 0x30] %asi, %g2	/* %g2/%g3 = src3 + 0x30 */
601	xor		%l2, %l0, %l2
602	xor		%l3, %l1, %l3
603	stxa		%l2, [%i0 + 0x20] %asi
604	stxa		%l3, [%i0 + 0x28] %asi
605	ldda		[%l5 + 0x30] %asi, %l0	/* %l0/%l1 = src4 + 0x30 */
606	ldda		[%i0 + 0x30] %asi, %l2	/* %l2/%l3 = dest + 0x30 */
607
608	prefetch	[%i1 + 0x40], #one_read
609	prefetch	[%l7 + 0x40], #one_read
610	prefetch	[%l6 + 0x40], #one_read
611	prefetch	[%l5 + 0x40], #one_read
612	prefetch	[%i0 + 0x40], #n_writes
613
614	xor		%i4, %i2, %i4
615	xor		%i5, %i3, %i5
616	xor		%g2, %i4, %g2
617	xor		%g3, %i5, %g3
618	xor		%l0, %g2, %l0
619	xor		%l1, %g3, %l1
620	xor		%l2, %l0, %l2
621	xor		%l3, %l1, %l3
622	stxa		%l2, [%i0 + 0x30] %asi
623	stxa		%l3, [%i0 + 0x38] %asi
624
625	add		%i0, 0x40, %i0
626	add		%i1, 0x40, %i1
627	add		%l7, 0x40, %l7
628	add		%l6, 0x40, %l6
629	subcc		%g1, 1, %g1
630	bne,pt		%xcc, 1b
631	 add		%l5, 0x40, %l5
632	membar		#Sync
633	wr		%g7, 0x0, %asi
634	ret
635	 restore
636ENDPROC(xor_niagara_5)