tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit efdc0184057376e8494dbc53cc6b17b6adb7ffbb
parent 551667b535da20bbb87d5383b6e1792448f6f38b
Author: André Bargull <andre.bargull@gmail.com>
Date:   Mon, 20 Oct 2025 08:20:23 +0000

Bug 1993951 - Part 4: Use MacroAssembler::copySign{Float32,Double} on mips64. r=spidermonkey-reviewers,iain

Differential Revision: https://phabricator.services.mozilla.com/D268369

Diffstat:
Mjs/src/jit/MacroAssembler.h | 2+-
Mjs/src/jit/mips-shared/CodeGenerator-mips-shared.cpp | 23++---------------------
Mjs/src/jit/mips-shared/Lowering-mips-shared.cpp | 3---
Mjs/src/jit/mips-shared/MacroAssembler-mips-shared.cpp | 31++++++++++++++++++++++++++++++-
4 files changed, 33 insertions(+), 26 deletions(-)

diff --git a/js/src/jit/MacroAssembler.h b/js/src/jit/MacroAssembler.h @@ -1329,7 +1329,7 @@ class MacroAssembler : public MacroAssemblerSpecific { FloatRegister output) PER_SHARED_ARCH; void copySignFloat32(FloatRegister lhs, FloatRegister rhs, FloatRegister output) - DEFINED_ON(arm, arm64, loong64, riscv64, x86_shared); + DEFINED_ON(arm, arm64, loong64, mips64, riscv64, x86_shared); // Returns a random double in range [0, 1) in |dest|. The |rng| register must // hold a pointer to a mozilla::non_crypto::XorShift128PlusRNG. diff --git a/js/src/jit/mips-shared/CodeGenerator-mips-shared.cpp b/js/src/jit/mips-shared/CodeGenerator-mips-shared.cpp @@ -1115,16 +1115,7 @@ void CodeGenerator::visitCopySignF(LCopySignF* ins) { FloatRegister rhs = ToFloatRegister(ins->rhs()); FloatRegister output = ToFloatRegister(ins->output()); - Register lhsi = ToRegister(ins->temp0()); - Register rhsi = ToRegister(ins->temp1()); - - masm.moveFromFloat32(lhs, lhsi); - masm.moveFromFloat32(rhs, rhsi); - - // Combine. - masm.ma_ins(rhsi, lhsi, 0, 31); - - masm.moveToFloat32(rhsi, output); + masm.copySignFloat32(lhs, rhs, output); } void CodeGenerator::visitCopySignD(LCopySignD* ins) { @@ -1132,17 +1123,7 @@ void CodeGenerator::visitCopySignD(LCopySignD* ins) { FloatRegister rhs = ToFloatRegister(ins->rhs()); FloatRegister output = ToFloatRegister(ins->output()); - Register lhsi = ToRegister(ins->temp0()); - Register rhsi = ToRegister(ins->temp1()); - - // Manipulate high words of double inputs. - masm.moveFromDoubleHi(lhs, lhsi); - masm.moveFromDoubleHi(rhs, rhsi); - - // Combine. - masm.ma_ins(rhsi, lhsi, 0, 31); - - masm.moveToDoubleHi(rhsi, output); + masm.copySignDouble(lhs, rhs, output); } void CodeGenerator::visitTestDAndBranch(LTestDAndBranch* test) { diff --git a/js/src/jit/mips-shared/Lowering-mips-shared.cpp b/js/src/jit/mips-shared/Lowering-mips-shared.cpp @@ -834,9 +834,6 @@ void LIRGenerator::visitCopySign(MCopySign* ins) { lir = new (alloc()) LCopySignF(); } - lir->setTemp(0, temp()); - lir->setTemp(1, temp()); - lir->setOperand(0, useRegisterAtStart(lhs)); lir->setOperand(1, useRegister(rhs)); defineReuseInput(lir, ins, 0); diff --git a/js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp b/js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp @@ -3446,7 +3446,36 @@ void MacroAssembler::nearbyIntFloat32(RoundingMode mode, FloatRegister src, void MacroAssembler::copySignDouble(FloatRegister lhs, FloatRegister rhs, FloatRegister output) { - MOZ_CRASH("not supported on this platform"); + UseScratchRegisterScope temps(*this); + Register lhsi = temps.Acquire(); + Register rhsi = temps.Acquire(); + + // Manipulate high words of double inputs. + moveFromDoubleHi(lhs, lhsi); + moveFromDoubleHi(rhs, rhsi); + + // Combine. + ma_ins(rhsi, lhsi, 0, 31); + + if (lhs != output) { + moveDouble(lhs, output); + } + moveToDoubleHi(rhsi, output); +} + +void MacroAssembler::copySignFloat32(FloatRegister lhs, FloatRegister rhs, + FloatRegister output) { + UseScratchRegisterScope temps(*this); + Register lhsi = temps.Acquire(); + Register rhsi = temps.Acquire(); + + moveFromFloat32(lhs, lhsi); + moveFromFloat32(rhs, rhsi); + + // Combine. + ma_ins(rhsi, lhsi, 0, 31); + + moveToFloat32(rhsi, output); } void MacroAssembler::shiftIndex32AndAdd(Register indexTemp32, int shift,