Commit 3a23da2c authored by Ng Zhi An's avatar Ng Zhi An Committed by Commit Bot

[wasm-simd] Implement i64x2.abs in interpreter

Bug: v8:11416
Change-Id: I8148e0191d0632cad6f8b659be4ba58ef4f11d6b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2686307Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72612}
parent 0f514da6
...@@ -330,10 +330,9 @@ constexpr const char* WasmOpcodes::OpcodeName(WasmOpcode opcode) { ...@@ -330,10 +330,9 @@ constexpr const char* WasmOpcodes::OpcodeName(WasmOpcode opcode) {
CASE_I16x8_OP(RoundingAverageU, "avgr_u") CASE_I16x8_OP(RoundingAverageU, "avgr_u")
CASE_I16x8_OP(Q15MulRSatS, "q15mulr_sat_s") CASE_I16x8_OP(Q15MulRSatS, "q15mulr_sat_s")
CASE_I8x16_OP(Abs, "abs") CASE_SIMDI_OP(Abs, "abs")
CASE_I64x2_OP(Abs, "abs")
CASE_I8x16_OP(Popcnt, "popcnt") CASE_I8x16_OP(Popcnt, "popcnt")
CASE_I16x8_OP(Abs, "abs")
CASE_I32x4_OP(Abs, "abs")
CASE_I8x16_OP(BitMask, "bitmask") CASE_I8x16_OP(BitMask, "bitmask")
CASE_I16x8_OP(BitMask, "bitmask") CASE_I16x8_OP(BitMask, "bitmask")
......
...@@ -447,6 +447,7 @@ bool V8_EXPORT_PRIVATE IsJSCompatibleSignature(const FunctionSig* sig, ...@@ -447,6 +447,7 @@ bool V8_EXPORT_PRIVATE IsJSCompatibleSignature(const FunctionSig* sig,
V(I32x4ExtMulHighI16x8U, 0xfdbf, s_ss) \ V(I32x4ExtMulHighI16x8U, 0xfdbf, s_ss) \
V(I32x4TruncSatF64x2SZero, 0xfd55, s_s) \ V(I32x4TruncSatF64x2SZero, 0xfd55, s_s) \
V(I32x4TruncSatF64x2UZero, 0xfd56, s_s) \ V(I32x4TruncSatF64x2UZero, 0xfd56, s_s) \
V(I64x2Abs, 0xfda2, s_s) \
V(I64x2Neg, 0xfdc1, s_s) \ V(I64x2Neg, 0xfdc1, s_s) \
V(V64x2AllTrue, 0xfdcf, i_s) \ V(V64x2AllTrue, 0xfdcf, i_s) \
V(I64x2BitMask, 0xfdc4, i_s) \ V(I64x2BitMask, 0xfdc4, i_s) \
......
...@@ -951,6 +951,14 @@ WASM_SIMD_TEST(I64x2Neg) { ...@@ -951,6 +951,14 @@ WASM_SIMD_TEST(I64x2Neg) {
base::NegateWithWraparound); base::NegateWithWraparound);
} }
WASM_SIMD_TEST(I64x2Abs) {
// TODO(v8:11416) Prototyping i64x2.abs.
if (TestExecutionTier::kInterpreter != execution_tier) {
return;
}
RunI64x2UnOpTest(execution_tier, lower_simd, kExprI64x2Abs, std::abs);
}
void RunI64x2ShiftOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd, void RunI64x2ShiftOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode opcode, Int64ShiftOp expected_op) { WasmOpcode opcode, Int64ShiftOp expected_op) {
// Intentionally shift by 64, should be no-op. // Intentionally shift by 64, should be no-op.
......
...@@ -2249,6 +2249,8 @@ class WasmInterpreterInternals { ...@@ -2249,6 +2249,8 @@ class WasmInterpreterInternals {
(AixFpOpWorkaround<float, &nearbyintf>(a))) (AixFpOpWorkaround<float, &nearbyintf>(a)))
UNOP_CASE(I64x2Neg, i64x2, int2, 2, base::NegateWithWraparound(a)) UNOP_CASE(I64x2Neg, i64x2, int2, 2, base::NegateWithWraparound(a))
UNOP_CASE(I32x4Neg, i32x4, int4, 4, base::NegateWithWraparound(a)) UNOP_CASE(I32x4Neg, i32x4, int4, 4, base::NegateWithWraparound(a))
// Use llabs which will work correctly on both 64-bit and 32-bit.
UNOP_CASE(I64x2Abs, i64x2, int2, 2, std::llabs(a))
UNOP_CASE(I32x4Abs, i32x4, int4, 4, std::abs(a)) UNOP_CASE(I32x4Abs, i32x4, int4, 4, std::abs(a))
UNOP_CASE(S128Not, i32x4, int4, 4, ~a) UNOP_CASE(S128Not, i32x4, int4, 4, ~a)
UNOP_CASE(I16x8Neg, i16x8, int8, 8, base::NegateWithWraparound(a)) UNOP_CASE(I16x8Neg, i16x8, int8, 8, base::NegateWithWraparound(a))
......
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