1 // SPDX-License-Identifier: GPL-2.0-or-later 2 #include <linux/raid/xor_impl.h> 3 #include <asm-generic/xor.h> 4 5 static void 6 xor_8regs_2(unsigned long bytes, unsigned long * __restrict p1, 7 const unsigned long * __restrict p2) 8 { 9 long lines = bytes / (sizeof (long)) / 8; 10 11 do { 12 p1[0] ^= p2[0]; 13 p1[1] ^= p2[1]; 14 p1[2] ^= p2[2]; 15 p1[3] ^= p2[3]; 16 p1[4] ^= p2[4]; 17 p1[5] ^= p2[5]; 18 p1[6] ^= p2[6]; 19 p1[7] ^= p2[7]; 20 p1 += 8; 21 p2 += 8; 22 } while (--lines > 0); 23 } 24 25 static void 26 xor_8regs_3(unsigned long bytes, unsigned long * __restrict p1, 27 const unsigned long * __restrict p2, 28 const unsigned long * __restrict p3) 29 { 30 long lines = bytes / (sizeof (long)) / 8; 31 32 do { 33 p1[0] ^= p2[0] ^ p3[0]; 34 p1[1] ^= p2[1] ^ p3[1]; 35 p1[2] ^= p2[2] ^ p3[2]; 36 p1[3] ^= p2[3] ^ p3[3]; 37 p1[4] ^= p2[4] ^ p3[4]; 38 p1[5] ^= p2[5] ^ p3[5]; 39 p1[6] ^= p2[6] ^ p3[6]; 40 p1[7] ^= p2[7] ^ p3[7]; 41 p1 += 8; 42 p2 += 8; 43 p3 += 8; 44 } while (--lines > 0); 45 } 46 47 static void 48 xor_8regs_4(unsigned long bytes, unsigned long * __restrict p1, 49 const unsigned long * __restrict p2, 50 const unsigned long * __restrict p3, 51 const unsigned long * __restrict p4) 52 { 53 long lines = bytes / (sizeof (long)) / 8; 54 55 do { 56 p1[0] ^= p2[0] ^ p3[0] ^ p4[0]; 57 p1[1] ^= p2[1] ^ p3[1] ^ p4[1]; 58 p1[2] ^= p2[2] ^ p3[2] ^ p4[2]; 59 p1[3] ^= p2[3] ^ p3[3] ^ p4[3]; 60 p1[4] ^= p2[4] ^ p3[4] ^ p4[4]; 61 p1[5] ^= p2[5] ^ p3[5] ^ p4[5]; 62 p1[6] ^= p2[6] ^ p3[6] ^ p4[6]; 63 p1[7] ^= p2[7] ^ p3[7] ^ p4[7]; 64 p1 += 8; 65 p2 += 8; 66 p3 += 8; 67 p4 += 8; 68 } while (--lines > 0); 69 } 70 71 static void 72 xor_8regs_5(unsigned long bytes, unsigned long * __restrict p1, 73 const unsigned long * __restrict p2, 74 const unsigned long * __restrict p3, 75 const unsigned long * __restrict p4, 76 const unsigned long * __restrict p5) 77 { 78 long lines = bytes / (sizeof (long)) / 8; 79 80 do { 81 p1[0] ^= p2[0] ^ p3[0] ^ p4[0] ^ p5[0]; 82 p1[1] ^= p2[1] ^ p3[1] ^ p4[1] ^ p5[1]; 83 p1[2] ^= p2[2] ^ p3[2] ^ p4[2] ^ p5[2]; 84 p1[3] ^= p2[3] ^ p3[3] ^ p4[3] ^ p5[3]; 85 p1[4] ^= p2[4] ^ p3[4] ^ p4[4] ^ p5[4]; 86 p1[5] ^= p2[5] ^ p3[5] ^ p4[5] ^ p5[5]; 87 p1[6] ^= p2[6] ^ p3[6] ^ p4[6] ^ p5[6]; 88 p1[7] ^= p2[7] ^ p3[7] ^ p4[7] ^ p5[7]; 89 p1 += 8; 90 p2 += 8; 91 p3 += 8; 92 p4 += 8; 93 p5 += 8; 94 } while (--lines > 0); 95 } 96 97 #ifndef NO_TEMPLATE 98 struct xor_block_template xor_block_8regs = { 99 .name = "8regs", 100 .do_2 = xor_8regs_2, 101 .do_3 = xor_8regs_3, 102 .do_4 = xor_8regs_4, 103 .do_5 = xor_8regs_5, 104 }; 105 #endif /* NO_TEMPLATE */ 106