Skip to content

Commit

Permalink
Bug 1874683 - Part 3: Add MacroAssembler::add32 with three operands. …
Browse files Browse the repository at this point in the history
…r=jandem

Used in part 5.

Differential Revision: https://phabricator.services.mozilla.com/D198559
  • Loading branch information
anba committed Jan 22, 2024
1 parent 4bdac33 commit 05ae877
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions js/src/jit/MacroAssembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -1094,6 +1094,7 @@ class MacroAssembler : public MacroAssemblerSpecific {

inline void add32(Register src, Register dest) PER_SHARED_ARCH;
inline void add32(Imm32 imm, Register dest) PER_SHARED_ARCH;
inline void add32(Imm32 imm, Register src, Register dest) PER_SHARED_ARCH;
inline void add32(Imm32 imm, const Address& dest) PER_SHARED_ARCH;
inline void add32(Imm32 imm, const AbsoluteAddress& dest)
DEFINED_ON(x86_shared);
Expand Down
5 changes: 5 additions & 0 deletions js/src/jit/arm/MacroAssembler-arm-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,11 @@ void MacroAssembler::add32(Imm32 imm, Register dest) {
ma_add(imm, dest, scratch, SetCC);
}

void MacroAssembler::add32(Imm32 imm, Register src, Register dest) {
ScratchRegisterScope scratch(*this);
ma_add(src, imm, dest, scratch, SetCC);
}

void MacroAssembler::add32(Imm32 imm, const Address& dest) {
ScratchRegisterScope scratch(*this);
SecondScratchRegisterScope scratch2(*this);
Expand Down
4 changes: 4 additions & 0 deletions js/src/jit/arm64/MacroAssembler-arm64-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ void MacroAssembler::add32(Imm32 imm, Register dest) {
Add(ARMRegister(dest, 32), ARMRegister(dest, 32), Operand(imm.value));
}

void MacroAssembler::add32(Imm32 imm, Register src, Register dest) {
Add(ARMRegister(dest, 32), ARMRegister(src, 32), Operand(imm.value));
}

void MacroAssembler::add32(Imm32 imm, const Address& dest) {
vixl::UseScratchRegisterScope temps(this);
const ARMRegister scratch32 = temps.AcquireW();
Expand Down
4 changes: 4 additions & 0 deletions js/src/jit/loong64/MacroAssembler-loong64-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ void MacroAssembler::add32(Imm32 imm, Register dest) {
ma_add_w(dest, dest, imm);
}

void MacroAssembler::add32(Imm32 imm, Register src, Register dest) {
ma_add_w(dest, src, imm);
}

void MacroAssembler::add32(Imm32 imm, const Address& dest) {
SecondScratchRegisterScope scratch2(asMasm());
load32(dest, scratch2);
Expand Down
4 changes: 4 additions & 0 deletions js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ void MacroAssembler::add32(Imm32 imm, Register dest) {
ma_addu(dest, dest, imm);
}

void MacroAssembler::add32(Imm32 imm, Register src, Register dest) {
ma_addu(dest, src, imm);
}

void MacroAssembler::add32(Imm32 imm, const Address& dest) {
load32(dest, SecondScratchReg);
ma_addu(SecondScratchReg, imm);
Expand Down
4 changes: 4 additions & 0 deletions js/src/jit/riscv64/MacroAssembler-riscv64-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ void MacroAssembler::add32(Imm32 imm, Register dest) {
ma_add32(dest, dest, imm);
}

void MacroAssembler::add32(Imm32 imm, Register src, Register dest) {
ma_add32(dest, src, imm);
}

void MacroAssembler::add32(Imm32 imm, const Address& dest) {
UseScratchRegisterScope temps(this);
Register scratch2 = temps.Acquire();
Expand Down
4 changes: 4 additions & 0 deletions js/src/jit/wasm32/MacroAssembler-wasm32-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ void MacroAssembler::add32(Register src, Register dest) { MOZ_CRASH(); }

void MacroAssembler::add32(Imm32 imm, Register dest) { MOZ_CRASH(); }

void MacroAssembler::add32(Imm32 imm, Register src, Register dest) {
MOZ_CRASH();
}

void MacroAssembler::add32(Imm32 imm, const Address& dest) { MOZ_CRASH(); }

void MacroAssembler::addFloat32(FloatRegister src, FloatRegister dest) {
Expand Down
4 changes: 4 additions & 0 deletions js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ void MacroAssembler::add32(Register src, Register dest) { addl(src, dest); }

void MacroAssembler::add32(Imm32 imm, Register dest) { addl(imm, dest); }

void MacroAssembler::add32(Imm32 imm, Register src, Register dest) {
leal(Operand(src, imm.value), dest);
}

void MacroAssembler::add32(Imm32 imm, const Address& dest) {
addl(imm, Operand(dest));
}
Expand Down

0 comments on commit 05ae877

Please sign in to comment.