Commit e505ce95 authored by Ng Zhi An's avatar Ng Zhi An Committed by Commit Bot

[wasm-simd][liftoff][ia32][x64] Implement load splat

Bug: v8:9909
Change-Id: Ic3a13131e07487512161eec1bec0cdc33a0a3f63
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2207664Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67986}
parent 56fc9730
......@@ -2137,8 +2137,8 @@ void LiftoffAssembler::LoadTransform(LiftoffRegister dst, Register src_addr,
static_cast<int32_t>(offset_imm)};
*protected_load_pc = pc_offset();
MachineType memtype = type.mem_type();
if (transform == LoadTransformationKind::kExtend) {
MachineType memtype = type.mem_type();
if (memtype == MachineType::Int8()) {
Pmovsxbw(dst.fp(), src_op);
} else if (memtype == MachineType::Uint8()) {
......@@ -2154,7 +2154,19 @@ void LiftoffAssembler::LoadTransform(LiftoffRegister dst, Register src_addr,
}
} else {
DCHECK_EQ(LoadTransformationKind::kSplat, transform);
bailout(kSimd, "load splats unimplemented");
if (memtype == MachineType::Int8()) {
Pinsrb(dst.fp(), src_op, 0);
Pxor(liftoff::kScratchDoubleReg, liftoff::kScratchDoubleReg);
Pshufb(dst.fp(), liftoff::kScratchDoubleReg);
} else if (memtype == MachineType::Int16()) {
Pinsrw(dst.fp(), src_op, 0);
Pshuflw(dst.fp(), dst.fp(), uint8_t{0});
Punpcklqdq(dst.fp(), dst.fp());
} else if (memtype == MachineType::Int32()) {
Vbroadcastss(dst.fp(), src_op);
} else if (memtype == MachineType::Int64()) {
Movddup(dst.fp(), src_op);
}
}
}
......
......@@ -2183,8 +2183,8 @@ void LiftoffAssembler::LoadTransform(LiftoffRegister dst, Register src_addr,
}
Operand src_op = liftoff::GetMemOp(this, src_addr, offset_reg, offset_imm);
*protected_load_pc = pc_offset();
MachineType memtype = type.mem_type();
if (transform == LoadTransformationKind::kExtend) {
MachineType memtype = type.mem_type();
if (memtype == MachineType::Int8()) {
Pmovsxbw(dst.fp(), src_op);
} else if (memtype == MachineType::Uint8()) {
......@@ -2200,7 +2200,25 @@ void LiftoffAssembler::LoadTransform(LiftoffRegister dst, Register src_addr,
}
} else {
DCHECK_EQ(LoadTransformationKind::kSplat, transform);
bailout(kSimd, "load splats unimplemented");
if (memtype == MachineType::Int8()) {
Pinsrb(dst.fp(), src_op, 0);
Pxor(kScratchDoubleReg, kScratchDoubleReg);
Pshufb(dst.fp(), kScratchDoubleReg);
} else if (memtype == MachineType::Int16()) {
Pinsrw(dst.fp(), src_op, 0);
Pshuflw(dst.fp(), dst.fp(), uint8_t{0});
Punpcklqdq(dst.fp(), dst.fp());
} else if (memtype == MachineType::Int32()) {
if (CpuFeatures::IsSupported(AVX)) {
CpuFeatureScope avx_scope(this, AVX);
vbroadcastss(dst.fp(), src_op);
} else {
Movss(dst.fp(), src_op);
Shufps(dst.fp(), dst.fp(), byte{0});
}
} else if (memtype == MachineType::Int64()) {
Movddup(dst.fp(), src_op);
}
}
}
......
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