commit 0bccc18ab3e52a71db292af7f2ed045ffe113bfd
parent bd5d1fccbe09f332b8cd9a8cbbbda61fa6c48377
Author: André Bargull <andre.bargull@gmail.com>
Date: Fri, 24 Oct 2025 14:58:56 +0000
Bug 1996090 - Part 1: Use at-start allocations for LModPowTwoI on riscv64. r=spidermonkey-reviewers,jandem
Differential Revision: https://phabricator.services.mozilla.com/D269848
Diffstat:
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/js/src/jit/riscv64/CodeGenerator-riscv64.cpp b/js/src/jit/riscv64/CodeGenerator-riscv64.cpp
@@ -1184,22 +1184,20 @@ void CodeGenerator::visitModPowTwoI(LModPowTwoI* ins) {
MMod* mir = ins->mir();
Label negative, done;
- masm.move32(in, out);
- masm.ma_b(in, in, &done, Assembler::Zero, ShortJump);
// Switch based on sign of the lhs.
// Positive numbers are just a bitmask
masm.ma_b(in, in, &negative, Assembler::Signed, ShortJump);
{
- masm.and32(Imm32((1 << ins->shift()) - 1), out);
+ masm.ma_and(out, in, Imm32((1 << ins->shift()) - 1));
masm.ma_branch(&done, ShortJump);
}
// Negative numbers need a negate, bitmask, negate
{
masm.bind(&negative);
- masm.neg32(out);
- masm.and32(Imm32((1 << ins->shift()) - 1), out);
- masm.neg32(out);
+ masm.negw(out, in);
+ masm.ma_and(out, out, Imm32((1 << ins->shift()) - 1));
+ masm.negw(out, out);
}
if (mir->canBeNegativeDividend()) {
if (!mir->isTruncated()) {
diff --git a/js/src/jit/riscv64/Lowering-riscv64.cpp b/js/src/jit/riscv64/Lowering-riscv64.cpp
@@ -226,7 +226,7 @@ void LIRGeneratorRiscv64::lowerModI(MMod* mod) {
int32_t shift = FloorLog2(rhs);
if (rhs > 0 && 1 << shift == rhs) {
LModPowTwoI* lir =
- new (alloc()) LModPowTwoI(useRegister(mod->lhs()), shift);
+ new (alloc()) LModPowTwoI(useRegisterAtStart(mod->lhs()), shift);
if (mod->fallible()) {
assignSnapshot(lir, mod->bailoutKind());
}