8310276: RISC-V: Make use of shadd macro-assembler function when possible

Reviewed-by: fyang, luhenry, fjiang, vkempik
This commit is contained in:
Dingli Zhang 2023-06-26 12:47:41 +00:00 committed by Fei Yang
parent c1c5bd0faf
commit 3357867928
3 changed files with 3 additions and 4 deletions

View File

@ -4327,6 +4327,7 @@ void MacroAssembler::shadd(Register Rd, Register Rs1, Register Rs2, Register tmp
} }
if (shamt != 0) { if (shamt != 0) {
assert_different_registers(Rs2, tmp);
slli(tmp, Rs1, shamt); slli(tmp, Rs1, shamt);
add(Rd, Rs2, tmp); add(Rd, Rs2, tmp);
} else { } else {

View File

@ -3337,8 +3337,7 @@ class StubGenerator: public StubCodeGenerator {
assert(tmp1->encoding() < x28->encoding(), "register corruption"); assert(tmp1->encoding() < x28->encoding(), "register corruption");
assert(tmp2->encoding() < x28->encoding(), "register corruption"); assert(tmp2->encoding() < x28->encoding(), "register corruption");
slli(tmp1, len, LogBytesPerWord); shadd(s, len, s, tmp1, LogBytesPerWord);
add(s, s, tmp1);
mv(tmp1, len); mv(tmp1, len);
unroll_2(tmp1, &MontgomeryMultiplyGenerator::reverse1, d, s, tmp2); unroll_2(tmp1, &MontgomeryMultiplyGenerator::reverse1, d, s, tmp2);
slli(tmp1, len, LogBytesPerWord); slli(tmp1, len, LogBytesPerWord);

View File

@ -1787,8 +1787,7 @@ void TemplateInterpreterGenerator::histogram_bytecode_pair(Template* t) {
// _counters[_index] ++; // _counters[_index] ++;
Register counter_addr = t1; Register counter_addr = t1;
__ mv(x7, (address) &BytecodePairHistogram::_counters); __ mv(x7, (address) &BytecodePairHistogram::_counters);
__ slli(index, index, LogBytesPerInt); __ shadd(counter_addr, index, x7, counter_addr, LogBytesPerInt);
__ add(counter_addr, x7, index);
__ atomic_addw(noreg, 1, counter_addr); __ atomic_addw(noreg, 1, counter_addr);
} }