2 * include/asm-generic/xor.h
4 * Generic optimized RAID-5 checksumming functions.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
11 * You should have received a copy of the GNU General Public License
12 * (for example /usr/src/linux/COPYING); if not, write to the Free
13 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 xor_8regs_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
19 long lines = bytes / (sizeof (long)) / 8;
32 } while (--lines > 0);
36 xor_8regs_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
39 long lines = bytes / (sizeof (long)) / 8;
42 p1[0] ^= p2[0] ^ p3[0];
43 p1[1] ^= p2[1] ^ p3[1];
44 p1[2] ^= p2[2] ^ p3[2];
45 p1[3] ^= p2[3] ^ p3[3];
46 p1[4] ^= p2[4] ^ p3[4];
47 p1[5] ^= p2[5] ^ p3[5];
48 p1[6] ^= p2[6] ^ p3[6];
49 p1[7] ^= p2[7] ^ p3[7];
53 } while (--lines > 0);
57 xor_8regs_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
58 unsigned long *p3, unsigned long *p4)
60 long lines = bytes / (sizeof (long)) / 8;
63 p1[0] ^= p2[0] ^ p3[0] ^ p4[0];
64 p1[1] ^= p2[1] ^ p3[1] ^ p4[1];
65 p1[2] ^= p2[2] ^ p3[2] ^ p4[2];
66 p1[3] ^= p2[3] ^ p3[3] ^ p4[3];
67 p1[4] ^= p2[4] ^ p3[4] ^ p4[4];
68 p1[5] ^= p2[5] ^ p3[5] ^ p4[5];
69 p1[6] ^= p2[6] ^ p3[6] ^ p4[6];
70 p1[7] ^= p2[7] ^ p3[7] ^ p4[7];
75 } while (--lines > 0);
79 xor_8regs_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
80 unsigned long *p3, unsigned long *p4, unsigned long *p5)
82 long lines = bytes / (sizeof (long)) / 8;
85 p1[0] ^= p2[0] ^ p3[0] ^ p4[0] ^ p5[0];
86 p1[1] ^= p2[1] ^ p3[1] ^ p4[1] ^ p5[1];
87 p1[2] ^= p2[2] ^ p3[2] ^ p4[2] ^ p5[2];
88 p1[3] ^= p2[3] ^ p3[3] ^ p4[3] ^ p5[3];
89 p1[4] ^= p2[4] ^ p3[4] ^ p4[4] ^ p5[4];
90 p1[5] ^= p2[5] ^ p3[5] ^ p4[5] ^ p5[5];
91 p1[6] ^= p2[6] ^ p3[6] ^ p4[6] ^ p5[6];
92 p1[7] ^= p2[7] ^ p3[7] ^ p4[7] ^ p5[7];
98 } while (--lines > 0);
102 xor_32regs_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
104 long lines = bytes / (sizeof (long)) / 8;
107 register long d0, d1, d2, d3, d4, d5, d6, d7;
108 d0 = p1[0]; /* Pull the stuff into registers */
109 d1 = p1[1]; /* ... in bursts, if possible. */
124 p1[0] = d0; /* Store the result (in burts) */
134 } while (--lines > 0);
138 xor_32regs_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
141 long lines = bytes / (sizeof (long)) / 8;
144 register long d0, d1, d2, d3, d4, d5, d6, d7;
145 d0 = p1[0]; /* Pull the stuff into registers */
146 d1 = p1[1]; /* ... in bursts, if possible. */
169 p1[0] = d0; /* Store the result (in burts) */
180 } while (--lines > 0);
184 xor_32regs_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
185 unsigned long *p3, unsigned long *p4)
187 long lines = bytes / (sizeof (long)) / 8;
190 register long d0, d1, d2, d3, d4, d5, d6, d7;
191 d0 = p1[0]; /* Pull the stuff into registers */
192 d1 = p1[1]; /* ... in bursts, if possible. */
223 p1[0] = d0; /* Store the result (in burts) */
235 } while (--lines > 0);
239 xor_32regs_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
240 unsigned long *p3, unsigned long *p4, unsigned long *p5)
242 long lines = bytes / (sizeof (long)) / 8;
245 register long d0, d1, d2, d3, d4, d5, d6, d7;
246 d0 = p1[0]; /* Pull the stuff into registers */
247 d1 = p1[1]; /* ... in bursts, if possible. */
286 p1[0] = d0; /* Store the result (in burts) */
299 } while (--lines > 0);
302 static struct xor_block_template xor_block_8regs = {
310 static struct xor_block_template xor_block_32regs = {
318 #define XOR_TRY_TEMPLATES \
320 xor_speed(&xor_block_8regs); \
321 xor_speed(&xor_block_32regs); \