mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8073583: C2 support for CRC32C on SPARC
Reviewed-by: jrose, kvn
This commit is contained in:
parent
4a826139e3
commit
e2533553f6
21 changed files with 746 additions and 19 deletions
|
@ -956,6 +956,7 @@ void MacroAssembler::set64(jlong value, Register d, Register tmp) {
|
|||
|
||||
int hi = (int)(value >> 32);
|
||||
int lo = (int)(value & ~0);
|
||||
int bits_33to2 = (int)((value >> 2) & ~0);
|
||||
// (Matcher::isSimpleConstant64 knows about the following optimizations.)
|
||||
if (Assembler::is_simm13(lo) && value == lo) {
|
||||
or3(G0, lo, d);
|
||||
|
@ -964,6 +965,12 @@ void MacroAssembler::set64(jlong value, Register d, Register tmp) {
|
|||
if (low10(lo) != 0)
|
||||
or3(d, low10(lo), d);
|
||||
}
|
||||
else if ((hi >> 2) == 0) {
|
||||
Assembler::sethi(bits_33to2, d); // hardware version zero-extends to upper 32
|
||||
sllx(d, 2, d);
|
||||
if (low12(lo) != 0)
|
||||
or3(d, low12(lo), d);
|
||||
}
|
||||
else if (hi == -1) {
|
||||
Assembler::sethi(~lo, d); // hardware version zero-extends to upper 32
|
||||
xor3(d, low10(lo) ^ ~low10(~0), d);
|
||||
|
@ -4351,3 +4358,52 @@ void MacroAssembler::bis_zeroing(Register to, Register count, Register temp, Lab
|
|||
cmp_and_brx_short(to, end, Assembler::lessUnsigned, Assembler::pt, small_loop);
|
||||
nop(); // Separate short branches
|
||||
}
|
||||
|
||||
/**
|
||||
* Update CRC-32[C] with a byte value according to constants in table
|
||||
*
|
||||
* @param [in,out]crc Register containing the crc.
|
||||
* @param [in]val Register containing the byte to fold into the CRC.
|
||||
* @param [in]table Register containing the table of crc constants.
|
||||
*
|
||||
* uint32_t crc;
|
||||
* val = crc_table[(val ^ crc) & 0xFF];
|
||||
* crc = val ^ (crc >> 8);
|
||||
*/
|
||||
void MacroAssembler::update_byte_crc32(Register crc, Register val, Register table) {
|
||||
xor3(val, crc, val);
|
||||
and3(val, 0xFF, val);
|
||||
sllx(val, 2, val);
|
||||
lduw(table, val, val);
|
||||
srlx(crc, 8, crc);
|
||||
xor3(val, crc, crc);
|
||||
}
|
||||
|
||||
// Reverse byte order of lower 32 bits, assuming upper 32 bits all zeros
|
||||
void MacroAssembler::reverse_bytes_32(Register src, Register dst, Register tmp) {
|
||||
srlx(src, 24, dst);
|
||||
|
||||
sllx(src, 32+8, tmp);
|
||||
srlx(tmp, 32+24, tmp);
|
||||
sllx(tmp, 8, tmp);
|
||||
or3(dst, tmp, dst);
|
||||
|
||||
sllx(src, 32+16, tmp);
|
||||
srlx(tmp, 32+24, tmp);
|
||||
sllx(tmp, 16, tmp);
|
||||
or3(dst, tmp, dst);
|
||||
|
||||
sllx(src, 32+24, tmp);
|
||||
srlx(tmp, 32, tmp);
|
||||
or3(dst, tmp, dst);
|
||||
}
|
||||
|
||||
void MacroAssembler::movitof_revbytes(Register src, FloatRegister dst, Register tmp1, Register tmp2) {
|
||||
reverse_bytes_32(src, tmp1, tmp2);
|
||||
movxtod(tmp1, dst);
|
||||
}
|
||||
|
||||
void MacroAssembler::movftoi_revbytes(FloatRegister src, Register dst, Register tmp1, Register tmp2) {
|
||||
movdtox(src, tmp1);
|
||||
reverse_bytes_32(tmp1, dst, tmp2);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue