crc32c_ppc_asm.S 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752
  1. // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
  2. // Copyright (c) 2015 Anton Blanchard <anton@au.ibm.com>, IBM
  3. // Copyright (c) 2017 International Business Machines Corp.
  4. // All rights reserved.
  5. // This source code is licensed under both the GPLv2 (found in the
  6. // COPYING file in the root directory) and Apache 2.0 License
  7. // (found in the LICENSE.Apache file in the root directory).
  8. #include <ppc-asm.h>
  9. #include "ppc-opcode.h"
  10. #undef toc
  11. #ifndef r1
  12. #define r1 1
  13. #endif
  14. #ifndef r2
  15. #define r2 2
  16. #endif
  17. .section .rodata
  18. .balign 16
  19. .byteswap_constant:
  20. /* byte reverse permute constant */
  21. .octa 0x0F0E0D0C0B0A09080706050403020100
  22. #define __ASSEMBLY__
  23. #include "crc32c_ppc_constants.h"
  24. .text
  25. #if defined(__BIG_ENDIAN__) && defined(REFLECT)
  26. #define BYTESWAP_DATA
  27. #elif defined(__LITTLE_ENDIAN__) && !defined(REFLECT)
  28. #define BYTESWAP_DATA
  29. #else
  30. #undef BYTESWAP_DATA
  31. #endif
  32. #define off16 r25
  33. #define off32 r26
  34. #define off48 r27
  35. #define off64 r28
  36. #define off80 r29
  37. #define off96 r30
  38. #define off112 r31
  39. #define const1 v24
  40. #define const2 v25
  41. #define byteswap v26
  42. #define mask_32bit v27
  43. #define mask_64bit v28
  44. #define zeroes v29
  45. #ifdef BYTESWAP_DATA
  46. #define VPERM(A, B, C, D) vperm A, B, C, D
  47. #else
  48. #define VPERM(A, B, C, D)
  49. #endif
  50. /* unsigned int __crc32_vpmsum(unsigned int crc, void *p, unsigned long len) */
  51. FUNC_START(__crc32_vpmsum)
  52. std r31,-8(r1)
  53. std r30,-16(r1)
  54. std r29,-24(r1)
  55. std r28,-32(r1)
  56. std r27,-40(r1)
  57. std r26,-48(r1)
  58. std r25,-56(r1)
  59. li off16,16
  60. li off32,32
  61. li off48,48
  62. li off64,64
  63. li off80,80
  64. li off96,96
  65. li off112,112
  66. li r0,0
  67. /* Enough room for saving 10 non volatile VMX registers */
  68. subi r6,r1,56+10*16
  69. subi r7,r1,56+2*16
  70. stvx v20,0,r6
  71. stvx v21,off16,r6
  72. stvx v22,off32,r6
  73. stvx v23,off48,r6
  74. stvx v24,off64,r6
  75. stvx v25,off80,r6
  76. stvx v26,off96,r6
  77. stvx v27,off112,r6
  78. stvx v28,0,r7
  79. stvx v29,off16,r7
  80. mr r10,r3
  81. vxor zeroes,zeroes,zeroes
  82. vspltisw v0,-1
  83. vsldoi mask_32bit,zeroes,v0,4
  84. vsldoi mask_64bit,zeroes,v0,8
  85. /* Get the initial value into v8 */
  86. vxor v8,v8,v8
  87. MTVRD(v8, r3)
  88. #ifdef REFLECT
  89. vsldoi v8,zeroes,v8,8 /* shift into bottom 32 bits */
  90. #else
  91. vsldoi v8,v8,zeroes,4 /* shift into top 32 bits */
  92. #endif
  93. #ifdef BYTESWAP_DATA
  94. addis r3,r2,.byteswap_constant@toc@ha
  95. addi r3,r3,.byteswap_constant@toc@l
  96. lvx byteswap,0,r3
  97. addi r3,r3,16
  98. #endif
  99. cmpdi r5,256
  100. blt .Lshort
  101. rldicr r6,r5,0,56
  102. /* Checksum in blocks of MAX_SIZE */
  103. 1: lis r7,MAX_SIZE@h
  104. ori r7,r7,MAX_SIZE@l
  105. mr r9,r7
  106. cmpd r6,r7
  107. bgt 2f
  108. mr r7,r6
  109. 2: subf r6,r7,r6
  110. /* our main loop does 128 bytes at a time */
  111. srdi r7,r7,7
  112. /*
  113. * Work out the offset into the constants table to start at. Each
  114. * constant is 16 bytes, and it is used against 128 bytes of input
  115. * data - 128 / 16 = 8
  116. */
  117. sldi r8,r7,4
  118. srdi r9,r9,3
  119. subf r8,r8,r9
  120. /* We reduce our final 128 bytes in a separate step */
  121. addi r7,r7,-1
  122. mtctr r7
  123. addis r3,r2,.constants@toc@ha
  124. addi r3,r3,.constants@toc@l
  125. /* Find the start of our constants */
  126. add r3,r3,r8
  127. /* zero v0-v7 which will contain our checksums */
  128. vxor v0,v0,v0
  129. vxor v1,v1,v1
  130. vxor v2,v2,v2
  131. vxor v3,v3,v3
  132. vxor v4,v4,v4
  133. vxor v5,v5,v5
  134. vxor v6,v6,v6
  135. vxor v7,v7,v7
  136. lvx const1,0,r3
  137. /*
  138. * If we are looping back to consume more data we use the values
  139. * already in v16-v23.
  140. */
  141. cmpdi r0,1
  142. beq 2f
  143. /* First warm up pass */
  144. lvx v16,0,r4
  145. lvx v17,off16,r4
  146. VPERM(v16,v16,v16,byteswap)
  147. VPERM(v17,v17,v17,byteswap)
  148. lvx v18,off32,r4
  149. lvx v19,off48,r4
  150. VPERM(v18,v18,v18,byteswap)
  151. VPERM(v19,v19,v19,byteswap)
  152. lvx v20,off64,r4
  153. lvx v21,off80,r4
  154. VPERM(v20,v20,v20,byteswap)
  155. VPERM(v21,v21,v21,byteswap)
  156. lvx v22,off96,r4
  157. lvx v23,off112,r4
  158. VPERM(v22,v22,v22,byteswap)
  159. VPERM(v23,v23,v23,byteswap)
  160. addi r4,r4,8*16
  161. /* xor in initial value */
  162. vxor v16,v16,v8
  163. 2: bdz .Lfirst_warm_up_done
  164. addi r3,r3,16
  165. lvx const2,0,r3
  166. /* Second warm up pass */
  167. VPMSUMD(v8,v16,const1)
  168. lvx v16,0,r4
  169. VPERM(v16,v16,v16,byteswap)
  170. ori r2,r2,0
  171. VPMSUMD(v9,v17,const1)
  172. lvx v17,off16,r4
  173. VPERM(v17,v17,v17,byteswap)
  174. ori r2,r2,0
  175. VPMSUMD(v10,v18,const1)
  176. lvx v18,off32,r4
  177. VPERM(v18,v18,v18,byteswap)
  178. ori r2,r2,0
  179. VPMSUMD(v11,v19,const1)
  180. lvx v19,off48,r4
  181. VPERM(v19,v19,v19,byteswap)
  182. ori r2,r2,0
  183. VPMSUMD(v12,v20,const1)
  184. lvx v20,off64,r4
  185. VPERM(v20,v20,v20,byteswap)
  186. ori r2,r2,0
  187. VPMSUMD(v13,v21,const1)
  188. lvx v21,off80,r4
  189. VPERM(v21,v21,v21,byteswap)
  190. ori r2,r2,0
  191. VPMSUMD(v14,v22,const1)
  192. lvx v22,off96,r4
  193. VPERM(v22,v22,v22,byteswap)
  194. ori r2,r2,0
  195. VPMSUMD(v15,v23,const1)
  196. lvx v23,off112,r4
  197. VPERM(v23,v23,v23,byteswap)
  198. addi r4,r4,8*16
  199. bdz .Lfirst_cool_down
  200. /*
  201. * main loop. We modulo schedule it such that it takes three iterations
  202. * to complete - first iteration load, second iteration vpmsum, third
  203. * iteration xor.
  204. */
  205. .balign 16
  206. 4: lvx const1,0,r3
  207. addi r3,r3,16
  208. ori r2,r2,0
  209. vxor v0,v0,v8
  210. VPMSUMD(v8,v16,const2)
  211. lvx v16,0,r4
  212. VPERM(v16,v16,v16,byteswap)
  213. ori r2,r2,0
  214. vxor v1,v1,v9
  215. VPMSUMD(v9,v17,const2)
  216. lvx v17,off16,r4
  217. VPERM(v17,v17,v17,byteswap)
  218. ori r2,r2,0
  219. vxor v2,v2,v10
  220. VPMSUMD(v10,v18,const2)
  221. lvx v18,off32,r4
  222. VPERM(v18,v18,v18,byteswap)
  223. ori r2,r2,0
  224. vxor v3,v3,v11
  225. VPMSUMD(v11,v19,const2)
  226. lvx v19,off48,r4
  227. VPERM(v19,v19,v19,byteswap)
  228. lvx const2,0,r3
  229. ori r2,r2,0
  230. vxor v4,v4,v12
  231. VPMSUMD(v12,v20,const1)
  232. lvx v20,off64,r4
  233. VPERM(v20,v20,v20,byteswap)
  234. ori r2,r2,0
  235. vxor v5,v5,v13
  236. VPMSUMD(v13,v21,const1)
  237. lvx v21,off80,r4
  238. VPERM(v21,v21,v21,byteswap)
  239. ori r2,r2,0
  240. vxor v6,v6,v14
  241. VPMSUMD(v14,v22,const1)
  242. lvx v22,off96,r4
  243. VPERM(v22,v22,v22,byteswap)
  244. ori r2,r2,0
  245. vxor v7,v7,v15
  246. VPMSUMD(v15,v23,const1)
  247. lvx v23,off112,r4
  248. VPERM(v23,v23,v23,byteswap)
  249. addi r4,r4,8*16
  250. bdnz 4b
  251. .Lfirst_cool_down:
  252. /* First cool down pass */
  253. lvx const1,0,r3
  254. addi r3,r3,16
  255. vxor v0,v0,v8
  256. VPMSUMD(v8,v16,const1)
  257. ori r2,r2,0
  258. vxor v1,v1,v9
  259. VPMSUMD(v9,v17,const1)
  260. ori r2,r2,0
  261. vxor v2,v2,v10
  262. VPMSUMD(v10,v18,const1)
  263. ori r2,r2,0
  264. vxor v3,v3,v11
  265. VPMSUMD(v11,v19,const1)
  266. ori r2,r2,0
  267. vxor v4,v4,v12
  268. VPMSUMD(v12,v20,const1)
  269. ori r2,r2,0
  270. vxor v5,v5,v13
  271. VPMSUMD(v13,v21,const1)
  272. ori r2,r2,0
  273. vxor v6,v6,v14
  274. VPMSUMD(v14,v22,const1)
  275. ori r2,r2,0
  276. vxor v7,v7,v15
  277. VPMSUMD(v15,v23,const1)
  278. ori r2,r2,0
  279. .Lsecond_cool_down:
  280. /* Second cool down pass */
  281. vxor v0,v0,v8
  282. vxor v1,v1,v9
  283. vxor v2,v2,v10
  284. vxor v3,v3,v11
  285. vxor v4,v4,v12
  286. vxor v5,v5,v13
  287. vxor v6,v6,v14
  288. vxor v7,v7,v15
  289. #ifdef REFLECT
  290. /*
  291. * vpmsumd produces a 96 bit result in the least significant bits
  292. * of the register. Since we are bit reflected we have to shift it
  293. * left 32 bits so it occupies the least significant bits in the
  294. * bit reflected domain.
  295. */
  296. vsldoi v0,v0,zeroes,4
  297. vsldoi v1,v1,zeroes,4
  298. vsldoi v2,v2,zeroes,4
  299. vsldoi v3,v3,zeroes,4
  300. vsldoi v4,v4,zeroes,4
  301. vsldoi v5,v5,zeroes,4
  302. vsldoi v6,v6,zeroes,4
  303. vsldoi v7,v7,zeroes,4
  304. #endif
  305. /* xor with last 1024 bits */
  306. lvx v8,0,r4
  307. lvx v9,off16,r4
  308. VPERM(v8,v8,v8,byteswap)
  309. VPERM(v9,v9,v9,byteswap)
  310. lvx v10,off32,r4
  311. lvx v11,off48,r4
  312. VPERM(v10,v10,v10,byteswap)
  313. VPERM(v11,v11,v11,byteswap)
  314. lvx v12,off64,r4
  315. lvx v13,off80,r4
  316. VPERM(v12,v12,v12,byteswap)
  317. VPERM(v13,v13,v13,byteswap)
  318. lvx v14,off96,r4
  319. lvx v15,off112,r4
  320. VPERM(v14,v14,v14,byteswap)
  321. VPERM(v15,v15,v15,byteswap)
  322. addi r4,r4,8*16
  323. vxor v16,v0,v8
  324. vxor v17,v1,v9
  325. vxor v18,v2,v10
  326. vxor v19,v3,v11
  327. vxor v20,v4,v12
  328. vxor v21,v5,v13
  329. vxor v22,v6,v14
  330. vxor v23,v7,v15
  331. li r0,1
  332. cmpdi r6,0
  333. addi r6,r6,128
  334. bne 1b
  335. /* Work out how many bytes we have left */
  336. andi. r5,r5,127
  337. /* Calculate where in the constant table we need to start */
  338. subfic r6,r5,128
  339. add r3,r3,r6
  340. /* How many 16 byte chunks are in the tail */
  341. srdi r7,r5,4
  342. mtctr r7
  343. /*
  344. * Reduce the previously calculated 1024 bits to 64 bits, shifting
  345. * 32 bits to include the trailing 32 bits of zeros
  346. */
  347. lvx v0,0,r3
  348. lvx v1,off16,r3
  349. lvx v2,off32,r3
  350. lvx v3,off48,r3
  351. lvx v4,off64,r3
  352. lvx v5,off80,r3
  353. lvx v6,off96,r3
  354. lvx v7,off112,r3
  355. addi r3,r3,8*16
  356. VPMSUMW(v0,v16,v0)
  357. VPMSUMW(v1,v17,v1)
  358. VPMSUMW(v2,v18,v2)
  359. VPMSUMW(v3,v19,v3)
  360. VPMSUMW(v4,v20,v4)
  361. VPMSUMW(v5,v21,v5)
  362. VPMSUMW(v6,v22,v6)
  363. VPMSUMW(v7,v23,v7)
  364. /* Now reduce the tail (0 - 112 bytes) */
  365. cmpdi r7,0
  366. beq 1f
  367. lvx v16,0,r4
  368. lvx v17,0,r3
  369. VPERM(v16,v16,v16,byteswap)
  370. VPMSUMW(v16,v16,v17)
  371. vxor v0,v0,v16
  372. bdz 1f
  373. lvx v16,off16,r4
  374. lvx v17,off16,r3
  375. VPERM(v16,v16,v16,byteswap)
  376. VPMSUMW(v16,v16,v17)
  377. vxor v0,v0,v16
  378. bdz 1f
  379. lvx v16,off32,r4
  380. lvx v17,off32,r3
  381. VPERM(v16,v16,v16,byteswap)
  382. VPMSUMW(v16,v16,v17)
  383. vxor v0,v0,v16
  384. bdz 1f
  385. lvx v16,off48,r4
  386. lvx v17,off48,r3
  387. VPERM(v16,v16,v16,byteswap)
  388. VPMSUMW(v16,v16,v17)
  389. vxor v0,v0,v16
  390. bdz 1f
  391. lvx v16,off64,r4
  392. lvx v17,off64,r3
  393. VPERM(v16,v16,v16,byteswap)
  394. VPMSUMW(v16,v16,v17)
  395. vxor v0,v0,v16
  396. bdz 1f
  397. lvx v16,off80,r4
  398. lvx v17,off80,r3
  399. VPERM(v16,v16,v16,byteswap)
  400. VPMSUMW(v16,v16,v17)
  401. vxor v0,v0,v16
  402. bdz 1f
  403. lvx v16,off96,r4
  404. lvx v17,off96,r3
  405. VPERM(v16,v16,v16,byteswap)
  406. VPMSUMW(v16,v16,v17)
  407. vxor v0,v0,v16
  408. /* Now xor all the parallel chunks together */
  409. 1: vxor v0,v0,v1
  410. vxor v2,v2,v3
  411. vxor v4,v4,v5
  412. vxor v6,v6,v7
  413. vxor v0,v0,v2
  414. vxor v4,v4,v6
  415. vxor v0,v0,v4
  416. .Lbarrett_reduction:
  417. /* Barrett constants */
  418. addis r3,r2,.barrett_constants@toc@ha
  419. addi r3,r3,.barrett_constants@toc@l
  420. lvx const1,0,r3
  421. lvx const2,off16,r3
  422. vsldoi v1,v0,v0,8
  423. vxor v0,v0,v1 /* xor two 64 bit results together */
  424. #ifdef REFLECT
  425. /* shift left one bit */
  426. vspltisb v1,1
  427. vsl v0,v0,v1
  428. #endif
  429. vand v0,v0,mask_64bit
  430. #ifndef REFLECT
  431. /*
  432. * Now for the Barrett reduction algorithm. The idea is to calculate q,
  433. * the multiple of our polynomial that we need to subtract. By
  434. * doing the computation 2x bits higher (ie 64 bits) and shifting the
  435. * result back down 2x bits, we round down to the nearest multiple.
  436. */
  437. VPMSUMD(v1,v0,const1) /* ma */
  438. vsldoi v1,zeroes,v1,8 /* q = floor(ma/(2^64)) */
  439. VPMSUMD(v1,v1,const2) /* qn */
  440. vxor v0,v0,v1 /* a - qn, subtraction is xor in GF(2) */
  441. /*
  442. * Get the result into r3. We need to shift it left 8 bytes:
  443. * V0 [ 0 1 2 X ]
  444. * V0 [ 0 X 2 3 ]
  445. */
  446. vsldoi v0,v0,zeroes,8 /* shift result into top 64 bits */
  447. #else
  448. /*
  449. * The reflected version of Barrett reduction. Instead of bit
  450. * reflecting our data (which is expensive to do), we bit reflect our
  451. * constants and our algorithm, which means the intermediate data in
  452. * our vector registers goes from 0-63 instead of 63-0. We can reflect
  453. * the algorithm because we don't carry in mod 2 arithmetic.
  454. */
  455. vand v1,v0,mask_32bit /* bottom 32 bits of a */
  456. VPMSUMD(v1,v1,const1) /* ma */
  457. vand v1,v1,mask_32bit /* bottom 32bits of ma */
  458. VPMSUMD(v1,v1,const2) /* qn */
  459. vxor v0,v0,v1 /* a - qn, subtraction is xor in GF(2) */
  460. /*
  461. * Since we are bit reflected, the result (ie the low 32 bits) is in
  462. * the high 32 bits. We just need to shift it left 4 bytes
  463. * V0 [ 0 1 X 3 ]
  464. * V0 [ 0 X 2 3 ]
  465. */
  466. vsldoi v0,v0,zeroes,4 /* shift result into top 64 bits of */
  467. #endif
  468. /* Get it into r3 */
  469. MFVRD(r3, v0)
  470. .Lout:
  471. subi r6,r1,56+10*16
  472. subi r7,r1,56+2*16
  473. lvx v20,0,r6
  474. lvx v21,off16,r6
  475. lvx v22,off32,r6
  476. lvx v23,off48,r6
  477. lvx v24,off64,r6
  478. lvx v25,off80,r6
  479. lvx v26,off96,r6
  480. lvx v27,off112,r6
  481. lvx v28,0,r7
  482. lvx v29,off16,r7
  483. ld r31,-8(r1)
  484. ld r30,-16(r1)
  485. ld r29,-24(r1)
  486. ld r28,-32(r1)
  487. ld r27,-40(r1)
  488. ld r26,-48(r1)
  489. ld r25,-56(r1)
  490. blr
  491. .Lfirst_warm_up_done:
  492. lvx const1,0,r3
  493. addi r3,r3,16
  494. VPMSUMD(v8,v16,const1)
  495. VPMSUMD(v9,v17,const1)
  496. VPMSUMD(v10,v18,const1)
  497. VPMSUMD(v11,v19,const1)
  498. VPMSUMD(v12,v20,const1)
  499. VPMSUMD(v13,v21,const1)
  500. VPMSUMD(v14,v22,const1)
  501. VPMSUMD(v15,v23,const1)
  502. b .Lsecond_cool_down
  503. .Lshort:
  504. cmpdi r5,0
  505. beq .Lzero
  506. addis r3,r2,.short_constants@toc@ha
  507. addi r3,r3,.short_constants@toc@l
  508. /* Calculate where in the constant table we need to start */
  509. subfic r6,r5,256
  510. add r3,r3,r6
  511. /* How many 16 byte chunks? */
  512. srdi r7,r5,4
  513. mtctr r7
  514. vxor v19,v19,v19
  515. vxor v20,v20,v20
  516. lvx v0,0,r4
  517. lvx v16,0,r3
  518. VPERM(v0,v0,v16,byteswap)
  519. vxor v0,v0,v8 /* xor in initial value */
  520. VPMSUMW(v0,v0,v16)
  521. bdz .Lv0
  522. lvx v1,off16,r4
  523. lvx v17,off16,r3
  524. VPERM(v1,v1,v17,byteswap)
  525. VPMSUMW(v1,v1,v17)
  526. bdz .Lv1
  527. lvx v2,off32,r4
  528. lvx v16,off32,r3
  529. VPERM(v2,v2,v16,byteswap)
  530. VPMSUMW(v2,v2,v16)
  531. bdz .Lv2
  532. lvx v3,off48,r4
  533. lvx v17,off48,r3
  534. VPERM(v3,v3,v17,byteswap)
  535. VPMSUMW(v3,v3,v17)
  536. bdz .Lv3
  537. lvx v4,off64,r4
  538. lvx v16,off64,r3
  539. VPERM(v4,v4,v16,byteswap)
  540. VPMSUMW(v4,v4,v16)
  541. bdz .Lv4
  542. lvx v5,off80,r4
  543. lvx v17,off80,r3
  544. VPERM(v5,v5,v17,byteswap)
  545. VPMSUMW(v5,v5,v17)
  546. bdz .Lv5
  547. lvx v6,off96,r4
  548. lvx v16,off96,r3
  549. VPERM(v6,v6,v16,byteswap)
  550. VPMSUMW(v6,v6,v16)
  551. bdz .Lv6
  552. lvx v7,off112,r4
  553. lvx v17,off112,r3
  554. VPERM(v7,v7,v17,byteswap)
  555. VPMSUMW(v7,v7,v17)
  556. bdz .Lv7
  557. addi r3,r3,128
  558. addi r4,r4,128
  559. lvx v8,0,r4
  560. lvx v16,0,r3
  561. VPERM(v8,v8,v16,byteswap)
  562. VPMSUMW(v8,v8,v16)
  563. bdz .Lv8
  564. lvx v9,off16,r4
  565. lvx v17,off16,r3
  566. VPERM(v9,v9,v17,byteswap)
  567. VPMSUMW(v9,v9,v17)
  568. bdz .Lv9
  569. lvx v10,off32,r4
  570. lvx v16,off32,r3
  571. VPERM(v10,v10,v16,byteswap)
  572. VPMSUMW(v10,v10,v16)
  573. bdz .Lv10
  574. lvx v11,off48,r4
  575. lvx v17,off48,r3
  576. VPERM(v11,v11,v17,byteswap)
  577. VPMSUMW(v11,v11,v17)
  578. bdz .Lv11
  579. lvx v12,off64,r4
  580. lvx v16,off64,r3
  581. VPERM(v12,v12,v16,byteswap)
  582. VPMSUMW(v12,v12,v16)
  583. bdz .Lv12
  584. lvx v13,off80,r4
  585. lvx v17,off80,r3
  586. VPERM(v13,v13,v17,byteswap)
  587. VPMSUMW(v13,v13,v17)
  588. bdz .Lv13
  589. lvx v14,off96,r4
  590. lvx v16,off96,r3
  591. VPERM(v14,v14,v16,byteswap)
  592. VPMSUMW(v14,v14,v16)
  593. bdz .Lv14
  594. lvx v15,off112,r4
  595. lvx v17,off112,r3
  596. VPERM(v15,v15,v17,byteswap)
  597. VPMSUMW(v15,v15,v17)
  598. .Lv15: vxor v19,v19,v15
  599. .Lv14: vxor v20,v20,v14
  600. .Lv13: vxor v19,v19,v13
  601. .Lv12: vxor v20,v20,v12
  602. .Lv11: vxor v19,v19,v11
  603. .Lv10: vxor v20,v20,v10
  604. .Lv9: vxor v19,v19,v9
  605. .Lv8: vxor v20,v20,v8
  606. .Lv7: vxor v19,v19,v7
  607. .Lv6: vxor v20,v20,v6
  608. .Lv5: vxor v19,v19,v5
  609. .Lv4: vxor v20,v20,v4
  610. .Lv3: vxor v19,v19,v3
  611. .Lv2: vxor v20,v20,v2
  612. .Lv1: vxor v19,v19,v1
  613. .Lv0: vxor v20,v20,v0
  614. vxor v0,v19,v20
  615. b .Lbarrett_reduction
  616. .Lzero:
  617. mr r3,r10
  618. b .Lout
  619. FUNC_END(__crc32_vpmsum)