Commit 9e47dd6a authored by Zhi An Ng's avatar Zhi An Ng Committed by Commit Bot

[wasm-simd][liftoff][arm] Implement i64x2.bitmask

Move the current code sequence in TurboFan to a macro-assembler helper
function to allow Liftoff to reuse it.

Bug: v8:10997
Change-Id: I08a9d5b6d1f7898bf7e9239f54d69867e00b30eb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2620906
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72057}
parent 1cf454a2
......@@ -2630,6 +2630,17 @@ void TurboAssembler::CallForDeoptimization(Builtins::Name target, int,
void TurboAssembler::Trap() { stop(); }
void TurboAssembler::DebugBreak() { stop(); }
void TurboAssembler::I64x2BitMask(Register dst, QwNeonRegister src) {
UseScratchRegisterScope temps(this);
QwNeonRegister tmp1 = temps.AcquireQ();
Register tmp = temps.Acquire();
vshr(NeonU64, tmp1, src, 63);
vmov(NeonU32, dst, tmp1.low(), 0);
vmov(NeonU32, tmp, tmp1.high(), 0);
add(dst, dst, Operand(tmp, LSL, 1));
}
} // namespace internal
} // namespace v8
......
......@@ -565,6 +565,11 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
// Define an exception handler and bind a label.
void BindExceptionHandler(Label* label) { bind(label); }
// Wasm SIMD helpers. These instructions don't have direct lowering to native
// instructions. These helpers allow us to define the optimal code sequence,
// and be used in both TurboFan and Liftoff.
void I64x2BitMask(Register dst, QwNeonRegister src);
private:
// Compare single values and then load the fpscr flags to a register.
void VFPCompareAndLoadFlags(const SwVfpRegister src1,
......
......@@ -2208,16 +2208,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
break;
}
case kArmI64x2BitMask: {
UseScratchRegisterScope temps(tasm());
Register dst = i.OutputRegister();
Simd128Register src = i.InputSimd128Register(0);
QwNeonRegister tmp1 = temps.AcquireQ();
Register tmp = temps.Acquire();
__ vshr(NeonU64, tmp1, src, 63);
__ vmov(NeonU32, dst, tmp1.low(), 0);
__ vmov(NeonU32, tmp, tmp1.high(), 0);
__ add(dst, dst, Operand(tmp, LSL, 1));
__ I64x2BitMask(i.OutputRegister(), i.InputSimd128Register(0));
break;
}
case kArmI64x2SConvertI32x4Low: {
......
......@@ -2890,7 +2890,7 @@ void LiftoffAssembler::emit_i64x2_extmul_high_i32x4_u(LiftoffRegister dst,
void LiftoffAssembler::emit_i64x2_bitmask(LiftoffRegister dst,
LiftoffRegister src) {
bailout(kSimd, "i64x2_bitmask");
I64x2BitMask(dst.gp(), liftoff::GetSimd128Register(src));
}
void LiftoffAssembler::emit_i64x2_sconvert_i32x4_low(LiftoffRegister dst,
......
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