xref: /openbmc/linux/include/asm-generic/xor.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1af1a8899SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
21da177e4SLinus Torvalds /*
31da177e4SLinus Torvalds  * include/asm-generic/xor.h
41da177e4SLinus Torvalds  *
51da177e4SLinus Torvalds  * Generic optimized RAID-5 checksumming functions.
61da177e4SLinus Torvalds  */
71da177e4SLinus Torvalds 
8268bb0ceSLinus Torvalds #include <linux/prefetch.h>
91da177e4SLinus Torvalds 
101da177e4SLinus Torvalds static void
xor_8regs_2(unsigned long bytes,unsigned long * __restrict p1,const unsigned long * __restrict p2)11*297565aaSArd Biesheuvel xor_8regs_2(unsigned long bytes, unsigned long * __restrict p1,
12*297565aaSArd Biesheuvel 	    const unsigned long * __restrict p2)
131da177e4SLinus Torvalds {
141da177e4SLinus Torvalds 	long lines = bytes / (sizeof (long)) / 8;
151da177e4SLinus Torvalds 
161da177e4SLinus Torvalds 	do {
171da177e4SLinus Torvalds 		p1[0] ^= p2[0];
181da177e4SLinus Torvalds 		p1[1] ^= p2[1];
191da177e4SLinus Torvalds 		p1[2] ^= p2[2];
201da177e4SLinus Torvalds 		p1[3] ^= p2[3];
211da177e4SLinus Torvalds 		p1[4] ^= p2[4];
221da177e4SLinus Torvalds 		p1[5] ^= p2[5];
231da177e4SLinus Torvalds 		p1[6] ^= p2[6];
241da177e4SLinus Torvalds 		p1[7] ^= p2[7];
251da177e4SLinus Torvalds 		p1 += 8;
261da177e4SLinus Torvalds 		p2 += 8;
271da177e4SLinus Torvalds 	} while (--lines > 0);
281da177e4SLinus Torvalds }
291da177e4SLinus Torvalds 
301da177e4SLinus Torvalds static void
xor_8regs_3(unsigned long bytes,unsigned long * __restrict p1,const unsigned long * __restrict p2,const unsigned long * __restrict p3)31*297565aaSArd Biesheuvel xor_8regs_3(unsigned long bytes, unsigned long * __restrict p1,
32*297565aaSArd Biesheuvel 	    const unsigned long * __restrict p2,
33*297565aaSArd Biesheuvel 	    const unsigned long * __restrict p3)
341da177e4SLinus Torvalds {
351da177e4SLinus Torvalds 	long lines = bytes / (sizeof (long)) / 8;
361da177e4SLinus Torvalds 
371da177e4SLinus Torvalds 	do {
381da177e4SLinus Torvalds 		p1[0] ^= p2[0] ^ p3[0];
391da177e4SLinus Torvalds 		p1[1] ^= p2[1] ^ p3[1];
401da177e4SLinus Torvalds 		p1[2] ^= p2[2] ^ p3[2];
411da177e4SLinus Torvalds 		p1[3] ^= p2[3] ^ p3[3];
421da177e4SLinus Torvalds 		p1[4] ^= p2[4] ^ p3[4];
431da177e4SLinus Torvalds 		p1[5] ^= p2[5] ^ p3[5];
441da177e4SLinus Torvalds 		p1[6] ^= p2[6] ^ p3[6];
451da177e4SLinus Torvalds 		p1[7] ^= p2[7] ^ p3[7];
461da177e4SLinus Torvalds 		p1 += 8;
471da177e4SLinus Torvalds 		p2 += 8;
481da177e4SLinus Torvalds 		p3 += 8;
491da177e4SLinus Torvalds 	} while (--lines > 0);
501da177e4SLinus Torvalds }
511da177e4SLinus Torvalds 
521da177e4SLinus Torvalds static void
xor_8regs_4(unsigned long bytes,unsigned long * __restrict p1,const unsigned long * __restrict p2,const unsigned long * __restrict p3,const unsigned long * __restrict p4)53*297565aaSArd Biesheuvel xor_8regs_4(unsigned long bytes, unsigned long * __restrict p1,
54*297565aaSArd Biesheuvel 	    const unsigned long * __restrict p2,
55*297565aaSArd Biesheuvel 	    const unsigned long * __restrict p3,
56*297565aaSArd Biesheuvel 	    const unsigned long * __restrict p4)
571da177e4SLinus Torvalds {
581da177e4SLinus Torvalds 	long lines = bytes / (sizeof (long)) / 8;
591da177e4SLinus Torvalds 
601da177e4SLinus Torvalds 	do {
611da177e4SLinus Torvalds 		p1[0] ^= p2[0] ^ p3[0] ^ p4[0];
621da177e4SLinus Torvalds 		p1[1] ^= p2[1] ^ p3[1] ^ p4[1];
631da177e4SLinus Torvalds 		p1[2] ^= p2[2] ^ p3[2] ^ p4[2];
641da177e4SLinus Torvalds 		p1[3] ^= p2[3] ^ p3[3] ^ p4[3];
651da177e4SLinus Torvalds 		p1[4] ^= p2[4] ^ p3[4] ^ p4[4];
661da177e4SLinus Torvalds 		p1[5] ^= p2[5] ^ p3[5] ^ p4[5];
671da177e4SLinus Torvalds 		p1[6] ^= p2[6] ^ p3[6] ^ p4[6];
681da177e4SLinus Torvalds 		p1[7] ^= p2[7] ^ p3[7] ^ p4[7];
691da177e4SLinus Torvalds 		p1 += 8;
701da177e4SLinus Torvalds 		p2 += 8;
711da177e4SLinus Torvalds 		p3 += 8;
721da177e4SLinus Torvalds 		p4 += 8;
731da177e4SLinus Torvalds 	} while (--lines > 0);
741da177e4SLinus Torvalds }
751da177e4SLinus Torvalds 
761da177e4SLinus Torvalds static void
xor_8regs_5(unsigned long bytes,unsigned long * __restrict p1,const unsigned long * __restrict p2,const unsigned long * __restrict p3,const unsigned long * __restrict p4,const unsigned long * __restrict p5)77*297565aaSArd Biesheuvel xor_8regs_5(unsigned long bytes, unsigned long * __restrict p1,
78*297565aaSArd Biesheuvel 	    const unsigned long * __restrict p2,
79*297565aaSArd Biesheuvel 	    const unsigned long * __restrict p3,
80*297565aaSArd Biesheuvel 	    const unsigned long * __restrict p4,
81*297565aaSArd Biesheuvel 	    const unsigned long * __restrict p5)
821da177e4SLinus Torvalds {
831da177e4SLinus Torvalds 	long lines = bytes / (sizeof (long)) / 8;
841da177e4SLinus Torvalds 
851da177e4SLinus Torvalds 	do {
861da177e4SLinus Torvalds 		p1[0] ^= p2[0] ^ p3[0] ^ p4[0] ^ p5[0];
871da177e4SLinus Torvalds 		p1[1] ^= p2[1] ^ p3[1] ^ p4[1] ^ p5[1];
881da177e4SLinus Torvalds 		p1[2] ^= p2[2] ^ p3[2] ^ p4[2] ^ p5[2];
891da177e4SLinus Torvalds 		p1[3] ^= p2[3] ^ p3[3] ^ p4[3] ^ p5[3];
901da177e4SLinus Torvalds 		p1[4] ^= p2[4] ^ p3[4] ^ p4[4] ^ p5[4];
911da177e4SLinus Torvalds 		p1[5] ^= p2[5] ^ p3[5] ^ p4[5] ^ p5[5];
921da177e4SLinus Torvalds 		p1[6] ^= p2[6] ^ p3[6] ^ p4[6] ^ p5[6];
931da177e4SLinus Torvalds 		p1[7] ^= p2[7] ^ p3[7] ^ p4[7] ^ p5[7];
941da177e4SLinus Torvalds 		p1 += 8;
951da177e4SLinus Torvalds 		p2 += 8;
961da177e4SLinus Torvalds 		p3 += 8;
971da177e4SLinus Torvalds 		p4 += 8;
981da177e4SLinus Torvalds 		p5 += 8;
991da177e4SLinus Torvalds 	} while (--lines > 0);
1001da177e4SLinus Torvalds }
1011da177e4SLinus Torvalds 
1021da177e4SLinus Torvalds static void
xor_32regs_2(unsigned long bytes,unsigned long * __restrict p1,const unsigned long * __restrict p2)103*297565aaSArd Biesheuvel xor_32regs_2(unsigned long bytes, unsigned long * __restrict p1,
104*297565aaSArd Biesheuvel 	     const unsigned long * __restrict p2)
1051da177e4SLinus Torvalds {
1061da177e4SLinus Torvalds 	long lines = bytes / (sizeof (long)) / 8;
1071da177e4SLinus Torvalds 
1081da177e4SLinus Torvalds 	do {
1091da177e4SLinus Torvalds 		register long d0, d1, d2, d3, d4, d5, d6, d7;
1101da177e4SLinus Torvalds 		d0 = p1[0];	/* Pull the stuff into registers	*/
1111da177e4SLinus Torvalds 		d1 = p1[1];	/*  ... in bursts, if possible.		*/
1121da177e4SLinus Torvalds 		d2 = p1[2];
1131da177e4SLinus Torvalds 		d3 = p1[3];
1141da177e4SLinus Torvalds 		d4 = p1[4];
1151da177e4SLinus Torvalds 		d5 = p1[5];
1161da177e4SLinus Torvalds 		d6 = p1[6];
1171da177e4SLinus Torvalds 		d7 = p1[7];
1181da177e4SLinus Torvalds 		d0 ^= p2[0];
1191da177e4SLinus Torvalds 		d1 ^= p2[1];
1201da177e4SLinus Torvalds 		d2 ^= p2[2];
1211da177e4SLinus Torvalds 		d3 ^= p2[3];
1221da177e4SLinus Torvalds 		d4 ^= p2[4];
1231da177e4SLinus Torvalds 		d5 ^= p2[5];
1241da177e4SLinus Torvalds 		d6 ^= p2[6];
1251da177e4SLinus Torvalds 		d7 ^= p2[7];
1261da177e4SLinus Torvalds 		p1[0] = d0;	/* Store the result (in bursts)		*/
1271da177e4SLinus Torvalds 		p1[1] = d1;
1281da177e4SLinus Torvalds 		p1[2] = d2;
1291da177e4SLinus Torvalds 		p1[3] = d3;
1301da177e4SLinus Torvalds 		p1[4] = d4;
1311da177e4SLinus Torvalds 		p1[5] = d5;
1321da177e4SLinus Torvalds 		p1[6] = d6;
1331da177e4SLinus Torvalds 		p1[7] = d7;
1341da177e4SLinus Torvalds 		p1 += 8;
1351da177e4SLinus Torvalds 		p2 += 8;
1361da177e4SLinus Torvalds 	} while (--lines > 0);
1371da177e4SLinus Torvalds }
1381da177e4SLinus Torvalds 
1391da177e4SLinus Torvalds static void
xor_32regs_3(unsigned long bytes,unsigned long * __restrict p1,const unsigned long * __restrict p2,const unsigned long * __restrict p3)140*297565aaSArd Biesheuvel xor_32regs_3(unsigned long bytes, unsigned long * __restrict p1,
141*297565aaSArd Biesheuvel 	     const unsigned long * __restrict p2,
142*297565aaSArd Biesheuvel 	     const unsigned long * __restrict p3)
1431da177e4SLinus Torvalds {
1441da177e4SLinus Torvalds 	long lines = bytes / (sizeof (long)) / 8;
1451da177e4SLinus Torvalds 
1461da177e4SLinus Torvalds 	do {
1471da177e4SLinus Torvalds 		register long d0, d1, d2, d3, d4, d5, d6, d7;
1481da177e4SLinus Torvalds 		d0 = p1[0];	/* Pull the stuff into registers	*/
1491da177e4SLinus Torvalds 		d1 = p1[1];	/*  ... in bursts, if possible.		*/
1501da177e4SLinus Torvalds 		d2 = p1[2];
1511da177e4SLinus Torvalds 		d3 = p1[3];
1521da177e4SLinus Torvalds 		d4 = p1[4];
1531da177e4SLinus Torvalds 		d5 = p1[5];
1541da177e4SLinus Torvalds 		d6 = p1[6];
1551da177e4SLinus Torvalds 		d7 = p1[7];
1561da177e4SLinus Torvalds 		d0 ^= p2[0];
1571da177e4SLinus Torvalds 		d1 ^= p2[1];
1581da177e4SLinus Torvalds 		d2 ^= p2[2];
1591da177e4SLinus Torvalds 		d3 ^= p2[3];
1601da177e4SLinus Torvalds 		d4 ^= p2[4];
1611da177e4SLinus Torvalds 		d5 ^= p2[5];
1621da177e4SLinus Torvalds 		d6 ^= p2[6];
1631da177e4SLinus Torvalds 		d7 ^= p2[7];
1641da177e4SLinus Torvalds 		d0 ^= p3[0];
1651da177e4SLinus Torvalds 		d1 ^= p3[1];
1661da177e4SLinus Torvalds 		d2 ^= p3[2];
1671da177e4SLinus Torvalds 		d3 ^= p3[3];
1681da177e4SLinus Torvalds 		d4 ^= p3[4];
1691da177e4SLinus Torvalds 		d5 ^= p3[5];
1701da177e4SLinus Torvalds 		d6 ^= p3[6];
1711da177e4SLinus Torvalds 		d7 ^= p3[7];
1721da177e4SLinus Torvalds 		p1[0] = d0;	/* Store the result (in bursts)		*/
1731da177e4SLinus Torvalds 		p1[1] = d1;
1741da177e4SLinus Torvalds 		p1[2] = d2;
1751da177e4SLinus Torvalds 		p1[3] = d3;
1761da177e4SLinus Torvalds 		p1[4] = d4;
1771da177e4SLinus Torvalds 		p1[5] = d5;
1781da177e4SLinus Torvalds 		p1[6] = d6;
1791da177e4SLinus Torvalds 		p1[7] = d7;
1801da177e4SLinus Torvalds 		p1 += 8;
1811da177e4SLinus Torvalds 		p2 += 8;
1821da177e4SLinus Torvalds 		p3 += 8;
1831da177e4SLinus Torvalds 	} while (--lines > 0);
1841da177e4SLinus Torvalds }
1851da177e4SLinus Torvalds 
1861da177e4SLinus Torvalds static void
xor_32regs_4(unsigned long bytes,unsigned long * __restrict p1,const unsigned long * __restrict p2,const unsigned long * __restrict p3,const unsigned long * __restrict p4)187*297565aaSArd Biesheuvel xor_32regs_4(unsigned long bytes, unsigned long * __restrict p1,
188*297565aaSArd Biesheuvel 	     const unsigned long * __restrict p2,
189*297565aaSArd Biesheuvel 	     const unsigned long * __restrict p3,
190*297565aaSArd Biesheuvel 	     const unsigned long * __restrict p4)
1911da177e4SLinus Torvalds {
1921da177e4SLinus Torvalds 	long lines = bytes / (sizeof (long)) / 8;
1931da177e4SLinus Torvalds 
1941da177e4SLinus Torvalds 	do {
1951da177e4SLinus Torvalds 		register long d0, d1, d2, d3, d4, d5, d6, d7;
1961da177e4SLinus Torvalds 		d0 = p1[0];	/* Pull the stuff into registers	*/
1971da177e4SLinus Torvalds 		d1 = p1[1];	/*  ... in bursts, if possible.		*/
1981da177e4SLinus Torvalds 		d2 = p1[2];
1991da177e4SLinus Torvalds 		d3 = p1[3];
2001da177e4SLinus Torvalds 		d4 = p1[4];
2011da177e4SLinus Torvalds 		d5 = p1[5];
2021da177e4SLinus Torvalds 		d6 = p1[6];
2031da177e4SLinus Torvalds 		d7 = p1[7];
2041da177e4SLinus Torvalds 		d0 ^= p2[0];
2051da177e4SLinus Torvalds 		d1 ^= p2[1];
2061da177e4SLinus Torvalds 		d2 ^= p2[2];
2071da177e4SLinus Torvalds 		d3 ^= p2[3];
2081da177e4SLinus Torvalds 		d4 ^= p2[4];
2091da177e4SLinus Torvalds 		d5 ^= p2[5];
2101da177e4SLinus Torvalds 		d6 ^= p2[6];
2111da177e4SLinus Torvalds 		d7 ^= p2[7];
2121da177e4SLinus Torvalds 		d0 ^= p3[0];
2131da177e4SLinus Torvalds 		d1 ^= p3[1];
2141da177e4SLinus Torvalds 		d2 ^= p3[2];
2151da177e4SLinus Torvalds 		d3 ^= p3[3];
2161da177e4SLinus Torvalds 		d4 ^= p3[4];
2171da177e4SLinus Torvalds 		d5 ^= p3[5];
2181da177e4SLinus Torvalds 		d6 ^= p3[6];
2191da177e4SLinus Torvalds 		d7 ^= p3[7];
2201da177e4SLinus Torvalds 		d0 ^= p4[0];
2211da177e4SLinus Torvalds 		d1 ^= p4[1];
2221da177e4SLinus Torvalds 		d2 ^= p4[2];
2231da177e4SLinus Torvalds 		d3 ^= p4[3];
2241da177e4SLinus Torvalds 		d4 ^= p4[4];
2251da177e4SLinus Torvalds 		d5 ^= p4[5];
2261da177e4SLinus Torvalds 		d6 ^= p4[6];
2271da177e4SLinus Torvalds 		d7 ^= p4[7];
2281da177e4SLinus Torvalds 		p1[0] = d0;	/* Store the result (in bursts)		*/
2291da177e4SLinus Torvalds 		p1[1] = d1;
2301da177e4SLinus Torvalds 		p1[2] = d2;
2311da177e4SLinus Torvalds 		p1[3] = d3;
2321da177e4SLinus Torvalds 		p1[4] = d4;
2331da177e4SLinus Torvalds 		p1[5] = d5;
2341da177e4SLinus Torvalds 		p1[6] = d6;
2351da177e4SLinus Torvalds 		p1[7] = d7;
2361da177e4SLinus Torvalds 		p1 += 8;
2371da177e4SLinus Torvalds 		p2 += 8;
2381da177e4SLinus Torvalds 		p3 += 8;
2391da177e4SLinus Torvalds 		p4 += 8;
2401da177e4SLinus Torvalds 	} while (--lines > 0);
2411da177e4SLinus Torvalds }
2421da177e4SLinus Torvalds 
2431da177e4SLinus Torvalds static void
xor_32regs_5(unsigned long bytes,unsigned long * __restrict p1,const unsigned long * __restrict p2,const unsigned long * __restrict p3,const unsigned long * __restrict p4,const unsigned long * __restrict p5)244*297565aaSArd Biesheuvel xor_32regs_5(unsigned long bytes, unsigned long * __restrict p1,
245*297565aaSArd Biesheuvel 	     const unsigned long * __restrict p2,
246*297565aaSArd Biesheuvel 	     const unsigned long * __restrict p3,
247*297565aaSArd Biesheuvel 	     const unsigned long * __restrict p4,
248*297565aaSArd Biesheuvel 	     const unsigned long * __restrict p5)
2491da177e4SLinus Torvalds {
2501da177e4SLinus Torvalds 	long lines = bytes / (sizeof (long)) / 8;
2511da177e4SLinus Torvalds 
2521da177e4SLinus Torvalds 	do {
2531da177e4SLinus Torvalds 		register long d0, d1, d2, d3, d4, d5, d6, d7;
2541da177e4SLinus Torvalds 		d0 = p1[0];	/* Pull the stuff into registers	*/
2551da177e4SLinus Torvalds 		d1 = p1[1];	/*  ... in bursts, if possible.		*/
2561da177e4SLinus Torvalds 		d2 = p1[2];
2571da177e4SLinus Torvalds 		d3 = p1[3];
2581da177e4SLinus Torvalds 		d4 = p1[4];
2591da177e4SLinus Torvalds 		d5 = p1[5];
2601da177e4SLinus Torvalds 		d6 = p1[6];
2611da177e4SLinus Torvalds 		d7 = p1[7];
2621da177e4SLinus Torvalds 		d0 ^= p2[0];
2631da177e4SLinus Torvalds 		d1 ^= p2[1];
2641da177e4SLinus Torvalds 		d2 ^= p2[2];
2651da177e4SLinus Torvalds 		d3 ^= p2[3];
2661da177e4SLinus Torvalds 		d4 ^= p2[4];
2671da177e4SLinus Torvalds 		d5 ^= p2[5];
2681da177e4SLinus Torvalds 		d6 ^= p2[6];
2691da177e4SLinus Torvalds 		d7 ^= p2[7];
2701da177e4SLinus Torvalds 		d0 ^= p3[0];
2711da177e4SLinus Torvalds 		d1 ^= p3[1];
2721da177e4SLinus Torvalds 		d2 ^= p3[2];
2731da177e4SLinus Torvalds 		d3 ^= p3[3];
2741da177e4SLinus Torvalds 		d4 ^= p3[4];
2751da177e4SLinus Torvalds 		d5 ^= p3[5];
2761da177e4SLinus Torvalds 		d6 ^= p3[6];
2771da177e4SLinus Torvalds 		d7 ^= p3[7];
2781da177e4SLinus Torvalds 		d0 ^= p4[0];
2791da177e4SLinus Torvalds 		d1 ^= p4[1];
2801da177e4SLinus Torvalds 		d2 ^= p4[2];
2811da177e4SLinus Torvalds 		d3 ^= p4[3];
2821da177e4SLinus Torvalds 		d4 ^= p4[4];
2831da177e4SLinus Torvalds 		d5 ^= p4[5];
2841da177e4SLinus Torvalds 		d6 ^= p4[6];
2851da177e4SLinus Torvalds 		d7 ^= p4[7];
2861da177e4SLinus Torvalds 		d0 ^= p5[0];
2871da177e4SLinus Torvalds 		d1 ^= p5[1];
2881da177e4SLinus Torvalds 		d2 ^= p5[2];
2891da177e4SLinus Torvalds 		d3 ^= p5[3];
2901da177e4SLinus Torvalds 		d4 ^= p5[4];
2911da177e4SLinus Torvalds 		d5 ^= p5[5];
2921da177e4SLinus Torvalds 		d6 ^= p5[6];
2931da177e4SLinus Torvalds 		d7 ^= p5[7];
2941da177e4SLinus Torvalds 		p1[0] = d0;	/* Store the result (in bursts)		*/
2951da177e4SLinus Torvalds 		p1[1] = d1;
2961da177e4SLinus Torvalds 		p1[2] = d2;
2971da177e4SLinus Torvalds 		p1[3] = d3;
2981da177e4SLinus Torvalds 		p1[4] = d4;
2991da177e4SLinus Torvalds 		p1[5] = d5;
3001da177e4SLinus Torvalds 		p1[6] = d6;
3011da177e4SLinus Torvalds 		p1[7] = d7;
3021da177e4SLinus Torvalds 		p1 += 8;
3031da177e4SLinus Torvalds 		p2 += 8;
3041da177e4SLinus Torvalds 		p3 += 8;
3051da177e4SLinus Torvalds 		p4 += 8;
3061da177e4SLinus Torvalds 		p5 += 8;
3071da177e4SLinus Torvalds 	} while (--lines > 0);
3081da177e4SLinus Torvalds }
3091da177e4SLinus Torvalds 
3101da177e4SLinus Torvalds static void
xor_8regs_p_2(unsigned long bytes,unsigned long * __restrict p1,const unsigned long * __restrict p2)311*297565aaSArd Biesheuvel xor_8regs_p_2(unsigned long bytes, unsigned long * __restrict p1,
312*297565aaSArd Biesheuvel 	      const unsigned long * __restrict p2)
3131da177e4SLinus Torvalds {
3141da177e4SLinus Torvalds 	long lines = bytes / (sizeof (long)) / 8 - 1;
3151da177e4SLinus Torvalds 	prefetchw(p1);
3161da177e4SLinus Torvalds 	prefetch(p2);
3171da177e4SLinus Torvalds 
3181da177e4SLinus Torvalds 	do {
3191da177e4SLinus Torvalds 		prefetchw(p1+8);
3201da177e4SLinus Torvalds 		prefetch(p2+8);
3211da177e4SLinus Torvalds  once_more:
3221da177e4SLinus Torvalds 		p1[0] ^= p2[0];
3231da177e4SLinus Torvalds 		p1[1] ^= p2[1];
3241da177e4SLinus Torvalds 		p1[2] ^= p2[2];
3251da177e4SLinus Torvalds 		p1[3] ^= p2[3];
3261da177e4SLinus Torvalds 		p1[4] ^= p2[4];
3271da177e4SLinus Torvalds 		p1[5] ^= p2[5];
3281da177e4SLinus Torvalds 		p1[6] ^= p2[6];
3291da177e4SLinus Torvalds 		p1[7] ^= p2[7];
3301da177e4SLinus Torvalds 		p1 += 8;
3311da177e4SLinus Torvalds 		p2 += 8;
3321da177e4SLinus Torvalds 	} while (--lines > 0);
3331da177e4SLinus Torvalds 	if (lines == 0)
3341da177e4SLinus Torvalds 		goto once_more;
3351da177e4SLinus Torvalds }
3361da177e4SLinus Torvalds 
3371da177e4SLinus Torvalds static void
xor_8regs_p_3(unsigned long bytes,unsigned long * __restrict p1,const unsigned long * __restrict p2,const unsigned long * __restrict p3)338*297565aaSArd Biesheuvel xor_8regs_p_3(unsigned long bytes, unsigned long * __restrict p1,
339*297565aaSArd Biesheuvel 	      const unsigned long * __restrict p2,
340*297565aaSArd Biesheuvel 	      const unsigned long * __restrict p3)
3411da177e4SLinus Torvalds {
3421da177e4SLinus Torvalds 	long lines = bytes / (sizeof (long)) / 8 - 1;
3431da177e4SLinus Torvalds 	prefetchw(p1);
3441da177e4SLinus Torvalds 	prefetch(p2);
3451da177e4SLinus Torvalds 	prefetch(p3);
3461da177e4SLinus Torvalds 
3471da177e4SLinus Torvalds 	do {
3481da177e4SLinus Torvalds 		prefetchw(p1+8);
3491da177e4SLinus Torvalds 		prefetch(p2+8);
3501da177e4SLinus Torvalds 		prefetch(p3+8);
3511da177e4SLinus Torvalds  once_more:
3521da177e4SLinus Torvalds 		p1[0] ^= p2[0] ^ p3[0];
3531da177e4SLinus Torvalds 		p1[1] ^= p2[1] ^ p3[1];
3541da177e4SLinus Torvalds 		p1[2] ^= p2[2] ^ p3[2];
3551da177e4SLinus Torvalds 		p1[3] ^= p2[3] ^ p3[3];
3561da177e4SLinus Torvalds 		p1[4] ^= p2[4] ^ p3[4];
3571da177e4SLinus Torvalds 		p1[5] ^= p2[5] ^ p3[5];
3581da177e4SLinus Torvalds 		p1[6] ^= p2[6] ^ p3[6];
3591da177e4SLinus Torvalds 		p1[7] ^= p2[7] ^ p3[7];
3601da177e4SLinus Torvalds 		p1 += 8;
3611da177e4SLinus Torvalds 		p2 += 8;
3621da177e4SLinus Torvalds 		p3 += 8;
3631da177e4SLinus Torvalds 	} while (--lines > 0);
3641da177e4SLinus Torvalds 	if (lines == 0)
3651da177e4SLinus Torvalds 		goto once_more;
3661da177e4SLinus Torvalds }
3671da177e4SLinus Torvalds 
3681da177e4SLinus Torvalds static void
xor_8regs_p_4(unsigned long bytes,unsigned long * __restrict p1,const unsigned long * __restrict p2,const unsigned long * __restrict p3,const unsigned long * __restrict p4)369*297565aaSArd Biesheuvel xor_8regs_p_4(unsigned long bytes, unsigned long * __restrict p1,
370*297565aaSArd Biesheuvel 	      const unsigned long * __restrict p2,
371*297565aaSArd Biesheuvel 	      const unsigned long * __restrict p3,
372*297565aaSArd Biesheuvel 	      const unsigned long * __restrict p4)
3731da177e4SLinus Torvalds {
3741da177e4SLinus Torvalds 	long lines = bytes / (sizeof (long)) / 8 - 1;
3751da177e4SLinus Torvalds 
3761da177e4SLinus Torvalds 	prefetchw(p1);
3771da177e4SLinus Torvalds 	prefetch(p2);
3781da177e4SLinus Torvalds 	prefetch(p3);
3791da177e4SLinus Torvalds 	prefetch(p4);
3801da177e4SLinus Torvalds 
3811da177e4SLinus Torvalds 	do {
3821da177e4SLinus Torvalds 		prefetchw(p1+8);
3831da177e4SLinus Torvalds 		prefetch(p2+8);
3841da177e4SLinus Torvalds 		prefetch(p3+8);
3851da177e4SLinus Torvalds 		prefetch(p4+8);
3861da177e4SLinus Torvalds  once_more:
3871da177e4SLinus Torvalds 		p1[0] ^= p2[0] ^ p3[0] ^ p4[0];
3881da177e4SLinus Torvalds 		p1[1] ^= p2[1] ^ p3[1] ^ p4[1];
3891da177e4SLinus Torvalds 		p1[2] ^= p2[2] ^ p3[2] ^ p4[2];
3901da177e4SLinus Torvalds 		p1[3] ^= p2[3] ^ p3[3] ^ p4[3];
3911da177e4SLinus Torvalds 		p1[4] ^= p2[4] ^ p3[4] ^ p4[4];
3921da177e4SLinus Torvalds 		p1[5] ^= p2[5] ^ p3[5] ^ p4[5];
3931da177e4SLinus Torvalds 		p1[6] ^= p2[6] ^ p3[6] ^ p4[6];
3941da177e4SLinus Torvalds 		p1[7] ^= p2[7] ^ p3[7] ^ p4[7];
3951da177e4SLinus Torvalds 		p1 += 8;
3961da177e4SLinus Torvalds 		p2 += 8;
3971da177e4SLinus Torvalds 		p3 += 8;
3981da177e4SLinus Torvalds 		p4 += 8;
3991da177e4SLinus Torvalds 	} while (--lines > 0);
4001da177e4SLinus Torvalds 	if (lines == 0)
4011da177e4SLinus Torvalds 		goto once_more;
4021da177e4SLinus Torvalds }
4031da177e4SLinus Torvalds 
4041da177e4SLinus Torvalds static void
xor_8regs_p_5(unsigned long bytes,unsigned long * __restrict p1,const unsigned long * __restrict p2,const unsigned long * __restrict p3,const unsigned long * __restrict p4,const unsigned long * __restrict p5)405*297565aaSArd Biesheuvel xor_8regs_p_5(unsigned long bytes, unsigned long * __restrict p1,
406*297565aaSArd Biesheuvel 	      const unsigned long * __restrict p2,
407*297565aaSArd Biesheuvel 	      const unsigned long * __restrict p3,
408*297565aaSArd Biesheuvel 	      const unsigned long * __restrict p4,
409*297565aaSArd Biesheuvel 	      const unsigned long * __restrict p5)
4101da177e4SLinus Torvalds {
4111da177e4SLinus Torvalds 	long lines = bytes / (sizeof (long)) / 8 - 1;
4121da177e4SLinus Torvalds 
4131da177e4SLinus Torvalds 	prefetchw(p1);
4141da177e4SLinus Torvalds 	prefetch(p2);
4151da177e4SLinus Torvalds 	prefetch(p3);
4161da177e4SLinus Torvalds 	prefetch(p4);
4171da177e4SLinus Torvalds 	prefetch(p5);
4181da177e4SLinus Torvalds 
4191da177e4SLinus Torvalds 	do {
4201da177e4SLinus Torvalds 		prefetchw(p1+8);
4211da177e4SLinus Torvalds 		prefetch(p2+8);
4221da177e4SLinus Torvalds 		prefetch(p3+8);
4231da177e4SLinus Torvalds 		prefetch(p4+8);
4241da177e4SLinus Torvalds 		prefetch(p5+8);
4251da177e4SLinus Torvalds  once_more:
4261da177e4SLinus Torvalds 		p1[0] ^= p2[0] ^ p3[0] ^ p4[0] ^ p5[0];
4271da177e4SLinus Torvalds 		p1[1] ^= p2[1] ^ p3[1] ^ p4[1] ^ p5[1];
4281da177e4SLinus Torvalds 		p1[2] ^= p2[2] ^ p3[2] ^ p4[2] ^ p5[2];
4291da177e4SLinus Torvalds 		p1[3] ^= p2[3] ^ p3[3] ^ p4[3] ^ p5[3];
4301da177e4SLinus Torvalds 		p1[4] ^= p2[4] ^ p3[4] ^ p4[4] ^ p5[4];
4311da177e4SLinus Torvalds 		p1[5] ^= p2[5] ^ p3[5] ^ p4[5] ^ p5[5];
4321da177e4SLinus Torvalds 		p1[6] ^= p2[6] ^ p3[6] ^ p4[6] ^ p5[6];
4331da177e4SLinus Torvalds 		p1[7] ^= p2[7] ^ p3[7] ^ p4[7] ^ p5[7];
4341da177e4SLinus Torvalds 		p1 += 8;
4351da177e4SLinus Torvalds 		p2 += 8;
4361da177e4SLinus Torvalds 		p3 += 8;
4371da177e4SLinus Torvalds 		p4 += 8;
4381da177e4SLinus Torvalds 		p5 += 8;
4391da177e4SLinus Torvalds 	} while (--lines > 0);
4401da177e4SLinus Torvalds 	if (lines == 0)
4411da177e4SLinus Torvalds 		goto once_more;
4421da177e4SLinus Torvalds }
4431da177e4SLinus Torvalds 
4441da177e4SLinus Torvalds static void
xor_32regs_p_2(unsigned long bytes,unsigned long * __restrict p1,const unsigned long * __restrict p2)445*297565aaSArd Biesheuvel xor_32regs_p_2(unsigned long bytes, unsigned long * __restrict p1,
446*297565aaSArd Biesheuvel 	       const unsigned long * __restrict p2)
4471da177e4SLinus Torvalds {
4481da177e4SLinus Torvalds 	long lines = bytes / (sizeof (long)) / 8 - 1;
4491da177e4SLinus Torvalds 
4501da177e4SLinus Torvalds 	prefetchw(p1);
4511da177e4SLinus Torvalds 	prefetch(p2);
4521da177e4SLinus Torvalds 
4531da177e4SLinus Torvalds 	do {
4541da177e4SLinus Torvalds 		register long d0, d1, d2, d3, d4, d5, d6, d7;
4551da177e4SLinus Torvalds 
4561da177e4SLinus Torvalds 		prefetchw(p1+8);
4571da177e4SLinus Torvalds 		prefetch(p2+8);
4581da177e4SLinus Torvalds  once_more:
4591da177e4SLinus Torvalds 		d0 = p1[0];	/* Pull the stuff into registers	*/
4601da177e4SLinus Torvalds 		d1 = p1[1];	/*  ... in bursts, if possible.		*/
4611da177e4SLinus Torvalds 		d2 = p1[2];
4621da177e4SLinus Torvalds 		d3 = p1[3];
4631da177e4SLinus Torvalds 		d4 = p1[4];
4641da177e4SLinus Torvalds 		d5 = p1[5];
4651da177e4SLinus Torvalds 		d6 = p1[6];
4661da177e4SLinus Torvalds 		d7 = p1[7];
4671da177e4SLinus Torvalds 		d0 ^= p2[0];
4681da177e4SLinus Torvalds 		d1 ^= p2[1];
4691da177e4SLinus Torvalds 		d2 ^= p2[2];
4701da177e4SLinus Torvalds 		d3 ^= p2[3];
4711da177e4SLinus Torvalds 		d4 ^= p2[4];
4721da177e4SLinus Torvalds 		d5 ^= p2[5];
4731da177e4SLinus Torvalds 		d6 ^= p2[6];
4741da177e4SLinus Torvalds 		d7 ^= p2[7];
4751da177e4SLinus Torvalds 		p1[0] = d0;	/* Store the result (in bursts)		*/
4761da177e4SLinus Torvalds 		p1[1] = d1;
4771da177e4SLinus Torvalds 		p1[2] = d2;
4781da177e4SLinus Torvalds 		p1[3] = d3;
4791da177e4SLinus Torvalds 		p1[4] = d4;
4801da177e4SLinus Torvalds 		p1[5] = d5;
4811da177e4SLinus Torvalds 		p1[6] = d6;
4821da177e4SLinus Torvalds 		p1[7] = d7;
4831da177e4SLinus Torvalds 		p1 += 8;
4841da177e4SLinus Torvalds 		p2 += 8;
4851da177e4SLinus Torvalds 	} while (--lines > 0);
4861da177e4SLinus Torvalds 	if (lines == 0)
4871da177e4SLinus Torvalds 		goto once_more;
4881da177e4SLinus Torvalds }
4891da177e4SLinus Torvalds 
4901da177e4SLinus Torvalds static void
xor_32regs_p_3(unsigned long bytes,unsigned long * __restrict p1,const unsigned long * __restrict p2,const unsigned long * __restrict p3)491*297565aaSArd Biesheuvel xor_32regs_p_3(unsigned long bytes, unsigned long * __restrict p1,
492*297565aaSArd Biesheuvel 	       const unsigned long * __restrict p2,
493*297565aaSArd Biesheuvel 	       const unsigned long * __restrict p3)
4941da177e4SLinus Torvalds {
4951da177e4SLinus Torvalds 	long lines = bytes / (sizeof (long)) / 8 - 1;
4961da177e4SLinus Torvalds 
4971da177e4SLinus Torvalds 	prefetchw(p1);
4981da177e4SLinus Torvalds 	prefetch(p2);
4991da177e4SLinus Torvalds 	prefetch(p3);
5001da177e4SLinus Torvalds 
5011da177e4SLinus Torvalds 	do {
5021da177e4SLinus Torvalds 		register long d0, d1, d2, d3, d4, d5, d6, d7;
5031da177e4SLinus Torvalds 
5041da177e4SLinus Torvalds 		prefetchw(p1+8);
5051da177e4SLinus Torvalds 		prefetch(p2+8);
5061da177e4SLinus Torvalds 		prefetch(p3+8);
5071da177e4SLinus Torvalds  once_more:
5081da177e4SLinus Torvalds 		d0 = p1[0];	/* Pull the stuff into registers	*/
5091da177e4SLinus Torvalds 		d1 = p1[1];	/*  ... in bursts, if possible.		*/
5101da177e4SLinus Torvalds 		d2 = p1[2];
5111da177e4SLinus Torvalds 		d3 = p1[3];
5121da177e4SLinus Torvalds 		d4 = p1[4];
5131da177e4SLinus Torvalds 		d5 = p1[5];
5141da177e4SLinus Torvalds 		d6 = p1[6];
5151da177e4SLinus Torvalds 		d7 = p1[7];
5161da177e4SLinus Torvalds 		d0 ^= p2[0];
5171da177e4SLinus Torvalds 		d1 ^= p2[1];
5181da177e4SLinus Torvalds 		d2 ^= p2[2];
5191da177e4SLinus Torvalds 		d3 ^= p2[3];
5201da177e4SLinus Torvalds 		d4 ^= p2[4];
5211da177e4SLinus Torvalds 		d5 ^= p2[5];
5221da177e4SLinus Torvalds 		d6 ^= p2[6];
5231da177e4SLinus Torvalds 		d7 ^= p2[7];
5241da177e4SLinus Torvalds 		d0 ^= p3[0];
5251da177e4SLinus Torvalds 		d1 ^= p3[1];
5261da177e4SLinus Torvalds 		d2 ^= p3[2];
5271da177e4SLinus Torvalds 		d3 ^= p3[3];
5281da177e4SLinus Torvalds 		d4 ^= p3[4];
5291da177e4SLinus Torvalds 		d5 ^= p3[5];
5301da177e4SLinus Torvalds 		d6 ^= p3[6];
5311da177e4SLinus Torvalds 		d7 ^= p3[7];
5321da177e4SLinus Torvalds 		p1[0] = d0;	/* Store the result (in bursts)		*/
5331da177e4SLinus Torvalds 		p1[1] = d1;
5341da177e4SLinus Torvalds 		p1[2] = d2;
5351da177e4SLinus Torvalds 		p1[3] = d3;
5361da177e4SLinus Torvalds 		p1[4] = d4;
5371da177e4SLinus Torvalds 		p1[5] = d5;
5381da177e4SLinus Torvalds 		p1[6] = d6;
5391da177e4SLinus Torvalds 		p1[7] = d7;
5401da177e4SLinus Torvalds 		p1 += 8;
5411da177e4SLinus Torvalds 		p2 += 8;
5421da177e4SLinus Torvalds 		p3 += 8;
5431da177e4SLinus Torvalds 	} while (--lines > 0);
5441da177e4SLinus Torvalds 	if (lines == 0)
5451da177e4SLinus Torvalds 		goto once_more;
5461da177e4SLinus Torvalds }
5471da177e4SLinus Torvalds 
5481da177e4SLinus Torvalds static void
xor_32regs_p_4(unsigned long bytes,unsigned long * __restrict p1,const unsigned long * __restrict p2,const unsigned long * __restrict p3,const unsigned long * __restrict p4)549*297565aaSArd Biesheuvel xor_32regs_p_4(unsigned long bytes, unsigned long * __restrict p1,
550*297565aaSArd Biesheuvel 	       const unsigned long * __restrict p2,
551*297565aaSArd Biesheuvel 	       const unsigned long * __restrict p3,
552*297565aaSArd Biesheuvel 	       const unsigned long * __restrict p4)
5531da177e4SLinus Torvalds {
5541da177e4SLinus Torvalds 	long lines = bytes / (sizeof (long)) / 8 - 1;
5551da177e4SLinus Torvalds 
5561da177e4SLinus Torvalds 	prefetchw(p1);
5571da177e4SLinus Torvalds 	prefetch(p2);
5581da177e4SLinus Torvalds 	prefetch(p3);
5591da177e4SLinus Torvalds 	prefetch(p4);
5601da177e4SLinus Torvalds 
5611da177e4SLinus Torvalds 	do {
5621da177e4SLinus Torvalds 		register long d0, d1, d2, d3, d4, d5, d6, d7;
5631da177e4SLinus Torvalds 
5641da177e4SLinus Torvalds 		prefetchw(p1+8);
5651da177e4SLinus Torvalds 		prefetch(p2+8);
5661da177e4SLinus Torvalds 		prefetch(p3+8);
5671da177e4SLinus Torvalds 		prefetch(p4+8);
5681da177e4SLinus Torvalds  once_more:
5691da177e4SLinus Torvalds 		d0 = p1[0];	/* Pull the stuff into registers	*/
5701da177e4SLinus Torvalds 		d1 = p1[1];	/*  ... in bursts, if possible.		*/
5711da177e4SLinus Torvalds 		d2 = p1[2];
5721da177e4SLinus Torvalds 		d3 = p1[3];
5731da177e4SLinus Torvalds 		d4 = p1[4];
5741da177e4SLinus Torvalds 		d5 = p1[5];
5751da177e4SLinus Torvalds 		d6 = p1[6];
5761da177e4SLinus Torvalds 		d7 = p1[7];
5771da177e4SLinus Torvalds 		d0 ^= p2[0];
5781da177e4SLinus Torvalds 		d1 ^= p2[1];
5791da177e4SLinus Torvalds 		d2 ^= p2[2];
5801da177e4SLinus Torvalds 		d3 ^= p2[3];
5811da177e4SLinus Torvalds 		d4 ^= p2[4];
5821da177e4SLinus Torvalds 		d5 ^= p2[5];
5831da177e4SLinus Torvalds 		d6 ^= p2[6];
5841da177e4SLinus Torvalds 		d7 ^= p2[7];
5851da177e4SLinus Torvalds 		d0 ^= p3[0];
5861da177e4SLinus Torvalds 		d1 ^= p3[1];
5871da177e4SLinus Torvalds 		d2 ^= p3[2];
5881da177e4SLinus Torvalds 		d3 ^= p3[3];
5891da177e4SLinus Torvalds 		d4 ^= p3[4];
5901da177e4SLinus Torvalds 		d5 ^= p3[5];
5911da177e4SLinus Torvalds 		d6 ^= p3[6];
5921da177e4SLinus Torvalds 		d7 ^= p3[7];
5931da177e4SLinus Torvalds 		d0 ^= p4[0];
5941da177e4SLinus Torvalds 		d1 ^= p4[1];
5951da177e4SLinus Torvalds 		d2 ^= p4[2];
5961da177e4SLinus Torvalds 		d3 ^= p4[3];
5971da177e4SLinus Torvalds 		d4 ^= p4[4];
5981da177e4SLinus Torvalds 		d5 ^= p4[5];
5991da177e4SLinus Torvalds 		d6 ^= p4[6];
6001da177e4SLinus Torvalds 		d7 ^= p4[7];
6011da177e4SLinus Torvalds 		p1[0] = d0;	/* Store the result (in bursts)		*/
6021da177e4SLinus Torvalds 		p1[1] = d1;
6031da177e4SLinus Torvalds 		p1[2] = d2;
6041da177e4SLinus Torvalds 		p1[3] = d3;
6051da177e4SLinus Torvalds 		p1[4] = d4;
6061da177e4SLinus Torvalds 		p1[5] = d5;
6071da177e4SLinus Torvalds 		p1[6] = d6;
6081da177e4SLinus Torvalds 		p1[7] = d7;
6091da177e4SLinus Torvalds 		p1 += 8;
6101da177e4SLinus Torvalds 		p2 += 8;
6111da177e4SLinus Torvalds 		p3 += 8;
6121da177e4SLinus Torvalds 		p4 += 8;
6131da177e4SLinus Torvalds 	} while (--lines > 0);
6141da177e4SLinus Torvalds 	if (lines == 0)
6151da177e4SLinus Torvalds 		goto once_more;
6161da177e4SLinus Torvalds }
6171da177e4SLinus Torvalds 
6181da177e4SLinus Torvalds static void
xor_32regs_p_5(unsigned long bytes,unsigned long * __restrict p1,const unsigned long * __restrict p2,const unsigned long * __restrict p3,const unsigned long * __restrict p4,const unsigned long * __restrict p5)619*297565aaSArd Biesheuvel xor_32regs_p_5(unsigned long bytes, unsigned long * __restrict p1,
620*297565aaSArd Biesheuvel 	       const unsigned long * __restrict p2,
621*297565aaSArd Biesheuvel 	       const unsigned long * __restrict p3,
622*297565aaSArd Biesheuvel 	       const unsigned long * __restrict p4,
623*297565aaSArd Biesheuvel 	       const unsigned long * __restrict p5)
6241da177e4SLinus Torvalds {
6251da177e4SLinus Torvalds 	long lines = bytes / (sizeof (long)) / 8 - 1;
6261da177e4SLinus Torvalds 
6271da177e4SLinus Torvalds 	prefetchw(p1);
6281da177e4SLinus Torvalds 	prefetch(p2);
6291da177e4SLinus Torvalds 	prefetch(p3);
6301da177e4SLinus Torvalds 	prefetch(p4);
6311da177e4SLinus Torvalds 	prefetch(p5);
6321da177e4SLinus Torvalds 
6331da177e4SLinus Torvalds 	do {
6341da177e4SLinus Torvalds 		register long d0, d1, d2, d3, d4, d5, d6, d7;
6351da177e4SLinus Torvalds 
6361da177e4SLinus Torvalds 		prefetchw(p1+8);
6371da177e4SLinus Torvalds 		prefetch(p2+8);
6381da177e4SLinus Torvalds 		prefetch(p3+8);
6391da177e4SLinus Torvalds 		prefetch(p4+8);
6401da177e4SLinus Torvalds 		prefetch(p5+8);
6411da177e4SLinus Torvalds  once_more:
6421da177e4SLinus Torvalds 		d0 = p1[0];	/* Pull the stuff into registers	*/
6431da177e4SLinus Torvalds 		d1 = p1[1];	/*  ... in bursts, if possible.		*/
6441da177e4SLinus Torvalds 		d2 = p1[2];
6451da177e4SLinus Torvalds 		d3 = p1[3];
6461da177e4SLinus Torvalds 		d4 = p1[4];
6471da177e4SLinus Torvalds 		d5 = p1[5];
6481da177e4SLinus Torvalds 		d6 = p1[6];
6491da177e4SLinus Torvalds 		d7 = p1[7];
6501da177e4SLinus Torvalds 		d0 ^= p2[0];
6511da177e4SLinus Torvalds 		d1 ^= p2[1];
6521da177e4SLinus Torvalds 		d2 ^= p2[2];
6531da177e4SLinus Torvalds 		d3 ^= p2[3];
6541da177e4SLinus Torvalds 		d4 ^= p2[4];
6551da177e4SLinus Torvalds 		d5 ^= p2[5];
6561da177e4SLinus Torvalds 		d6 ^= p2[6];
6571da177e4SLinus Torvalds 		d7 ^= p2[7];
6581da177e4SLinus Torvalds 		d0 ^= p3[0];
6591da177e4SLinus Torvalds 		d1 ^= p3[1];
6601da177e4SLinus Torvalds 		d2 ^= p3[2];
6611da177e4SLinus Torvalds 		d3 ^= p3[3];
6621da177e4SLinus Torvalds 		d4 ^= p3[4];
6631da177e4SLinus Torvalds 		d5 ^= p3[5];
6641da177e4SLinus Torvalds 		d6 ^= p3[6];
6651da177e4SLinus Torvalds 		d7 ^= p3[7];
6661da177e4SLinus Torvalds 		d0 ^= p4[0];
6671da177e4SLinus Torvalds 		d1 ^= p4[1];
6681da177e4SLinus Torvalds 		d2 ^= p4[2];
6691da177e4SLinus Torvalds 		d3 ^= p4[3];
6701da177e4SLinus Torvalds 		d4 ^= p4[4];
6711da177e4SLinus Torvalds 		d5 ^= p4[5];
6721da177e4SLinus Torvalds 		d6 ^= p4[6];
6731da177e4SLinus Torvalds 		d7 ^= p4[7];
6741da177e4SLinus Torvalds 		d0 ^= p5[0];
6751da177e4SLinus Torvalds 		d1 ^= p5[1];
6761da177e4SLinus Torvalds 		d2 ^= p5[2];
6771da177e4SLinus Torvalds 		d3 ^= p5[3];
6781da177e4SLinus Torvalds 		d4 ^= p5[4];
6791da177e4SLinus Torvalds 		d5 ^= p5[5];
6801da177e4SLinus Torvalds 		d6 ^= p5[6];
6811da177e4SLinus Torvalds 		d7 ^= p5[7];
6821da177e4SLinus Torvalds 		p1[0] = d0;	/* Store the result (in bursts)		*/
6831da177e4SLinus Torvalds 		p1[1] = d1;
6841da177e4SLinus Torvalds 		p1[2] = d2;
6851da177e4SLinus Torvalds 		p1[3] = d3;
6861da177e4SLinus Torvalds 		p1[4] = d4;
6871da177e4SLinus Torvalds 		p1[5] = d5;
6881da177e4SLinus Torvalds 		p1[6] = d6;
6891da177e4SLinus Torvalds 		p1[7] = d7;
6901da177e4SLinus Torvalds 		p1 += 8;
6911da177e4SLinus Torvalds 		p2 += 8;
6921da177e4SLinus Torvalds 		p3 += 8;
6931da177e4SLinus Torvalds 		p4 += 8;
6941da177e4SLinus Torvalds 		p5 += 8;
6951da177e4SLinus Torvalds 	} while (--lines > 0);
6961da177e4SLinus Torvalds 	if (lines == 0)
6971da177e4SLinus Torvalds 		goto once_more;
6981da177e4SLinus Torvalds }
6991da177e4SLinus Torvalds 
7001da177e4SLinus Torvalds static struct xor_block_template xor_block_8regs = {
7011da177e4SLinus Torvalds 	.name = "8regs",
7021da177e4SLinus Torvalds 	.do_2 = xor_8regs_2,
7031da177e4SLinus Torvalds 	.do_3 = xor_8regs_3,
7041da177e4SLinus Torvalds 	.do_4 = xor_8regs_4,
7051da177e4SLinus Torvalds 	.do_5 = xor_8regs_5,
7061da177e4SLinus Torvalds };
7071da177e4SLinus Torvalds 
7081da177e4SLinus Torvalds static struct xor_block_template xor_block_32regs = {
7091da177e4SLinus Torvalds 	.name = "32regs",
7101da177e4SLinus Torvalds 	.do_2 = xor_32regs_2,
7111da177e4SLinus Torvalds 	.do_3 = xor_32regs_3,
7121da177e4SLinus Torvalds 	.do_4 = xor_32regs_4,
7131da177e4SLinus Torvalds 	.do_5 = xor_32regs_5,
7141da177e4SLinus Torvalds };
7151da177e4SLinus Torvalds 
716720fb197SArnd Bergmann static struct xor_block_template xor_block_8regs_p __maybe_unused = {
7171da177e4SLinus Torvalds 	.name = "8regs_prefetch",
7181da177e4SLinus Torvalds 	.do_2 = xor_8regs_p_2,
7191da177e4SLinus Torvalds 	.do_3 = xor_8regs_p_3,
7201da177e4SLinus Torvalds 	.do_4 = xor_8regs_p_4,
7211da177e4SLinus Torvalds 	.do_5 = xor_8regs_p_5,
7221da177e4SLinus Torvalds };
7231da177e4SLinus Torvalds 
724720fb197SArnd Bergmann static struct xor_block_template xor_block_32regs_p __maybe_unused = {
7251da177e4SLinus Torvalds 	.name = "32regs_prefetch",
7261da177e4SLinus Torvalds 	.do_2 = xor_32regs_p_2,
7271da177e4SLinus Torvalds 	.do_3 = xor_32regs_p_3,
7281da177e4SLinus Torvalds 	.do_4 = xor_32regs_p_4,
7291da177e4SLinus Torvalds 	.do_5 = xor_32regs_p_5,
7301da177e4SLinus Torvalds };
7311da177e4SLinus Torvalds 
7321da177e4SLinus Torvalds #define XOR_TRY_TEMPLATES			\
7331da177e4SLinus Torvalds 	do {					\
7341da177e4SLinus Torvalds 		xor_speed(&xor_block_8regs);	\
7351da177e4SLinus Torvalds 		xor_speed(&xor_block_8regs_p);	\
7361da177e4SLinus Torvalds 		xor_speed(&xor_block_32regs);	\
7371da177e4SLinus Torvalds 		xor_speed(&xor_block_32regs_p);	\
7381da177e4SLinus Torvalds 	} while (0)
739