Commit 34f9bcdb authored by Ng Zhi An's avatar Ng Zhi An Committed by Commit Bot

[wasm-simd][arm] Implement integer absolute

Implements i8x16.abs, i16x8.abs, and i32x4.abs.

Bug: v8:10233
Change-Id: I32391e8f895fea808180561d89a4fd24fbead3bb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2067845
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: 's avatarDeepti Gandluri <gdeepti@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66548}
parent beff7956
......@@ -2349,6 +2349,10 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
i.InputSimd128Register(1));
break;
}
case kArmI32x4Abs: {
__ vabs(Neon32, i.OutputSimd128Register(), i.InputSimd128Register(0));
break;
}
case kArmI16x8Splat: {
__ vdup(Neon16, i.OutputSimd128Register(), i.InputRegister(0));
break;
......@@ -2505,6 +2509,10 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
i.InputSimd128Register(1));
break;
}
case kArmI16x8Abs: {
__ vabs(Neon16, i.OutputSimd128Register(), i.InputSimd128Register(0));
break;
}
case kArmI8x16Splat: {
__ vdup(Neon8, i.OutputSimd128Register(), i.InputRegister(0));
break;
......@@ -2637,6 +2645,10 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
i.InputSimd128Register(1));
break;
}
case kArmI8x16Abs: {
__ vabs(Neon8, i.OutputSimd128Register(), i.InputSimd128Register(0));
break;
}
case kArmS128Zero: {
__ veor(i.OutputSimd128Register(), i.OutputSimd128Register(),
i.OutputSimd128Register());
......
......@@ -201,6 +201,7 @@ namespace compiler {
V(ArmI32x4MaxU) \
V(ArmI32x4GtU) \
V(ArmI32x4GeU) \
V(ArmI32x4Abs) \
V(ArmI16x8Splat) \
V(ArmI16x8ExtractLaneS) \
V(ArmI16x8ReplaceLane) \
......@@ -234,6 +235,7 @@ namespace compiler {
V(ArmI16x8GtU) \
V(ArmI16x8GeU) \
V(ArmI16x8RoundingAverageU) \
V(ArmI16x8Abs) \
V(ArmI8x16Splat) \
V(ArmI8x16ExtractLaneS) \
V(ArmI8x16ReplaceLane) \
......@@ -262,6 +264,7 @@ namespace compiler {
V(ArmI8x16GtU) \
V(ArmI8x16GeU) \
V(ArmI8x16RoundingAverageU) \
V(ArmI8x16Abs) \
V(ArmS128Zero) \
V(ArmS128Dup) \
V(ArmS128And) \
......
......@@ -181,6 +181,7 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kArmI32x4MaxU:
case kArmI32x4GtU:
case kArmI32x4GeU:
case kArmI32x4Abs:
case kArmI16x8Splat:
case kArmI16x8ExtractLaneS:
case kArmI16x8ReplaceLane:
......@@ -214,6 +215,7 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kArmI16x8GtU:
case kArmI16x8GeU:
case kArmI16x8RoundingAverageU:
case kArmI16x8Abs:
case kArmI8x16Splat:
case kArmI8x16ExtractLaneS:
case kArmI8x16ReplaceLane:
......@@ -242,6 +244,7 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kArmI8x16GtU:
case kArmI8x16GeU:
case kArmI8x16RoundingAverageU:
case kArmI8x16Abs:
case kArmS128Zero:
case kArmS128Dup:
case kArmS128And:
......
......@@ -2512,12 +2512,15 @@ void InstructionSelector::VisitWord32AtomicPairCompareExchange(Node* node) {
V(I32x4UConvertF32x4, kArmI32x4UConvertF32x4) \
V(I32x4UConvertI16x8Low, kArmI32x4UConvertI16x8Low) \
V(I32x4UConvertI16x8High, kArmI32x4UConvertI16x8High) \
V(I32x4Abs, kArmI32x4Abs) \
V(I16x8SConvertI8x16Low, kArmI16x8SConvertI8x16Low) \
V(I16x8SConvertI8x16High, kArmI16x8SConvertI8x16High) \
V(I16x8Neg, kArmI16x8Neg) \
V(I16x8UConvertI8x16Low, kArmI16x8UConvertI8x16Low) \
V(I16x8UConvertI8x16High, kArmI16x8UConvertI8x16High) \
V(I16x8Abs, kArmI16x8Abs) \
V(I8x16Neg, kArmI8x16Neg) \
V(I8x16Abs, kArmI8x16Abs) \
V(S128Not, kArmS128Not) \
V(S1x4AnyTrue, kArmS1x4AnyTrue) \
V(S1x4AllTrue, kArmS1x4AllTrue) \
......
......@@ -2626,11 +2626,6 @@ void InstructionSelector::VisitF64x2Qfma(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitF64x2Qfms(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitF32x4Qfma(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitF32x4Qfms(Node* node) { UNIMPLEMENTED(); }
#if !V8_TARGET_ARCH_IA32
void InstructionSelector::VisitI8x16Abs(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitI16x8Abs(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitI32x4Abs(Node* node) { UNIMPLEMENTED(); }
#endif // !V8_TARGET_ARCH_IA32
#endif // !V8_TARGET_ARCH_ARM64
void InstructionSelector::VisitI64x2MinS(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitI64x2MaxS(Node* node) { UNIMPLEMENTED(); }
......
......@@ -1831,11 +1831,9 @@ WASM_SIMD_TEST(I32x4Neg) {
base::NegateWithWraparound);
}
#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_IA32
WASM_SIMD_TEST_NO_LOWERING(I32x4Abs) {
RunI32x4UnOpTest(execution_tier, lower_simd, kExprI32x4Abs, Abs);
}
#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_IA32
WASM_SIMD_TEST(S128Not) {
RunI32x4UnOpTest(execution_tier, lower_simd, kExprS128Not, Not);
......@@ -2096,11 +2094,9 @@ WASM_SIMD_TEST(I16x8Neg) {
base::NegateWithWraparound);
}
#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_IA32
WASM_SIMD_TEST_NO_LOWERING(I16x8Abs) {
RunI16x8UnOpTest(execution_tier, lower_simd, kExprI16x8Abs, Abs);
}
#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_IA32
template <typename T = int16_t, typename OpType = T (*)(T, T)>
void RunI16x8BinOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
......@@ -2303,11 +2299,9 @@ WASM_SIMD_TEST(I8x16Neg) {
base::NegateWithWraparound);
}
#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_IA32
WASM_SIMD_TEST_NO_LOWERING(I8x16Abs) {
RunI8x16UnOpTest(execution_tier, lower_simd, kExprI8x16Abs, Abs);
}
#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_IA32
// Tests both signed and unsigned conversion from I16x8 (packing).
WASM_SIMD_TEST(I8x16ConvertI16x8) {
......
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