Linux Audio

Check our new training course

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