commit b1b240cd76952e0b2b8b8f8d1361f43038b01cb0
parent 437b62f789a51f7521fadbea930851e7b81d2b4c
Author: André Bargull <andre.bargull@gmail.com>
Date: Fri, 24 Oct 2025 14:58:57 +0000
Bug 1996090 - Part 3: Use at-start allocations for LDivI and LDivPowTwoI on riscv64. r=spidermonkey-reviewers,jandem
Differential Revision: https://phabricator.services.mozilla.com/D269850
Diffstat:
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/js/src/jit/riscv64/Lowering-riscv64.cpp b/js/src/jit/riscv64/Lowering-riscv64.cpp
@@ -186,8 +186,8 @@ void LIRGeneratorRiscv64::lowerDivI(MDiv* div) {
// constants can be optimized by a reciprocal multiplication technique.
int32_t shift = FloorLog2(rhs);
if (rhs > 0 && 1 << shift == rhs) {
- LDivPowTwoI* lir =
- new (alloc()) LDivPowTwoI(useRegister(div->lhs()), temp(), shift);
+ auto* lir = new (alloc())
+ LDivPowTwoI(useRegisterAtStart(div->lhs()), temp(), shift);
if (div->fallible()) {
assignSnapshot(lir, div->bailoutKind());
}
@@ -196,8 +196,16 @@ void LIRGeneratorRiscv64::lowerDivI(MDiv* div) {
}
}
- LDivI* lir = new (alloc())
- LDivI(useRegister(div->lhs()), useRegister(div->rhs()), temp());
+ LAllocation lhs, rhs;
+ if (!div->canTruncateRemainder()) {
+ lhs = useRegister(div->lhs());
+ rhs = useRegister(div->rhs());
+ } else {
+ lhs = useRegisterAtStart(div->lhs());
+ rhs = useRegisterAtStart(div->rhs());
+ }
+
+ auto* lir = new (alloc()) LDivI(lhs, rhs, temp());
if (div->fallible()) {
assignSnapshot(lir, div->bailoutKind());
}