Commit 058f166b authored by jing.bao's avatar jing.bao Committed by Commit Bot

[ia32][wasm] Add F32x4 Add/Sub/Mul/Min/Max

Bug: 
Change-Id: I75de89ca895ef5a408a1d958b75dbc79d07e007a
Reviewed-on: https://chromium-review.googlesource.com/856096Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Jing Bao <jing.bao@intel.com>
Cr-Commit-Position: refs/heads/master@{#50468}
parent 1300f51f
...@@ -1660,6 +1660,61 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -1660,6 +1660,61 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
i.InputOperand(2), i.InputInt8(1) << 4); i.InputOperand(2), i.InputInt8(1) << 4);
break; break;
} }
case kSSEF32x4Add: {
DCHECK_EQ(i.OutputSimd128Register(), i.InputSimd128Register(0));
__ addps(i.OutputSimd128Register(), i.InputOperand(1));
break;
}
case kAVXF32x4Add: {
CpuFeatureScope avx_scope(tasm(), AVX);
__ vaddps(i.OutputSimd128Register(), i.InputSimd128Register(0),
i.InputOperand(1));
break;
}
case kSSEF32x4Sub: {
DCHECK_EQ(i.OutputSimd128Register(), i.InputSimd128Register(0));
__ subps(i.OutputSimd128Register(), i.InputOperand(1));
break;
}
case kAVXF32x4Sub: {
CpuFeatureScope avx_scope(tasm(), AVX);
__ vsubps(i.OutputSimd128Register(), i.InputSimd128Register(0),
i.InputOperand(1));
break;
}
case kSSEF32x4Mul: {
DCHECK_EQ(i.OutputSimd128Register(), i.InputSimd128Register(0));
__ mulps(i.OutputSimd128Register(), i.InputOperand(1));
break;
}
case kAVXF32x4Mul: {
CpuFeatureScope avx_scope(tasm(), AVX);
__ vmulps(i.OutputSimd128Register(), i.InputSimd128Register(0),
i.InputOperand(1));
break;
}
case kSSEF32x4Min: {
DCHECK_EQ(i.OutputSimd128Register(), i.InputSimd128Register(0));
__ minps(i.OutputSimd128Register(), i.InputOperand(1));
break;
}
case kAVXF32x4Min: {
CpuFeatureScope avx_scope(tasm(), AVX);
__ vminps(i.OutputSimd128Register(), i.InputSimd128Register(0),
i.InputOperand(1));
break;
}
case kSSEF32x4Max: {
DCHECK_EQ(i.OutputSimd128Register(), i.InputSimd128Register(0));
__ maxps(i.OutputSimd128Register(), i.InputOperand(1));
break;
}
case kAVXF32x4Max: {
CpuFeatureScope avx_scope(tasm(), AVX);
__ vmaxps(i.OutputSimd128Register(), i.InputSimd128Register(0),
i.InputOperand(1));
break;
}
case kSSEF32x4Eq: { case kSSEF32x4Eq: {
DCHECK_EQ(i.OutputSimd128Register(), i.InputSimd128Register(0)); DCHECK_EQ(i.OutputSimd128Register(), i.InputSimd128Register(0));
__ cmpeqps(i.OutputSimd128Register(), i.InputOperand(1)); __ cmpeqps(i.OutputSimd128Register(), i.InputOperand(1));
......
...@@ -120,6 +120,16 @@ namespace compiler { ...@@ -120,6 +120,16 @@ namespace compiler {
V(AVXF32x4ExtractLane) \ V(AVXF32x4ExtractLane) \
V(SSEF32x4ReplaceLane) \ V(SSEF32x4ReplaceLane) \
V(AVXF32x4ReplaceLane) \ V(AVXF32x4ReplaceLane) \
V(SSEF32x4Add) \
V(AVXF32x4Add) \
V(SSEF32x4Sub) \
V(AVXF32x4Sub) \
V(SSEF32x4Mul) \
V(AVXF32x4Mul) \
V(SSEF32x4Min) \
V(AVXF32x4Min) \
V(SSEF32x4Max) \
V(AVXF32x4Max) \
V(SSEF32x4Eq) \ V(SSEF32x4Eq) \
V(AVXF32x4Eq) \ V(AVXF32x4Eq) \
V(SSEF32x4Ne) \ V(SSEF32x4Ne) \
......
...@@ -103,6 +103,16 @@ int InstructionScheduler::GetTargetInstructionFlags( ...@@ -103,6 +103,16 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kAVXF32x4ExtractLane: case kAVXF32x4ExtractLane:
case kSSEF32x4ReplaceLane: case kSSEF32x4ReplaceLane:
case kAVXF32x4ReplaceLane: case kAVXF32x4ReplaceLane:
case kSSEF32x4Add:
case kAVXF32x4Add:
case kSSEF32x4Sub:
case kAVXF32x4Sub:
case kSSEF32x4Mul:
case kAVXF32x4Mul:
case kSSEF32x4Min:
case kAVXF32x4Min:
case kSSEF32x4Max:
case kAVXF32x4Max:
case kSSEF32x4Eq: case kSSEF32x4Eq:
case kAVXF32x4Eq: case kAVXF32x4Eq:
case kSSEF32x4Ne: case kSSEF32x4Ne:
......
...@@ -1789,6 +1789,11 @@ VISIT_ATOMIC_BINOP(Xor) ...@@ -1789,6 +1789,11 @@ VISIT_ATOMIC_BINOP(Xor)
V(I8x16) V(I8x16)
#define SIMD_BINOP_LIST(V) \ #define SIMD_BINOP_LIST(V) \
V(F32x4Add) \
V(F32x4Sub) \
V(F32x4Mul) \
V(F32x4Min) \
V(F32x4Max) \
V(F32x4Eq) \ V(F32x4Eq) \
V(F32x4Ne) \ V(F32x4Ne) \
V(F32x4Lt) \ V(F32x4Lt) \
......
...@@ -2114,8 +2114,6 @@ void InstructionSelector::VisitF32x4Neg(Node* node) { UNIMPLEMENTED(); } ...@@ -2114,8 +2114,6 @@ void InstructionSelector::VisitF32x4Neg(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitF32x4RecipSqrtApprox(Node* node) { void InstructionSelector::VisitF32x4RecipSqrtApprox(Node* node) {
UNIMPLEMENTED(); UNIMPLEMENTED();
} }
void InstructionSelector::VisitF32x4Add(Node* node) { UNIMPLEMENTED(); }
#endif // !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_ARM64 && !V8_TARGET_ARCH_MIPS #endif // !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_ARM64 && !V8_TARGET_ARCH_MIPS
// && !V8_TARGET_ARCH_MIPS64 && !V8_TARGET_ARCH_X64 // && !V8_TARGET_ARCH_MIPS64 && !V8_TARGET_ARCH_X64
...@@ -2127,14 +2125,6 @@ void InstructionSelector::VisitF32x4AddHoriz(Node* node) { UNIMPLEMENTED(); } ...@@ -2127,14 +2125,6 @@ void InstructionSelector::VisitF32x4AddHoriz(Node* node) { UNIMPLEMENTED(); }
#if !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_ARM64 && !V8_TARGET_ARCH_MIPS && \ #if !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_ARM64 && !V8_TARGET_ARCH_MIPS && \
!V8_TARGET_ARCH_MIPS64 && !V8_TARGET_ARCH_X64 !V8_TARGET_ARCH_MIPS64 && !V8_TARGET_ARCH_X64
void InstructionSelector::VisitF32x4Sub(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitF32x4Mul(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitF32x4Max(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitF32x4Min(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitF32x4RecipApprox(Node* node) { UNIMPLEMENTED(); } void InstructionSelector::VisitF32x4RecipApprox(Node* node) { UNIMPLEMENTED(); }
#endif // !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_ARM64 && !V8_TARGET_ARCH_MIPS #endif // !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_ARM64 && !V8_TARGET_ARCH_MIPS
// && !V8_TARGET_ARCH_MIPS64 && !V8_TARGET_ARCH_X64 // && !V8_TARGET_ARCH_MIPS64 && !V8_TARGET_ARCH_X64
......
...@@ -517,6 +517,8 @@ WASM_SIMD_COMPILED_TEST(F32x4RecipSqrtApprox) { ...@@ -517,6 +517,8 @@ WASM_SIMD_COMPILED_TEST(F32x4RecipSqrtApprox) {
RunF32x4UnOpTest(lower_simd, kExprF32x4RecipSqrtApprox, RecipSqrt, RunF32x4UnOpTest(lower_simd, kExprF32x4RecipSqrtApprox, RecipSqrt,
kApproxError); kApproxError);
} }
#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS ||
// V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_X64
void RunF32x4BinOpTest(LowerSimd lower_simd, WasmOpcode simd_op, void RunF32x4BinOpTest(LowerSimd lower_simd, WasmOpcode simd_op,
FloatBinOp expected_op) { FloatBinOp expected_op) {
...@@ -552,8 +554,6 @@ WASM_SIMD_TEST(F32x4_Min) { ...@@ -552,8 +554,6 @@ WASM_SIMD_TEST(F32x4_Min) {
WASM_SIMD_TEST(F32x4_Max) { WASM_SIMD_TEST(F32x4_Max) {
RunF32x4BinOpTest(lower_simd, kExprF32x4Max, JSMax); RunF32x4BinOpTest(lower_simd, kExprF32x4Max, JSMax);
} }
#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS ||
// V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_X64
void RunF32x4CompareOpTest(LowerSimd lower_simd, WasmOpcode simd_op, void RunF32x4CompareOpTest(LowerSimd lower_simd, WasmOpcode simd_op,
FloatCompareOp expected_op) { FloatCompareOp expected_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