8342601: AArch64: Micro-optimize bit shift in copy_memory

Reviewed-by: dlong, aph, shade
This commit is contained in:
Chad Rakoczy 2024-10-22 16:11:37 +00:00
parent f9852aea8b
commit 893266c48f

@ -1374,7 +1374,9 @@ class StubGenerator: public StubCodeGenerator {
// r15 is the byte adjustment needed to align s.
__ cbz(r15, aligned);
int shift = exact_log2(granularity);
if (shift) __ lsr(r15, r15, shift);
if (shift > 0) {
__ lsr(r15, r15, shift);
}
__ sub(count, count, r15);
#if 0
@ -1402,9 +1404,15 @@ class StubGenerator: public StubCodeGenerator {
// s is now 2-word-aligned.
// We have a count of units and some trailing bytes. Adjust the
// count and do a bulk copy of words.
__ lsr(r15, count, exact_log2(wordSize/granularity));
// We have a count of units and some trailing bytes. Adjust the
// count and do a bulk copy of words. If the shift is zero
// perform a move instead to benefit from zero latency moves.
int shift = exact_log2(wordSize/granularity);
if (shift > 0) {
__ lsr(r15, count, shift);
} else {
__ mov(r15, count);
}
if (direction == copy_forwards) {
if (type != T_OBJECT) {
__ bl(copy_f);