Commit 2f7505b7 authored by Ng Zhi An's avatar Ng Zhi An Committed by Commit Bot

[wasm-simd][ia32][liftoff] Implement store lane

Factor out the v128.load32_lane code sequence into macro-assembler functions
to be reused by Liftoff.

Bug: v8:10975
Change-Id: I9f53b5d98dfd610c4feafb087f00e6fc6dfca8d4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2645467
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72334}
parent 906b9644
......@@ -788,6 +788,16 @@ void TurboAssembler::I16x8Q15MulRSatS(XMMRegister dst, XMMRegister src1,
Pxor(dst, scratch);
}
void TurboAssembler::S128Store32Lane(Operand dst, XMMRegister src,
uint8_t laneidx) {
if (laneidx == 0) {
Movss(dst, src);
} else {
DCHECK_GE(3, laneidx);
Extractps(dst, src, laneidx);
}
}
void TurboAssembler::ShlPair(Register high, Register low, uint8_t shift) {
DCHECK_GE(63, shift);
if (shift >= 32) {
......
......@@ -638,6 +638,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
XMMRegister scratch);
void I16x8Q15MulRSatS(XMMRegister dst, XMMRegister src1, XMMRegister src2,
XMMRegister scratch);
void S128Store32Lane(Operand dst, XMMRegister src, uint8_t laneidx);
void Push(Register src) { push(src); }
void Push(Operand src) { push(src); }
......
......@@ -3320,12 +3320,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
size_t index = 0;
Operand operand = i.MemoryOperand(&index);
uint8_t laneidx = i.InputUint8(index + 1);
if (laneidx == 0) {
__ Movss(operand, i.InputSimd128Register(index));
} else {
DCHECK_GE(3, laneidx);
__ Extractps(operand, i.InputSimd128Register(index), 1);
}
__ S128Store32Lane(operand, i.InputSimd128Register(index), laneidx);
break;
}
case kSSEI8x16SConvertI16x8: {
......
......@@ -2789,7 +2789,26 @@ void LiftoffAssembler::StoreLane(Register dst, Register offset,
uintptr_t offset_imm, LiftoffRegister src,
StoreType type, uint8_t lane,
uint32_t* protected_store_pc) {
bailout(kSimd, "store lane");
DCHECK_LE(offset_imm, std::numeric_limits<int32_t>::max());
Operand dst_op = Operand(dst, offset, times_1, offset_imm);
if (protected_store_pc) *protected_store_pc = pc_offset();
MachineRepresentation rep = type.mem_rep();
if (rep == MachineRepresentation::kWord8) {
Pextrb(dst_op, src.fp(), lane);
} else if (rep == MachineRepresentation::kWord16) {
Pextrw(dst_op, src.fp(), lane);
} else if (rep == MachineRepresentation::kWord32) {
S128Store32Lane(dst_op, src.fp(), lane);
} else {
DCHECK_EQ(MachineRepresentation::kWord64, rep);
if (lane == 0) {
Movlps(dst_op, src.fp());
} else {
DCHECK_EQ(1, lane);
Movhps(dst_op, src.fp());
}
}
}
void LiftoffAssembler::emit_i8x16_shuffle(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