Commit 79972136 authored by Yu Yin's avatar Yu Yin Committed by Commit Bot

[MIPS32][liftoff] Introduce emit_{i64,i32}_add with immediate

This is port for https://crrev.com/c/1524482
Original commit message:
    This allows immediates to be encoded directly into instructions, rather than
    mov-ing constants to registers first.

    This patch only changes emit_{i64,i32}_add, other emit_ functions will be changed once
    this approach has been approved.

Bug: v8:9038
Change-Id: I4f35498ccf89306f12601df5ce91e1748975b11b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1568710Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Yu Yin <xwafish@gmail.com>
Cr-Commit-Position: refs/heads/master@{#60886}
parent 34c8443c
......@@ -1458,6 +1458,21 @@ void TurboAssembler::AddPair(Register dst_low, Register dst_high,
Move(dst_low, scratch1);
}
void TurboAssembler::AddPair(Register dst_low, Register dst_high,
Register left_low, Register left_high,
int32_t imm,
Register scratch1, Register scratch2) {
BlockTrampolinePoolScope block_trampoline_pool(this);
Register scratch3 = t8;
li(dst_low, Operand(imm));
sra(dst_high, dst_low, 31);
Addu(scratch1, left_low, dst_low);
Sltu(scratch3, scratch1, left_low);
Addu(scratch2, left_high, dst_high);
Addu(dst_high, scratch2, scratch3);
Move(dst_low, scratch1);
}
void TurboAssembler::SubPair(Register dst_low, Register dst_high,
Register left_low, Register left_high,
Register right_low, Register right_high,
......
......@@ -549,6 +549,10 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
Register left_high, Register right_low, Register right_high,
Register scratch1, Register scratch2);
void AddPair(Register dst_low, Register dst_high, Register left_low,
Register left_high, int32_t imm,
Register scratch1, Register scratch2);
void SubPair(Register dst_low, Register dst_high, Register left_low,
Register left_high, Register right_low, Register right_high,
Register scratch1, Register scratch2);
......
......@@ -585,6 +585,10 @@ void LiftoffAssembler::FillI64Half(Register reg, uint32_t index,
lw(reg, liftoff::GetHalfStackSlot(index, half));
}
void LiftoffAssembler::emit_i32_add(Register dst, Register lhs, int32_t imm) {
Addu(dst, lhs, imm);
}
void LiftoffAssembler::emit_i32_mul(Register dst, Register lhs, Register rhs) {
TurboAssembler::Mul(dst, lhs, rhs);
}
......@@ -675,6 +679,13 @@ I32_SHIFTOP_I(shr, srl)
#undef I32_SHIFTOP
#undef I32_SHIFTOP_I
void LiftoffAssembler::emit_i64_add(LiftoffRegister dst, LiftoffRegister lhs,
int32_t imm) {
TurboAssembler::AddPair(dst.low_gp(), dst.high_gp(), lhs.low_gp(),
lhs.high_gp(), imm,
kScratchReg, kScratchReg2);
}
void LiftoffAssembler::emit_i64_mul(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
TurboAssembler::MulPair(dst.low_gp(), dst.high_gp(), lhs.low_gp(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment