Commit 6406b661 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[Liftoff][arm64] Use wzr/xzr for pushing zero constants

This is an optimization to avoid an unneeded "mov <reg>, #0"
instruction. Instead, we can just directly use the zero register.

R=ahaas@chromium.org

Bug: chromium:854011, v8:6600
Change-Id: I187d7a659c42d7d4a6d5798eddff8b7ee0983bbc
Reviewed-on: https://chromium-review.googlesource.com/1124684
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54186}
parent 720218c2
...@@ -957,27 +957,19 @@ void LiftoffStackSlots::Construct() { ...@@ -957,27 +957,19 @@ void LiftoffStackSlots::Construct() {
asm_->Poke(liftoff::GetRegFromType(slot.src_.reg(), slot.src_.type()), asm_->Poke(liftoff::GetRegFromType(slot.src_.reg(), slot.src_.type()),
poke_offset); poke_offset);
break; break;
case LiftoffAssembler::VarState::KIntConst: { case LiftoffAssembler::VarState::KIntConst:
switch (slot.src_.type()) { DCHECK(slot.src_.type() == kWasmI32 || slot.src_.type() == kWasmI64);
case kWasmI32: { if (slot.src_.i32_const() == 0) {
UseScratchRegisterScope temps(asm_); Register zero_reg = slot.src_.type() == kWasmI32 ? wzr : xzr;
Register scratch = temps.AcquireW(); asm_->Poke(zero_reg, poke_offset);
asm_->Mov(scratch, slot.src_.i32_const()); } else {
asm_->Poke(scratch, poke_offset); UseScratchRegisterScope temps(asm_);
break; Register scratch = slot.src_.type() == kWasmI32 ? temps.AcquireW()
} : temps.AcquireX();
case kWasmI64: { asm_->Mov(scratch, int64_t{slot.src_.i32_const()});
UseScratchRegisterScope temps(asm_); asm_->Poke(scratch, poke_offset);
Register scratch = temps.AcquireX();
asm_->Mov(scratch, int64_t{slot.src_.i32_const()});
asm_->Poke(scratch, poke_offset);
break;
}
default:
UNREACHABLE();
} }
break; break;
}
} }
slot_index++; slot_index++;
} }
......
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