1 // SPDX-License-Identifier: GPL-2.0-or-later 2 #include "xor_impl.h" 3 4 static void 5 xor_32regs_2(unsigned long bytes, unsigned long * __restrict p1, 6 const unsigned long * __restrict p2) 7 { 8 long lines = bytes / (sizeof (long)) / 8; 9 10 do { 11 register long d0, d1, d2, d3, d4, d5, d6, d7; 12 d0 = p1[0]; /* Pull the stuff into registers */ 13 d1 = p1[1]; /* ... in bursts, if possible. */ 14 d2 = p1[2]; 15 d3 = p1[3]; 16 d4 = p1[4]; 17 d5 = p1[5]; 18 d6 = p1[6]; 19 d7 = p1[7]; 20 d0 ^= p2[0]; 21 d1 ^= p2[1]; 22 d2 ^= p2[2]; 23 d3 ^= p2[3]; 24 d4 ^= p2[4]; 25 d5 ^= p2[5]; 26 d6 ^= p2[6]; 27 d7 ^= p2[7]; 28 p1[0] = d0; /* Store the result (in bursts) */ 29 p1[1] = d1; 30 p1[2] = d2; 31 p1[3] = d3; 32 p1[4] = d4; 33 p1[5] = d5; 34 p1[6] = d6; 35 p1[7] = d7; 36 p1 += 8; 37 p2 += 8; 38 } while (--lines > 0); 39 } 40 41 static void 42 xor_32regs_3(unsigned long bytes, unsigned long * __restrict p1, 43 const unsigned long * __restrict p2, 44 const unsigned long * __restrict p3) 45 { 46 long lines = bytes / (sizeof (long)) / 8; 47 48 do { 49 register long d0, d1, d2, d3, d4, d5, d6, d7; 50 d0 = p1[0]; /* Pull the stuff into registers */ 51 d1 = p1[1]; /* ... in bursts, if possible. */ 52 d2 = p1[2]; 53 d3 = p1[3]; 54 d4 = p1[4]; 55 d5 = p1[5]; 56 d6 = p1[6]; 57 d7 = p1[7]; 58 d0 ^= p2[0]; 59 d1 ^= p2[1]; 60 d2 ^= p2[2]; 61 d3 ^= p2[3]; 62 d4 ^= p2[4]; 63 d5 ^= p2[5]; 64 d6 ^= p2[6]; 65 d7 ^= p2[7]; 66 d0 ^= p3[0]; 67 d1 ^= p3[1]; 68 d2 ^= p3[2]; 69 d3 ^= p3[3]; 70 d4 ^= p3[4]; 71 d5 ^= p3[5]; 72 d6 ^= p3[6]; 73 d7 ^= p3[7]; 74 p1[0] = d0; /* Store the result (in bursts) */ 75 p1[1] = d1; 76 p1[2] = d2; 77 p1[3] = d3; 78 p1[4] = d4; 79 p1[5] = d5; 80 p1[6] = d6; 81 p1[7] = d7; 82 p1 += 8; 83 p2 += 8; 84 p3 += 8; 85 } while (--lines > 0); 86 } 87 88 static void 89 xor_32regs_4(unsigned long bytes, unsigned long * __restrict p1, 90 const unsigned long * __restrict p2, 91 const unsigned long * __restrict p3, 92 const unsigned long * __restrict p4) 93 { 94 long lines = bytes / (sizeof (long)) / 8; 95 96 do { 97 register long d0, d1, d2, d3, d4, d5, d6, d7; 98 d0 = p1[0]; /* Pull the stuff into registers */ 99 d1 = p1[1]; /* ... in bursts, if possible. */ 100 d2 = p1[2]; 101 d3 = p1[3]; 102 d4 = p1[4]; 103 d5 = p1[5]; 104 d6 = p1[6]; 105 d7 = p1[7]; 106 d0 ^= p2[0]; 107 d1 ^= p2[1]; 108 d2 ^= p2[2]; 109 d3 ^= p2[3]; 110 d4 ^= p2[4]; 111 d5 ^= p2[5]; 112 d6 ^= p2[6]; 113 d7 ^= p2[7]; 114 d0 ^= p3[0]; 115 d1 ^= p3[1]; 116 d2 ^= p3[2]; 117 d3 ^= p3[3]; 118 d4 ^= p3[4]; 119 d5 ^= p3[5]; 120 d6 ^= p3[6]; 121 d7 ^= p3[7]; 122 d0 ^= p4[0]; 123 d1 ^= p4[1]; 124 d2 ^= p4[2]; 125 d3 ^= p4[3]; 126 d4 ^= p4[4]; 127 d5 ^= p4[5]; 128 d6 ^= p4[6]; 129 d7 ^= p4[7]; 130 p1[0] = d0; /* Store the result (in bursts) */ 131 p1[1] = d1; 132 p1[2] = d2; 133 p1[3] = d3; 134 p1[4] = d4; 135 p1[5] = d5; 136 p1[6] = d6; 137 p1[7] = d7; 138 p1 += 8; 139 p2 += 8; 140 p3 += 8; 141 p4 += 8; 142 } while (--lines > 0); 143 } 144 145 static void 146 xor_32regs_5(unsigned long bytes, unsigned long * __restrict p1, 147 const unsigned long * __restrict p2, 148 const unsigned long * __restrict p3, 149 const unsigned long * __restrict p4, 150 const unsigned long * __restrict p5) 151 { 152 long lines = bytes / (sizeof (long)) / 8; 153 154 do { 155 register long d0, d1, d2, d3, d4, d5, d6, d7; 156 d0 = p1[0]; /* Pull the stuff into registers */ 157 d1 = p1[1]; /* ... in bursts, if possible. */ 158 d2 = p1[2]; 159 d3 = p1[3]; 160 d4 = p1[4]; 161 d5 = p1[5]; 162 d6 = p1[6]; 163 d7 = p1[7]; 164 d0 ^= p2[0]; 165 d1 ^= p2[1]; 166 d2 ^= p2[2]; 167 d3 ^= p2[3]; 168 d4 ^= p2[4]; 169 d5 ^= p2[5]; 170 d6 ^= p2[6]; 171 d7 ^= p2[7]; 172 d0 ^= p3[0]; 173 d1 ^= p3[1]; 174 d2 ^= p3[2]; 175 d3 ^= p3[3]; 176 d4 ^= p3[4]; 177 d5 ^= p3[5]; 178 d6 ^= p3[6]; 179 d7 ^= p3[7]; 180 d0 ^= p4[0]; 181 d1 ^= p4[1]; 182 d2 ^= p4[2]; 183 d3 ^= p4[3]; 184 d4 ^= p4[4]; 185 d5 ^= p4[5]; 186 d6 ^= p4[6]; 187 d7 ^= p4[7]; 188 d0 ^= p5[0]; 189 d1 ^= p5[1]; 190 d2 ^= p5[2]; 191 d3 ^= p5[3]; 192 d4 ^= p5[4]; 193 d5 ^= p5[5]; 194 d6 ^= p5[6]; 195 d7 ^= p5[7]; 196 p1[0] = d0; /* Store the result (in bursts) */ 197 p1[1] = d1; 198 p1[2] = d2; 199 p1[3] = d3; 200 p1[4] = d4; 201 p1[5] = d5; 202 p1[6] = d6; 203 p1[7] = d7; 204 p1 += 8; 205 p2 += 8; 206 p3 += 8; 207 p4 += 8; 208 p5 += 8; 209 } while (--lines > 0); 210 } 211 212 DO_XOR_BLOCKS(32regs, xor_32regs_2, xor_32regs_3, xor_32regs_4, xor_32regs_5); 213 214 struct xor_block_template xor_block_32regs = { 215 .name = "32regs", 216 .xor_gen = xor_gen_32regs, 217 }; 218