Commit 1e256fc3 authored by Mu Tao's avatar Mu Tao Committed by Commit Bot

[mips][wasm-simd] Implement f64x2 splat extract replace for mips

Port f22837db

R=xwafish@gmail.com

Change-Id: Iece021bb832618cac0d111639b388d94f7da7028
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1868773
Commit-Queue: Mu Tao <pamilty@gmail.com>
Auto-Submit: Mu Tao <pamilty@gmail.com>
Reviewed-by: 's avatarZhi An Ng <zhin@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64505}
parent b5260f53
...@@ -1983,6 +1983,39 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -1983,6 +1983,39 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
ASSEMBLE_F64X2_ARITHMETIC_BINOP(fdiv_d); ASSEMBLE_F64X2_ARITHMETIC_BINOP(fdiv_d);
break; break;
} }
case kMipsF64x2Splat: {
CpuFeatureScope msa_scope(tasm(), MIPS_SIMD);
Simd128Register dst = i.OutputSimd128Register();
__ FmoveLow(kScratchReg, i.InputDoubleRegister(0));
__ insert_w(dst, 0, kScratchReg);
__ insert_w(dst, 2, kScratchReg);
__ FmoveHigh(kScratchReg, i.InputDoubleRegister(0));
__ insert_w(dst, 1, kScratchReg);
__ insert_w(dst, 3, kScratchReg);
break;
}
case kMipsF64x2ExtractLane: {
CpuFeatureScope msa_scope(tasm(), MIPS_SIMD);
__ copy_u_w(kScratchReg, i.InputSimd128Register(0), i.InputInt8(1) * 2);
__ FmoveLow(i.OutputDoubleRegister(), kScratchReg);
__ copy_u_w(kScratchReg, i.InputSimd128Register(0),
i.InputInt8(1) * 2 + 1);
__ FmoveHigh(i.OutputDoubleRegister(), kScratchReg);
break;
}
case kMipsF64x2ReplaceLane: {
CpuFeatureScope msa_scope(tasm(), MIPS_SIMD);
Simd128Register src = i.InputSimd128Register(0);
Simd128Register dst = i.OutputSimd128Register();
if (src != dst) {
__ move_v(dst, src);
}
__ FmoveLow(kScratchReg, i.InputDoubleRegister(2));
__ insert_w(dst, i.InputInt8(1) * 2, kScratchReg);
__ FmoveHigh(kScratchReg, i.InputDoubleRegister(2));
__ insert_w(dst, i.InputInt8(1) * 2 + 1, kScratchReg);
break;
}
case kMipsF32x4Splat: { case kMipsF32x4Splat: {
CpuFeatureScope msa_scope(tasm(), MIPS_SIMD); CpuFeatureScope msa_scope(tasm(), MIPS_SIMD);
__ FmoveLow(kScratchReg, i.InputSingleRegister(0)); __ FmoveLow(kScratchReg, i.InputSingleRegister(0));
......
...@@ -164,6 +164,9 @@ namespace compiler { ...@@ -164,6 +164,9 @@ namespace compiler {
V(MipsI32x4ShrU) \ V(MipsI32x4ShrU) \
V(MipsI32x4MaxU) \ V(MipsI32x4MaxU) \
V(MipsI32x4MinU) \ V(MipsI32x4MinU) \
V(MipsF64x2Splat) \
V(MipsF64x2ExtractLane) \
V(MipsF64x2ReplaceLane) \
V(MipsF32x4Abs) \ V(MipsF32x4Abs) \
V(MipsF32x4Neg) \ V(MipsF32x4Neg) \
V(MipsF32x4Sqrt) \ V(MipsF32x4Sqrt) \
......
...@@ -48,6 +48,9 @@ int InstructionScheduler::GetTargetInstructionFlags( ...@@ -48,6 +48,9 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kMipsF64x2Sub: case kMipsF64x2Sub:
case kMipsF64x2Mul: case kMipsF64x2Mul:
case kMipsF64x2Div: case kMipsF64x2Div:
case kMipsF64x2Splat:
case kMipsF64x2ExtractLane:
case kMipsF64x2ReplaceLane:
case kMipsF32x4Abs: case kMipsF32x4Abs:
case kMipsF32x4Add: case kMipsF32x4Add:
case kMipsF32x4AddHoriz: case kMipsF32x4AddHoriz:
......
...@@ -2139,6 +2139,7 @@ void InstructionSelector::VisitS128Zero(Node* node) { ...@@ -2139,6 +2139,7 @@ void InstructionSelector::VisitS128Zero(Node* node) {
VisitRR(this, kMips##Type##Splat, node); \ VisitRR(this, kMips##Type##Splat, node); \
} }
SIMD_TYPE_LIST(SIMD_VISIT_SPLAT) SIMD_TYPE_LIST(SIMD_VISIT_SPLAT)
SIMD_VISIT_SPLAT(F64x2)
#undef SIMD_VISIT_SPLAT #undef SIMD_VISIT_SPLAT
#define SIMD_VISIT_EXTRACT_LANE(Type) \ #define SIMD_VISIT_EXTRACT_LANE(Type) \
...@@ -2146,6 +2147,7 @@ SIMD_TYPE_LIST(SIMD_VISIT_SPLAT) ...@@ -2146,6 +2147,7 @@ SIMD_TYPE_LIST(SIMD_VISIT_SPLAT)
VisitRRI(this, kMips##Type##ExtractLane, node); \ VisitRRI(this, kMips##Type##ExtractLane, node); \
} }
SIMD_TYPE_LIST(SIMD_VISIT_EXTRACT_LANE) SIMD_TYPE_LIST(SIMD_VISIT_EXTRACT_LANE)
SIMD_VISIT_EXTRACT_LANE(F64x2)
#undef SIMD_VISIT_EXTRACT_LANE #undef SIMD_VISIT_EXTRACT_LANE
#define SIMD_VISIT_REPLACE_LANE(Type) \ #define SIMD_VISIT_REPLACE_LANE(Type) \
...@@ -2153,6 +2155,7 @@ SIMD_TYPE_LIST(SIMD_VISIT_EXTRACT_LANE) ...@@ -2153,6 +2155,7 @@ SIMD_TYPE_LIST(SIMD_VISIT_EXTRACT_LANE)
VisitRRIR(this, kMips##Type##ReplaceLane, node); \ VisitRRIR(this, kMips##Type##ReplaceLane, node); \
} }
SIMD_TYPE_LIST(SIMD_VISIT_REPLACE_LANE) SIMD_TYPE_LIST(SIMD_VISIT_REPLACE_LANE)
SIMD_VISIT_REPLACE_LANE(F64x2)
#undef SIMD_VISIT_REPLACE_LANE #undef SIMD_VISIT_REPLACE_LANE
#define SIMD_VISIT_UNOP(Name, instruction) \ #define SIMD_VISIT_UNOP(Name, instruction) \
......
...@@ -2098,6 +2098,29 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -2098,6 +2098,29 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
ASSEMBLE_F64X2_ARITHMETIC_BINOP(fdiv_d); ASSEMBLE_F64X2_ARITHMETIC_BINOP(fdiv_d);
break; break;
} }
case kMips64F64x2Splat: {
CpuFeatureScope msa_scope(tasm(), MIPS_SIMD);
__ Move(kScratchReg, i.InputDoubleRegister(0));
__ fill_d(i.OutputSimd128Register(), kScratchReg);
break;
}
case kMips64F64x2ExtractLane: {
CpuFeatureScope msa_scope(tasm(), MIPS_SIMD);
__ copy_s_d(kScratchReg, i.InputSimd128Register(0), i.InputInt8(1));
__ Move(i.OutputDoubleRegister(), kScratchReg);
break;
}
case kMips64F64x2ReplaceLane: {
CpuFeatureScope msa_scope(tasm(), MIPS_SIMD);
Simd128Register src = i.InputSimd128Register(0);
Simd128Register dst = i.OutputSimd128Register();
if (src != dst) {
__ move_v(dst, src);
}
__ Move(kScratchReg, i.InputDoubleRegister(2));
__ insert_d(dst, i.InputInt8(1), kScratchReg);
break;
}
case kMips64F32x4Splat: { case kMips64F32x4Splat: {
CpuFeatureScope msa_scope(tasm(), MIPS_SIMD); CpuFeatureScope msa_scope(tasm(), MIPS_SIMD);
__ FmoveLow(kScratchReg, i.InputSingleRegister(0)); __ FmoveLow(kScratchReg, i.InputSingleRegister(0));
......
...@@ -194,6 +194,9 @@ namespace compiler { ...@@ -194,6 +194,9 @@ namespace compiler {
V(Mips64F64x2Sub) \ V(Mips64F64x2Sub) \
V(Mips64F64x2Mul) \ V(Mips64F64x2Mul) \
V(Mips64F64x2Div) \ V(Mips64F64x2Div) \
V(Mips64F64x2Splat) \
V(Mips64F64x2ExtractLane) \
V(Mips64F64x2ReplaceLane) \
V(Mips64F32x4Abs) \ V(Mips64F32x4Abs) \
V(Mips64F32x4Neg) \ V(Mips64F32x4Neg) \
V(Mips64F32x4Sqrt) \ V(Mips64F32x4Sqrt) \
......
...@@ -97,6 +97,9 @@ int InstructionScheduler::GetTargetInstructionFlags( ...@@ -97,6 +97,9 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kMips64F32x4Splat: case kMips64F32x4Splat:
case kMips64F32x4Sub: case kMips64F32x4Sub:
case kMips64F32x4UConvertI32x4: case kMips64F32x4UConvertI32x4:
case kMips64F64x2Splat:
case kMips64F64x2ExtractLane:
case kMips64F64x2ReplaceLane:
case kMips64Float32Max: case kMips64Float32Max:
case kMips64Float32Min: case kMips64Float32Min:
case kMips64Float32RoundDown: case kMips64Float32RoundDown:
......
...@@ -2802,6 +2802,7 @@ void InstructionSelector::VisitS128Zero(Node* node) { ...@@ -2802,6 +2802,7 @@ void InstructionSelector::VisitS128Zero(Node* node) {
VisitRR(this, kMips64##Type##Splat, node); \ VisitRR(this, kMips64##Type##Splat, node); \
} }
SIMD_TYPE_LIST(SIMD_VISIT_SPLAT) SIMD_TYPE_LIST(SIMD_VISIT_SPLAT)
SIMD_VISIT_SPLAT(F64x2)
#undef SIMD_VISIT_SPLAT #undef SIMD_VISIT_SPLAT
#define SIMD_VISIT_EXTRACT_LANE(Type) \ #define SIMD_VISIT_EXTRACT_LANE(Type) \
...@@ -2809,6 +2810,7 @@ SIMD_TYPE_LIST(SIMD_VISIT_SPLAT) ...@@ -2809,6 +2810,7 @@ SIMD_TYPE_LIST(SIMD_VISIT_SPLAT)
VisitRRI(this, kMips64##Type##ExtractLane, node); \ VisitRRI(this, kMips64##Type##ExtractLane, node); \
} }
SIMD_TYPE_LIST(SIMD_VISIT_EXTRACT_LANE) SIMD_TYPE_LIST(SIMD_VISIT_EXTRACT_LANE)
SIMD_VISIT_EXTRACT_LANE(F64x2)
#undef SIMD_VISIT_EXTRACT_LANE #undef SIMD_VISIT_EXTRACT_LANE
#define SIMD_VISIT_REPLACE_LANE(Type) \ #define SIMD_VISIT_REPLACE_LANE(Type) \
...@@ -2816,6 +2818,7 @@ SIMD_TYPE_LIST(SIMD_VISIT_EXTRACT_LANE) ...@@ -2816,6 +2818,7 @@ SIMD_TYPE_LIST(SIMD_VISIT_EXTRACT_LANE)
VisitRRIR(this, kMips64##Type##ReplaceLane, node); \ VisitRRIR(this, kMips64##Type##ReplaceLane, node); \
} }
SIMD_TYPE_LIST(SIMD_VISIT_REPLACE_LANE) SIMD_TYPE_LIST(SIMD_VISIT_REPLACE_LANE)
SIMD_VISIT_REPLACE_LANE(F64x2)
#undef SIMD_VISIT_REPLACE_LANE #undef SIMD_VISIT_REPLACE_LANE
#define SIMD_VISIT_UNOP(Name, instruction) \ #define SIMD_VISIT_UNOP(Name, instruction) \
......
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