xor.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719
  1. /*
  2. * include/asm-generic/xor.h
  3. *
  4. * Generic optimized RAID-5 checksumming functions.
  5. *
  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)
  9. * any later version.
  10. *
  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.
  14. */
  15. #include <linux/prefetch.h>
  16. static void
  17. xor_8regs_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
  18. {
  19. long lines = bytes / (sizeof (long)) / 8;
  20. do {
  21. p1[0] ^= p2[0];
  22. p1[1] ^= p2[1];
  23. p1[2] ^= p2[2];
  24. p1[3] ^= p2[3];
  25. p1[4] ^= p2[4];
  26. p1[5] ^= p2[5];
  27. p1[6] ^= p2[6];
  28. p1[7] ^= p2[7];
  29. p1 += 8;
  30. p2 += 8;
  31. } while (--lines > 0);
  32. }
  33. static void
  34. xor_8regs_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  35. unsigned long *p3)
  36. {
  37. long lines = bytes / (sizeof (long)) / 8;
  38. do {
  39. p1[0] ^= p2[0] ^ p3[0];
  40. p1[1] ^= p2[1] ^ p3[1];
  41. p1[2] ^= p2[2] ^ p3[2];
  42. p1[3] ^= p2[3] ^ p3[3];
  43. p1[4] ^= p2[4] ^ p3[4];
  44. p1[5] ^= p2[5] ^ p3[5];
  45. p1[6] ^= p2[6] ^ p3[6];
  46. p1[7] ^= p2[7] ^ p3[7];
  47. p1 += 8;
  48. p2 += 8;
  49. p3 += 8;
  50. } while (--lines > 0);
  51. }
  52. static void
  53. xor_8regs_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  54. unsigned long *p3, unsigned long *p4)
  55. {
  56. long lines = bytes / (sizeof (long)) / 8;
  57. do {
  58. p1[0] ^= p2[0] ^ p3[0] ^ p4[0];
  59. p1[1] ^= p2[1] ^ p3[1] ^ p4[1];
  60. p1[2] ^= p2[2] ^ p3[2] ^ p4[2];
  61. p1[3] ^= p2[3] ^ p3[3] ^ p4[3];
  62. p1[4] ^= p2[4] ^ p3[4] ^ p4[4];
  63. p1[5] ^= p2[5] ^ p3[5] ^ p4[5];
  64. p1[6] ^= p2[6] ^ p3[6] ^ p4[6];
  65. p1[7] ^= p2[7] ^ p3[7] ^ p4[7];
  66. p1 += 8;
  67. p2 += 8;
  68. p3 += 8;
  69. p4 += 8;
  70. } while (--lines > 0);
  71. }
  72. static void
  73. xor_8regs_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  74. unsigned long *p3, unsigned long *p4, unsigned long *p5)
  75. {
  76. long lines = bytes / (sizeof (long)) / 8;
  77. do {
  78. p1[0] ^= p2[0] ^ p3[0] ^ p4[0] ^ p5[0];
  79. p1[1] ^= p2[1] ^ p3[1] ^ p4[1] ^ p5[1];
  80. p1[2] ^= p2[2] ^ p3[2] ^ p4[2] ^ p5[2];
  81. p1[3] ^= p2[3] ^ p3[3] ^ p4[3] ^ p5[3];
  82. p1[4] ^= p2[4] ^ p3[4] ^ p4[4] ^ p5[4];
  83. p1[5] ^= p2[5] ^ p3[5] ^ p4[5] ^ p5[5];
  84. p1[6] ^= p2[6] ^ p3[6] ^ p4[6] ^ p5[6];
  85. p1[7] ^= p2[7] ^ p3[7] ^ p4[7] ^ p5[7];
  86. p1 += 8;
  87. p2 += 8;
  88. p3 += 8;
  89. p4 += 8;
  90. p5 += 8;
  91. } while (--lines > 0);
  92. }
  93. static void
  94. xor_32regs_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
  95. {
  96. long lines = bytes / (sizeof (long)) / 8;
  97. do {
  98. register long d0, d1, d2, d3, d4, d5, d6, d7;
  99. d0 = p1[0]; /* Pull the stuff into registers */
  100. d1 = p1[1]; /* ... in bursts, if possible. */
  101. d2 = p1[2];
  102. d3 = p1[3];
  103. d4 = p1[4];
  104. d5 = p1[5];
  105. d6 = p1[6];
  106. d7 = p1[7];
  107. d0 ^= p2[0];
  108. d1 ^= p2[1];
  109. d2 ^= p2[2];
  110. d3 ^= p2[3];
  111. d4 ^= p2[4];
  112. d5 ^= p2[5];
  113. d6 ^= p2[6];
  114. d7 ^= p2[7];
  115. p1[0] = d0; /* Store the result (in bursts) */
  116. p1[1] = d1;
  117. p1[2] = d2;
  118. p1[3] = d3;
  119. p1[4] = d4;
  120. p1[5] = d5;
  121. p1[6] = d6;
  122. p1[7] = d7;
  123. p1 += 8;
  124. p2 += 8;
  125. } while (--lines > 0);
  126. }
  127. static void
  128. xor_32regs_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  129. unsigned long *p3)
  130. {
  131. long lines = bytes / (sizeof (long)) / 8;
  132. do {
  133. register long d0, d1, d2, d3, d4, d5, d6, d7;
  134. d0 = p1[0]; /* Pull the stuff into registers */
  135. d1 = p1[1]; /* ... in bursts, if possible. */
  136. d2 = p1[2];
  137. d3 = p1[3];
  138. d4 = p1[4];
  139. d5 = p1[5];
  140. d6 = p1[6];
  141. d7 = p1[7];
  142. d0 ^= p2[0];
  143. d1 ^= p2[1];
  144. d2 ^= p2[2];
  145. d3 ^= p2[3];
  146. d4 ^= p2[4];
  147. d5 ^= p2[5];
  148. d6 ^= p2[6];
  149. d7 ^= p2[7];
  150. d0 ^= p3[0];
  151. d1 ^= p3[1];
  152. d2 ^= p3[2];
  153. d3 ^= p3[3];
  154. d4 ^= p3[4];
  155. d5 ^= p3[5];
  156. d6 ^= p3[6];
  157. d7 ^= p3[7];
  158. p1[0] = d0; /* Store the result (in bursts) */
  159. p1[1] = d1;
  160. p1[2] = d2;
  161. p1[3] = d3;
  162. p1[4] = d4;
  163. p1[5] = d5;
  164. p1[6] = d6;
  165. p1[7] = d7;
  166. p1 += 8;
  167. p2 += 8;
  168. p3 += 8;
  169. } while (--lines > 0);
  170. }
  171. static void
  172. xor_32regs_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  173. unsigned long *p3, unsigned long *p4)
  174. {
  175. long lines = bytes / (sizeof (long)) / 8;
  176. do {
  177. register long d0, d1, d2, d3, d4, d5, d6, d7;
  178. d0 = p1[0]; /* Pull the stuff into registers */
  179. d1 = p1[1]; /* ... in bursts, if possible. */
  180. d2 = p1[2];
  181. d3 = p1[3];
  182. d4 = p1[4];
  183. d5 = p1[5];
  184. d6 = p1[6];
  185. d7 = p1[7];
  186. d0 ^= p2[0];
  187. d1 ^= p2[1];
  188. d2 ^= p2[2];
  189. d3 ^= p2[3];
  190. d4 ^= p2[4];
  191. d5 ^= p2[5];
  192. d6 ^= p2[6];
  193. d7 ^= p2[7];
  194. d0 ^= p3[0];
  195. d1 ^= p3[1];
  196. d2 ^= p3[2];
  197. d3 ^= p3[3];
  198. d4 ^= p3[4];
  199. d5 ^= p3[5];
  200. d6 ^= p3[6];
  201. d7 ^= p3[7];
  202. d0 ^= p4[0];
  203. d1 ^= p4[1];
  204. d2 ^= p4[2];
  205. d3 ^= p4[3];
  206. d4 ^= p4[4];
  207. d5 ^= p4[5];
  208. d6 ^= p4[6];
  209. d7 ^= p4[7];
  210. p1[0] = d0; /* Store the result (in bursts) */
  211. p1[1] = d1;
  212. p1[2] = d2;
  213. p1[3] = d3;
  214. p1[4] = d4;
  215. p1[5] = d5;
  216. p1[6] = d6;
  217. p1[7] = d7;
  218. p1 += 8;
  219. p2 += 8;
  220. p3 += 8;
  221. p4 += 8;
  222. } while (--lines > 0);
  223. }
  224. static void
  225. xor_32regs_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  226. unsigned long *p3, unsigned long *p4, unsigned long *p5)
  227. {
  228. long lines = bytes / (sizeof (long)) / 8;
  229. do {
  230. register long d0, d1, d2, d3, d4, d5, d6, d7;
  231. d0 = p1[0]; /* Pull the stuff into registers */
  232. d1 = p1[1]; /* ... in bursts, if possible. */
  233. d2 = p1[2];
  234. d3 = p1[3];
  235. d4 = p1[4];
  236. d5 = p1[5];
  237. d6 = p1[6];
  238. d7 = p1[7];
  239. d0 ^= p2[0];
  240. d1 ^= p2[1];
  241. d2 ^= p2[2];
  242. d3 ^= p2[3];
  243. d4 ^= p2[4];
  244. d5 ^= p2[5];
  245. d6 ^= p2[6];
  246. d7 ^= p2[7];
  247. d0 ^= p3[0];
  248. d1 ^= p3[1];
  249. d2 ^= p3[2];
  250. d3 ^= p3[3];
  251. d4 ^= p3[4];
  252. d5 ^= p3[5];
  253. d6 ^= p3[6];
  254. d7 ^= p3[7];
  255. d0 ^= p4[0];
  256. d1 ^= p4[1];
  257. d2 ^= p4[2];
  258. d3 ^= p4[3];
  259. d4 ^= p4[4];
  260. d5 ^= p4[5];
  261. d6 ^= p4[6];
  262. d7 ^= p4[7];
  263. d0 ^= p5[0];
  264. d1 ^= p5[1];
  265. d2 ^= p5[2];
  266. d3 ^= p5[3];
  267. d4 ^= p5[4];
  268. d5 ^= p5[5];
  269. d6 ^= p5[6];
  270. d7 ^= p5[7];
  271. p1[0] = d0; /* Store the result (in bursts) */
  272. p1[1] = d1;
  273. p1[2] = d2;
  274. p1[3] = d3;
  275. p1[4] = d4;
  276. p1[5] = d5;
  277. p1[6] = d6;
  278. p1[7] = d7;
  279. p1 += 8;
  280. p2 += 8;
  281. p3 += 8;
  282. p4 += 8;
  283. p5 += 8;
  284. } while (--lines > 0);
  285. }
  286. static void
  287. xor_8regs_p_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
  288. {
  289. long lines = bytes / (sizeof (long)) / 8 - 1;
  290. prefetchw(p1);
  291. prefetch(p2);
  292. do {
  293. prefetchw(p1+8);
  294. prefetch(p2+8);
  295. once_more:
  296. p1[0] ^= p2[0];
  297. p1[1] ^= p2[1];
  298. p1[2] ^= p2[2];
  299. p1[3] ^= p2[3];
  300. p1[4] ^= p2[4];
  301. p1[5] ^= p2[5];
  302. p1[6] ^= p2[6];
  303. p1[7] ^= p2[7];
  304. p1 += 8;
  305. p2 += 8;
  306. } while (--lines > 0);
  307. if (lines == 0)
  308. goto once_more;
  309. }
  310. static void
  311. xor_8regs_p_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  312. unsigned long *p3)
  313. {
  314. long lines = bytes / (sizeof (long)) / 8 - 1;
  315. prefetchw(p1);
  316. prefetch(p2);
  317. prefetch(p3);
  318. do {
  319. prefetchw(p1+8);
  320. prefetch(p2+8);
  321. prefetch(p3+8);
  322. once_more:
  323. p1[0] ^= p2[0] ^ p3[0];
  324. p1[1] ^= p2[1] ^ p3[1];
  325. p1[2] ^= p2[2] ^ p3[2];
  326. p1[3] ^= p2[3] ^ p3[3];
  327. p1[4] ^= p2[4] ^ p3[4];
  328. p1[5] ^= p2[5] ^ p3[5];
  329. p1[6] ^= p2[6] ^ p3[6];
  330. p1[7] ^= p2[7] ^ p3[7];
  331. p1 += 8;
  332. p2 += 8;
  333. p3 += 8;
  334. } while (--lines > 0);
  335. if (lines == 0)
  336. goto once_more;
  337. }
  338. static void
  339. xor_8regs_p_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  340. unsigned long *p3, unsigned long *p4)
  341. {
  342. long lines = bytes / (sizeof (long)) / 8 - 1;
  343. prefetchw(p1);
  344. prefetch(p2);
  345. prefetch(p3);
  346. prefetch(p4);
  347. do {
  348. prefetchw(p1+8);
  349. prefetch(p2+8);
  350. prefetch(p3+8);
  351. prefetch(p4+8);
  352. once_more:
  353. p1[0] ^= p2[0] ^ p3[0] ^ p4[0];
  354. p1[1] ^= p2[1] ^ p3[1] ^ p4[1];
  355. p1[2] ^= p2[2] ^ p3[2] ^ p4[2];
  356. p1[3] ^= p2[3] ^ p3[3] ^ p4[3];
  357. p1[4] ^= p2[4] ^ p3[4] ^ p4[4];
  358. p1[5] ^= p2[5] ^ p3[5] ^ p4[5];
  359. p1[6] ^= p2[6] ^ p3[6] ^ p4[6];
  360. p1[7] ^= p2[7] ^ p3[7] ^ p4[7];
  361. p1 += 8;
  362. p2 += 8;
  363. p3 += 8;
  364. p4 += 8;
  365. } while (--lines > 0);
  366. if (lines == 0)
  367. goto once_more;
  368. }
  369. static void
  370. xor_8regs_p_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  371. unsigned long *p3, unsigned long *p4, unsigned long *p5)
  372. {
  373. long lines = bytes / (sizeof (long)) / 8 - 1;
  374. prefetchw(p1);
  375. prefetch(p2);
  376. prefetch(p3);
  377. prefetch(p4);
  378. prefetch(p5);
  379. do {
  380. prefetchw(p1+8);
  381. prefetch(p2+8);
  382. prefetch(p3+8);
  383. prefetch(p4+8);
  384. prefetch(p5+8);
  385. once_more:
  386. p1[0] ^= p2[0] ^ p3[0] ^ p4[0] ^ p5[0];
  387. p1[1] ^= p2[1] ^ p3[1] ^ p4[1] ^ p5[1];
  388. p1[2] ^= p2[2] ^ p3[2] ^ p4[2] ^ p5[2];
  389. p1[3] ^= p2[3] ^ p3[3] ^ p4[3] ^ p5[3];
  390. p1[4] ^= p2[4] ^ p3[4] ^ p4[4] ^ p5[4];
  391. p1[5] ^= p2[5] ^ p3[5] ^ p4[5] ^ p5[5];
  392. p1[6] ^= p2[6] ^ p3[6] ^ p4[6] ^ p5[6];
  393. p1[7] ^= p2[7] ^ p3[7] ^ p4[7] ^ p5[7];
  394. p1 += 8;
  395. p2 += 8;
  396. p3 += 8;
  397. p4 += 8;
  398. p5 += 8;
  399. } while (--lines > 0);
  400. if (lines == 0)
  401. goto once_more;
  402. }
  403. static void
  404. xor_32regs_p_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
  405. {
  406. long lines = bytes / (sizeof (long)) / 8 - 1;
  407. prefetchw(p1);
  408. prefetch(p2);
  409. do {
  410. register long d0, d1, d2, d3, d4, d5, d6, d7;
  411. prefetchw(p1+8);
  412. prefetch(p2+8);
  413. once_more:
  414. d0 = p1[0]; /* Pull the stuff into registers */
  415. d1 = p1[1]; /* ... in bursts, if possible. */
  416. d2 = p1[2];
  417. d3 = p1[3];
  418. d4 = p1[4];
  419. d5 = p1[5];
  420. d6 = p1[6];
  421. d7 = p1[7];
  422. d0 ^= p2[0];
  423. d1 ^= p2[1];
  424. d2 ^= p2[2];
  425. d3 ^= p2[3];
  426. d4 ^= p2[4];
  427. d5 ^= p2[5];
  428. d6 ^= p2[6];
  429. d7 ^= p2[7];
  430. p1[0] = d0; /* Store the result (in bursts) */
  431. p1[1] = d1;
  432. p1[2] = d2;
  433. p1[3] = d3;
  434. p1[4] = d4;
  435. p1[5] = d5;
  436. p1[6] = d6;
  437. p1[7] = d7;
  438. p1 += 8;
  439. p2 += 8;
  440. } while (--lines > 0);
  441. if (lines == 0)
  442. goto once_more;
  443. }
  444. static void
  445. xor_32regs_p_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  446. unsigned long *p3)
  447. {
  448. long lines = bytes / (sizeof (long)) / 8 - 1;
  449. prefetchw(p1);
  450. prefetch(p2);
  451. prefetch(p3);
  452. do {
  453. register long d0, d1, d2, d3, d4, d5, d6, d7;
  454. prefetchw(p1+8);
  455. prefetch(p2+8);
  456. prefetch(p3+8);
  457. once_more:
  458. d0 = p1[0]; /* Pull the stuff into registers */
  459. d1 = p1[1]; /* ... in bursts, if possible. */
  460. d2 = p1[2];
  461. d3 = p1[3];
  462. d4 = p1[4];
  463. d5 = p1[5];
  464. d6 = p1[6];
  465. d7 = p1[7];
  466. d0 ^= p2[0];
  467. d1 ^= p2[1];
  468. d2 ^= p2[2];
  469. d3 ^= p2[3];
  470. d4 ^= p2[4];
  471. d5 ^= p2[5];
  472. d6 ^= p2[6];
  473. d7 ^= p2[7];
  474. d0 ^= p3[0];
  475. d1 ^= p3[1];
  476. d2 ^= p3[2];
  477. d3 ^= p3[3];
  478. d4 ^= p3[4];
  479. d5 ^= p3[5];
  480. d6 ^= p3[6];
  481. d7 ^= p3[7];
  482. p1[0] = d0; /* Store the result (in bursts) */
  483. p1[1] = d1;
  484. p1[2] = d2;
  485. p1[3] = d3;
  486. p1[4] = d4;
  487. p1[5] = d5;
  488. p1[6] = d6;
  489. p1[7] = d7;
  490. p1 += 8;
  491. p2 += 8;
  492. p3 += 8;
  493. } while (--lines > 0);
  494. if (lines == 0)
  495. goto once_more;
  496. }
  497. static void
  498. xor_32regs_p_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  499. unsigned long *p3, unsigned long *p4)
  500. {
  501. long lines = bytes / (sizeof (long)) / 8 - 1;
  502. prefetchw(p1);
  503. prefetch(p2);
  504. prefetch(p3);
  505. prefetch(p4);
  506. do {
  507. register long d0, d1, d2, d3, d4, d5, d6, d7;
  508. prefetchw(p1+8);
  509. prefetch(p2+8);
  510. prefetch(p3+8);
  511. prefetch(p4+8);
  512. once_more:
  513. d0 = p1[0]; /* Pull the stuff into registers */
  514. d1 = p1[1]; /* ... in bursts, if possible. */
  515. d2 = p1[2];
  516. d3 = p1[3];
  517. d4 = p1[4];
  518. d5 = p1[5];
  519. d6 = p1[6];
  520. d7 = p1[7];
  521. d0 ^= p2[0];
  522. d1 ^= p2[1];
  523. d2 ^= p2[2];
  524. d3 ^= p2[3];
  525. d4 ^= p2[4];
  526. d5 ^= p2[5];
  527. d6 ^= p2[6];
  528. d7 ^= p2[7];
  529. d0 ^= p3[0];
  530. d1 ^= p3[1];
  531. d2 ^= p3[2];
  532. d3 ^= p3[3];
  533. d4 ^= p3[4];
  534. d5 ^= p3[5];
  535. d6 ^= p3[6];
  536. d7 ^= p3[7];
  537. d0 ^= p4[0];
  538. d1 ^= p4[1];
  539. d2 ^= p4[2];
  540. d3 ^= p4[3];
  541. d4 ^= p4[4];
  542. d5 ^= p4[5];
  543. d6 ^= p4[6];
  544. d7 ^= p4[7];
  545. p1[0] = d0; /* Store the result (in bursts) */
  546. p1[1] = d1;
  547. p1[2] = d2;
  548. p1[3] = d3;
  549. p1[4] = d4;
  550. p1[5] = d5;
  551. p1[6] = d6;
  552. p1[7] = d7;
  553. p1 += 8;
  554. p2 += 8;
  555. p3 += 8;
  556. p4 += 8;
  557. } while (--lines > 0);
  558. if (lines == 0)
  559. goto once_more;
  560. }
  561. static void
  562. xor_32regs_p_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
  563. unsigned long *p3, unsigned long *p4, unsigned long *p5)
  564. {
  565. long lines = bytes / (sizeof (long)) / 8 - 1;
  566. prefetchw(p1);
  567. prefetch(p2);
  568. prefetch(p3);
  569. prefetch(p4);
  570. prefetch(p5);
  571. do {
  572. register long d0, d1, d2, d3, d4, d5, d6, d7;
  573. prefetchw(p1+8);
  574. prefetch(p2+8);
  575. prefetch(p3+8);
  576. prefetch(p4+8);
  577. prefetch(p5+8);
  578. once_more:
  579. d0 = p1[0]; /* Pull the stuff into registers */
  580. d1 = p1[1]; /* ... in bursts, if possible. */
  581. d2 = p1[2];
  582. d3 = p1[3];
  583. d4 = p1[4];
  584. d5 = p1[5];
  585. d6 = p1[6];
  586. d7 = p1[7];
  587. d0 ^= p2[0];
  588. d1 ^= p2[1];
  589. d2 ^= p2[2];
  590. d3 ^= p2[3];
  591. d4 ^= p2[4];
  592. d5 ^= p2[5];
  593. d6 ^= p2[6];
  594. d7 ^= p2[7];
  595. d0 ^= p3[0];
  596. d1 ^= p3[1];
  597. d2 ^= p3[2];
  598. d3 ^= p3[3];
  599. d4 ^= p3[4];
  600. d5 ^= p3[5];
  601. d6 ^= p3[6];
  602. d7 ^= p3[7];
  603. d0 ^= p4[0];
  604. d1 ^= p4[1];
  605. d2 ^= p4[2];
  606. d3 ^= p4[3];
  607. d4 ^= p4[4];
  608. d5 ^= p4[5];
  609. d6 ^= p4[6];
  610. d7 ^= p4[7];
  611. d0 ^= p5[0];
  612. d1 ^= p5[1];
  613. d2 ^= p5[2];
  614. d3 ^= p5[3];
  615. d4 ^= p5[4];
  616. d5 ^= p5[5];
  617. d6 ^= p5[6];
  618. d7 ^= p5[7];
  619. p1[0] = d0; /* Store the result (in bursts) */
  620. p1[1] = d1;
  621. p1[2] = d2;
  622. p1[3] = d3;
  623. p1[4] = d4;
  624. p1[5] = d5;
  625. p1[6] = d6;
  626. p1[7] = d7;
  627. p1 += 8;
  628. p2 += 8;
  629. p3 += 8;
  630. p4 += 8;
  631. p5 += 8;
  632. } while (--lines > 0);
  633. if (lines == 0)
  634. goto once_more;
  635. }
  636. static struct xor_block_template xor_block_8regs = {
  637. .name = "8regs",
  638. .do_2 = xor_8regs_2,
  639. .do_3 = xor_8regs_3,
  640. .do_4 = xor_8regs_4,
  641. .do_5 = xor_8regs_5,
  642. };
  643. static struct xor_block_template xor_block_32regs = {
  644. .name = "32regs",
  645. .do_2 = xor_32regs_2,
  646. .do_3 = xor_32regs_3,
  647. .do_4 = xor_32regs_4,
  648. .do_5 = xor_32regs_5,
  649. };
  650. static struct xor_block_template xor_block_8regs_p __maybe_unused = {
  651. .name = "8regs_prefetch",
  652. .do_2 = xor_8regs_p_2,
  653. .do_3 = xor_8regs_p_3,
  654. .do_4 = xor_8regs_p_4,
  655. .do_5 = xor_8regs_p_5,
  656. };
  657. static struct xor_block_template xor_block_32regs_p __maybe_unused = {
  658. .name = "32regs_prefetch",
  659. .do_2 = xor_32regs_p_2,
  660. .do_3 = xor_32regs_p_3,
  661. .do_4 = xor_32regs_p_4,
  662. .do_5 = xor_32regs_p_5,
  663. };
  664. #define XOR_TRY_TEMPLATES \
  665. do { \
  666. xor_speed(&xor_block_8regs); \
  667. xor_speed(&xor_block_8regs_p); \
  668. xor_speed(&xor_block_32regs); \
  669. xor_speed(&xor_block_32regs_p); \
  670. } while (0)