8302783: Improve CRC32C intrinsic with crypto pmull on AArch64
Reviewed-by: simonis, phh
This commit is contained in:
parent
45d8a175b1
commit
f3abc4063d
src/hotspot/cpu/aarch64
@ -3968,6 +3968,64 @@ void MacroAssembler::kernel_crc32(Register crc, Register buf, Register len,
|
||||
mvnw(crc, crc);
|
||||
}
|
||||
|
||||
void MacroAssembler::kernel_crc32c_using_crypto_pmull(Register crc, Register buf,
|
||||
Register len, Register tmp0, Register tmp1, Register tmp2, Register tmp3) {
|
||||
Label CRC_by4_loop, CRC_by1_loop, CRC_less128, CRC_by128_pre, CRC_by32_loop, CRC_less32, L_exit;
|
||||
assert_different_registers(crc, buf, len, tmp0, tmp1, tmp2);
|
||||
|
||||
subs(tmp0, len, 384);
|
||||
br(Assembler::GE, CRC_by128_pre);
|
||||
BIND(CRC_less128);
|
||||
subs(len, len, 32);
|
||||
br(Assembler::GE, CRC_by32_loop);
|
||||
BIND(CRC_less32);
|
||||
adds(len, len, 32 - 4);
|
||||
br(Assembler::GE, CRC_by4_loop);
|
||||
adds(len, len, 4);
|
||||
br(Assembler::GT, CRC_by1_loop);
|
||||
b(L_exit);
|
||||
|
||||
BIND(CRC_by32_loop);
|
||||
ldp(tmp0, tmp1, Address(buf));
|
||||
crc32cx(crc, crc, tmp0);
|
||||
ldr(tmp2, Address(buf, 16));
|
||||
crc32cx(crc, crc, tmp1);
|
||||
ldr(tmp3, Address(buf, 24));
|
||||
crc32cx(crc, crc, tmp2);
|
||||
add(buf, buf, 32);
|
||||
subs(len, len, 32);
|
||||
crc32cx(crc, crc, tmp3);
|
||||
br(Assembler::GE, CRC_by32_loop);
|
||||
cmn(len, (u1)32);
|
||||
br(Assembler::NE, CRC_less32);
|
||||
b(L_exit);
|
||||
|
||||
BIND(CRC_by4_loop);
|
||||
ldrw(tmp0, Address(post(buf, 4)));
|
||||
subs(len, len, 4);
|
||||
crc32cw(crc, crc, tmp0);
|
||||
br(Assembler::GE, CRC_by4_loop);
|
||||
adds(len, len, 4);
|
||||
br(Assembler::LE, L_exit);
|
||||
BIND(CRC_by1_loop);
|
||||
ldrb(tmp0, Address(post(buf, 1)));
|
||||
subs(len, len, 1);
|
||||
crc32cb(crc, crc, tmp0);
|
||||
br(Assembler::GT, CRC_by1_loop);
|
||||
b(L_exit);
|
||||
|
||||
BIND(CRC_by128_pre);
|
||||
kernel_crc32_common_fold_using_crypto_pmull(crc, buf, len, tmp0, tmp1, tmp2,
|
||||
4*256*sizeof(juint) + 8*sizeof(juint) + 0x50);
|
||||
mov(crc, 0);
|
||||
crc32cx(crc, crc, tmp0);
|
||||
crc32cx(crc, crc, tmp1);
|
||||
|
||||
cbnz(len, CRC_less128);
|
||||
|
||||
BIND(L_exit);
|
||||
}
|
||||
|
||||
void MacroAssembler::kernel_crc32c_using_crc32c(Register crc, Register buf,
|
||||
Register len, Register tmp0, Register tmp1, Register tmp2,
|
||||
Register tmp3) {
|
||||
@ -4074,7 +4132,11 @@ void MacroAssembler::kernel_crc32c_using_crc32c(Register crc, Register buf,
|
||||
void MacroAssembler::kernel_crc32c(Register crc, Register buf, Register len,
|
||||
Register table0, Register table1, Register table2, Register table3,
|
||||
Register tmp, Register tmp2, Register tmp3) {
|
||||
kernel_crc32c_using_crc32c(crc, buf, len, table0, table1, table2, table3);
|
||||
if (UseCryptoPmullForCRC32) {
|
||||
kernel_crc32c_using_crypto_pmull(crc, buf, len, table0, table1, table2, table3);
|
||||
} else {
|
||||
kernel_crc32c_using_crc32c(crc, buf, len, table0, table1, table2, table3);
|
||||
}
|
||||
}
|
||||
|
||||
void MacroAssembler::kernel_crc32_common_fold_using_crypto_pmull(Register crc, Register buf,
|
||||
|
@ -1429,6 +1429,9 @@ public:
|
||||
void kernel_crc32_using_crc32(Register crc, Register buf,
|
||||
Register len, Register tmp0, Register tmp1, Register tmp2,
|
||||
Register tmp3);
|
||||
void kernel_crc32c_using_crypto_pmull(Register crc, Register buf,
|
||||
Register len, Register tmp0, Register tmp1, Register tmp2,
|
||||
Register tmp3);
|
||||
void kernel_crc32c_using_crc32c(Register crc, Register buf,
|
||||
Register len, Register tmp0, Register tmp1, Register tmp2,
|
||||
Register tmp3);
|
||||
|
@ -302,6 +302,18 @@ ATTRIBUTE_ALIGNED(4096) juint StubRoutines::aarch64::_crc_table[] =
|
||||
0x5a546366UL, 0x00000001UL,
|
||||
0x751997d0UL, 0x00000001UL,
|
||||
0xccaa009eUL, 0x00000000UL,
|
||||
|
||||
// Constants for CRC-32C crypto pmull implementation
|
||||
0x6992cea2UL, 0x00000000UL,
|
||||
0x0d3b6092UL, 0x00000000UL,
|
||||
0x740eef02UL, 0x00000000UL,
|
||||
0x9e4addf8UL, 0x00000000UL,
|
||||
0x1c291d04UL, 0x00000000UL,
|
||||
0xd82c63daUL, 0x00000001UL,
|
||||
0x384aa63aUL, 0x00000001UL,
|
||||
0xba4fc28eUL, 0x00000000UL,
|
||||
0xf20c0dfeUL, 0x00000000UL,
|
||||
0x4cd00bd6UL, 0x00000001UL,
|
||||
};
|
||||
|
||||
// Accumulation coefficients for adler32 upper 16 bits
|
||||
|
Loading…
x
Reference in New Issue
Block a user