7314 |
7314 |
7315 /** |
7315 /** |
7316 * Fold 128-bit data chunk |
7316 * Fold 128-bit data chunk |
7317 */ |
7317 */ |
7318 void MacroAssembler::fold_128bit_crc32(XMMRegister xcrc, XMMRegister xK, XMMRegister xtmp, Register buf, int offset) { |
7318 void MacroAssembler::fold_128bit_crc32(XMMRegister xcrc, XMMRegister xK, XMMRegister xtmp, Register buf, int offset) { |
7319 vpclmulhdq(xtmp, xK, xcrc); // [123:64] |
7319 if (UseAVX > 0) { |
7320 vpclmulldq(xcrc, xK, xcrc); // [63:0] |
7320 vpclmulhdq(xtmp, xK, xcrc); // [123:64] |
7321 vpxor(xcrc, xcrc, Address(buf, offset), false /* vector256 */); |
7321 vpclmulldq(xcrc, xK, xcrc); // [63:0] |
7322 pxor(xcrc, xtmp); |
7322 vpxor(xcrc, xcrc, Address(buf, offset), false /* vector256 */); |
|
7323 pxor(xcrc, xtmp); |
|
7324 } else { |
|
7325 movdqa(xtmp, xcrc); |
|
7326 pclmulhdq(xtmp, xK); // [123:64] |
|
7327 pclmulldq(xcrc, xK); // [63:0] |
|
7328 pxor(xcrc, xtmp); |
|
7329 movdqu(xtmp, Address(buf, offset)); |
|
7330 pxor(xcrc, xtmp); |
|
7331 } |
7323 } |
7332 } |
7324 |
7333 |
7325 void MacroAssembler::fold_128bit_crc32(XMMRegister xcrc, XMMRegister xK, XMMRegister xtmp, XMMRegister xbuf) { |
7334 void MacroAssembler::fold_128bit_crc32(XMMRegister xcrc, XMMRegister xK, XMMRegister xtmp, XMMRegister xbuf) { |
7326 vpclmulhdq(xtmp, xK, xcrc); |
7335 if (UseAVX > 0) { |
7327 vpclmulldq(xcrc, xK, xcrc); |
7336 vpclmulhdq(xtmp, xK, xcrc); |
7328 pxor(xcrc, xbuf); |
7337 vpclmulldq(xcrc, xK, xcrc); |
7329 pxor(xcrc, xtmp); |
7338 pxor(xcrc, xbuf); |
|
7339 pxor(xcrc, xtmp); |
|
7340 } else { |
|
7341 movdqa(xtmp, xcrc); |
|
7342 pclmulhdq(xtmp, xK); |
|
7343 pclmulldq(xcrc, xK); |
|
7344 pxor(xcrc, xbuf); |
|
7345 pxor(xcrc, xtmp); |
|
7346 } |
7330 } |
7347 } |
7331 |
7348 |
7332 /** |
7349 /** |
7333 * 8-bit folds to compute 32-bit CRC |
7350 * 8-bit folds to compute 32-bit CRC |
7334 * |
7351 * |
7442 jccb(Assembler::greater, L_fold_tail_loop); |
7459 jccb(Assembler::greater, L_fold_tail_loop); |
7443 |
7460 |
7444 // Fold 128 bits in xmm1 down into 32 bits in crc register. |
7461 // Fold 128 bits in xmm1 down into 32 bits in crc register. |
7445 BIND(L_fold_128b); |
7462 BIND(L_fold_128b); |
7446 movdqu(xmm0, ExternalAddress(StubRoutines::x86::crc_by128_masks_addr())); |
7463 movdqu(xmm0, ExternalAddress(StubRoutines::x86::crc_by128_masks_addr())); |
7447 vpclmulqdq(xmm2, xmm0, xmm1, 0x1); |
7464 if (UseAVX > 0) { |
7448 vpand(xmm3, xmm0, xmm2, false /* vector256 */); |
7465 vpclmulqdq(xmm2, xmm0, xmm1, 0x1); |
7449 vpclmulqdq(xmm0, xmm0, xmm3, 0x1); |
7466 vpand(xmm3, xmm0, xmm2, false /* vector256 */); |
|
7467 vpclmulqdq(xmm0, xmm0, xmm3, 0x1); |
|
7468 } else { |
|
7469 movdqa(xmm2, xmm0); |
|
7470 pclmulqdq(xmm2, xmm1, 0x1); |
|
7471 movdqa(xmm3, xmm0); |
|
7472 pand(xmm3, xmm2); |
|
7473 pclmulqdq(xmm0, xmm3, 0x1); |
|
7474 } |
7450 psrldq(xmm1, 8); |
7475 psrldq(xmm1, 8); |
7451 psrldq(xmm2, 4); |
7476 psrldq(xmm2, 4); |
7452 pxor(xmm0, xmm1); |
7477 pxor(xmm0, xmm1); |
7453 pxor(xmm0, xmm2); |
7478 pxor(xmm0, xmm2); |
7454 |
7479 |