crc32c_ppc_asm.S 14 KB

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