Commit 5606d50f authored by dusan.simicic's avatar dusan.simicic Committed by Commit bot

MIPS[64]: Support for some SIMD operations (2)

Add support for F32x4Splat, F32x4ExtractLane,
F32x4ReplaceLane, F32x4SConvertI32x4, F32x4UConvertI32x4
operations for mips32 and mips64 architectures.

BUG=

Note: Depends on https://codereview.chromium.org/2753903004/
Review-Url: https://codereview.chromium.org/2780503002
Cr-Commit-Position: refs/heads/master@{#44359}
parent 7c107952
......@@ -2046,7 +2046,7 @@ void InstructionSelector::VisitWord32PairShr(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitWord32PairSar(Node* node) { UNIMPLEMENTED(); }
#endif // V8_TARGET_ARCH_64_BIT
#if !V8_TARGET_ARCH_ARM
#if !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_MIPS && !V8_TARGET_ARCH_MIPS64
void InstructionSelector::VisitF32x4Splat(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitF32x4ExtractLane(Node* node) { UNIMPLEMENTED(); }
......@@ -2060,7 +2060,9 @@ void InstructionSelector::VisitF32x4SConvertI32x4(Node* node) {
void InstructionSelector::VisitF32x4UConvertI32x4(Node* node) {
UNIMPLEMENTED();
}
#endif // !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_MIPS && !V8_TARGET_ARCH_MIPS64
#if !V8_TARGET_ARCH_ARM
void InstructionSelector::VisitF32x4Abs(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitF32x4Neg(Node* node) { UNIMPLEMENTED(); }
......
......@@ -1641,6 +1641,39 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
i.InputSimd128Register(1));
break;
}
case kMipsF32x4Splat: {
CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
__ FmoveLow(kScratchReg, i.InputSingleRegister(0));
__ fill_w(i.OutputSimd128Register(), kScratchReg);
break;
}
case kMipsF32x4ExtractLane: {
CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
__ copy_u_w(kScratchReg, i.InputSimd128Register(0), i.InputInt8(1));
__ FmoveLow(i.OutputSingleRegister(), kScratchReg);
break;
}
case kMipsF32x4ReplaceLane: {
CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
Simd128Register src = i.InputSimd128Register(0);
Simd128Register dst = i.OutputSimd128Register();
if (!src.is(dst)) {
__ move_v(dst, src);
}
__ FmoveLow(kScratchReg, i.InputSingleRegister(2));
__ insert_w(dst, i.InputInt8(1), kScratchReg);
break;
}
case kMipsF32x4SConvertI32x4: {
CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
__ ffint_s_w(i.OutputSimd128Register(), i.InputSimd128Register(0));
break;
}
case kMipsF32x4UConvertI32x4: {
CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
__ ffint_u_w(i.OutputSimd128Register(), i.InputSimd128Register(0));
break;
}
}
return kSuccess;
} // NOLINT(readability/fn_size)
......
......@@ -138,7 +138,12 @@ namespace compiler {
V(MipsI32x4ExtractLane) \
V(MipsI32x4ReplaceLane) \
V(MipsI32x4Add) \
V(MipsI32x4Sub)
V(MipsI32x4Sub) \
V(MipsF32x4Splat) \
V(MipsF32x4ExtractLane) \
V(MipsF32x4ReplaceLane) \
V(MipsF32x4SConvertI32x4) \
V(MipsF32x4UConvertI32x4)
// Addressing modes represent the "shape" of inputs to an instruction.
// Many instructions support multiple addressing modes. Addressing modes
......
......@@ -1955,6 +1955,26 @@ void InstructionSelector::VisitS1x16Zero(Node* node) {
Emit(kMipsS128Zero, g.DefineSameAsFirst(node));
}
void InstructionSelector::VisitF32x4Splat(Node* node) {
VisitRR(this, kMipsF32x4Splat, node);
}
void InstructionSelector::VisitF32x4ExtractLane(Node* node) {
VisitRRI(this, kMipsF32x4ExtractLane, node);
}
void InstructionSelector::VisitF32x4ReplaceLane(Node* node) {
VisitRRIR(this, kMipsF32x4ReplaceLane, node);
}
void InstructionSelector::VisitF32x4SConvertI32x4(Node* node) {
VisitRR(this, kMipsF32x4SConvertI32x4, node);
}
void InstructionSelector::VisitF32x4UConvertI32x4(Node* node) {
VisitRR(this, kMipsF32x4UConvertI32x4, node);
}
// static
MachineOperatorBuilder::Flags
InstructionSelector::SupportedMachineOperatorFlags() {
......
......@@ -1971,6 +1971,39 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
i.InputSimd128Register(1));
break;
}
case kMips64F32x4Splat: {
CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
__ FmoveLow(kScratchReg, i.InputSingleRegister(0));
__ fill_w(i.OutputSimd128Register(), kScratchReg);
break;
}
case kMips64F32x4ExtractLane: {
CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
__ copy_u_w(kScratchReg, i.InputSimd128Register(0), i.InputInt8(1));
__ FmoveLow(i.OutputSingleRegister(), kScratchReg);
break;
}
case kMips64F32x4ReplaceLane: {
CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
Simd128Register src = i.InputSimd128Register(0);
Simd128Register dst = i.OutputSimd128Register();
if (!src.is(dst)) {
__ move_v(dst, src);
}
__ FmoveLow(kScratchReg, i.InputSingleRegister(2));
__ insert_w(dst, i.InputInt8(1), kScratchReg);
break;
}
case kMips64F32x4SConvertI32x4: {
CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
__ ffint_s_w(i.OutputSimd128Register(), i.InputSimd128Register(0));
break;
}
case kMips64F32x4UConvertI32x4: {
CpuFeatureScope msa_scope(masm(), MIPS_SIMD);
__ ffint_u_w(i.OutputSimd128Register(), i.InputSimd128Register(0));
break;
}
}
return kSuccess;
} // NOLINT(readability/fn_size)
......
......@@ -172,7 +172,12 @@ namespace compiler {
V(Mips64I32x4ExtractLane) \
V(Mips64I32x4ReplaceLane) \
V(Mips64I32x4Add) \
V(Mips64I32x4Sub)
V(Mips64I32x4Sub) \
V(Mips64F32x4Splat) \
V(Mips64F32x4ExtractLane) \
V(Mips64F32x4ReplaceLane) \
V(Mips64F32x4SConvertI32x4) \
V(Mips64F32x4UConvertI32x4)
// Addressing modes represent the "shape" of inputs to an instruction.
// Many instructions support multiple addressing modes. Addressing modes
......
......@@ -2706,6 +2706,26 @@ void InstructionSelector::VisitS1x16Zero(Node* node) {
Emit(kMips64S128Zero, g.DefineSameAsFirst(node));
}
void InstructionSelector::VisitF32x4Splat(Node* node) {
VisitRR(this, kMips64F32x4Splat, node);
}
void InstructionSelector::VisitF32x4ExtractLane(Node* node) {
VisitRRI(this, kMips64F32x4ExtractLane, node);
}
void InstructionSelector::VisitF32x4ReplaceLane(Node* node) {
VisitRRIR(this, kMips64F32x4ReplaceLane, node);
}
void InstructionSelector::VisitF32x4SConvertI32x4(Node* node) {
VisitRR(this, kMips64F32x4SConvertI32x4, node);
}
void InstructionSelector::VisitF32x4UConvertI32x4(Node* node) {
VisitRR(this, kMips64F32x4UConvertI32x4, node);
}
// static
MachineOperatorBuilder::Flags
InstructionSelector::SupportedMachineOperatorFlags() {
......
......@@ -406,7 +406,8 @@ bool SkipFPValue(float x) {
// doesn't handle NaNs. Also skip extreme values.
bool SkipFPExpectedValue(float x) { return std::isnan(x) || SkipFPValue(x); }
#if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET
#if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_MIPS || \
V8_TARGET_ARCH_MIPS64
WASM_EXEC_COMPILED_TEST(F32x4Splat) {
FLAG_wasm_simd_prototype = true;
......@@ -473,7 +474,10 @@ WASM_EXEC_COMPILED_TEST(F32x4ConvertI32x4) {
static_cast<float>(static_cast<uint32_t>(*i))));
}
}
#endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_MIPS ||
// V8_TARGET_ARCH_MIPS64
#if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET
void RunF32x4UnOpTest(WasmOpcode simd_op, FloatUnOp expected_op,
float error = 0.0f) {
FLAG_wasm_simd_prototype = true;
......
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