[wasm-simd] Implement I64x2 Shl ShrS ShrU for arm64
Bug: v8:8460 Change-Id: I70bdd71909fd103f3cc537d3184d2f7225cf8cfa Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1719034 Auto-Submit: Zhi An Ng <zhin@chromium.org> Commit-Queue: Bill Budge <bbudge@chromium.org> Reviewed-by: Bill Budge <bbudge@chromium.org> Cr-Commit-Position: refs/heads/master@{#62929}
This commit is contained in:
parent
1a1138f57a
commit
0cedd8649b
@ -1846,6 +1846,21 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
||||
__ Mov(dst, i.InputInt8(1), i.InputRegister64(2));
|
||||
break;
|
||||
}
|
||||
case kArm64I64x2Shl: {
|
||||
__ Shl(i.OutputSimd128Register().V2D(), i.InputSimd128Register(0).V2D(),
|
||||
i.InputInt6(1));
|
||||
break;
|
||||
}
|
||||
case kArm64I64x2ShrS: {
|
||||
__ Sshr(i.OutputSimd128Register().V2D(), i.InputSimd128Register(0).V2D(),
|
||||
i.InputInt6(1));
|
||||
break;
|
||||
}
|
||||
case kArm64I64x2ShrU: {
|
||||
__ Ushr(i.OutputSimd128Register().V2D(), i.InputSimd128Register(0).V2D(),
|
||||
i.InputInt6(1));
|
||||
break;
|
||||
}
|
||||
case kArm64I32x4Splat: {
|
||||
__ Dup(i.OutputSimd128Register().V4S(), i.InputRegister32(0));
|
||||
break;
|
||||
|
@ -195,6 +195,9 @@ namespace compiler {
|
||||
V(Arm64I64x2Splat) \
|
||||
V(Arm64I64x2ExtractLane) \
|
||||
V(Arm64I64x2ReplaceLane) \
|
||||
V(Arm64I64x2Shl) \
|
||||
V(Arm64I64x2ShrS) \
|
||||
V(Arm64I64x2ShrU) \
|
||||
V(Arm64I32x4Splat) \
|
||||
V(Arm64I32x4ExtractLane) \
|
||||
V(Arm64I32x4ReplaceLane) \
|
||||
|
@ -159,6 +159,9 @@ int InstructionScheduler::GetTargetInstructionFlags(
|
||||
case kArm64I64x2Splat:
|
||||
case kArm64I64x2ExtractLane:
|
||||
case kArm64I64x2ReplaceLane:
|
||||
case kArm64I64x2Shl:
|
||||
case kArm64I64x2ShrS:
|
||||
case kArm64I64x2ShrU:
|
||||
case kArm64I32x4Splat:
|
||||
case kArm64I32x4ExtractLane:
|
||||
case kArm64I32x4ReplaceLane:
|
||||
|
@ -3080,6 +3080,9 @@ void InstructionSelector::VisitInt64AbsWithOverflow(Node* node) {
|
||||
V(S1x16AllTrue, kArm64S1x16AllTrue)
|
||||
|
||||
#define SIMD_SHIFT_OP_LIST(V) \
|
||||
V(I64x2Shl) \
|
||||
V(I64x2ShrS) \
|
||||
V(I64x2ShrU) \
|
||||
V(I32x4Shl) \
|
||||
V(I32x4ShrS) \
|
||||
V(I32x4ShrU) \
|
||||
|
@ -2583,12 +2583,13 @@ void InstructionSelector::VisitF64x2Le(Node* node) { UNIMPLEMENTED(); }
|
||||
void InstructionSelector::VisitI64x2Splat(Node* node) { UNIMPLEMENTED(); }
|
||||
void InstructionSelector::VisitI64x2ExtractLane(Node* node) { UNIMPLEMENTED(); }
|
||||
void InstructionSelector::VisitI64x2ReplaceLane(Node* node) { UNIMPLEMENTED(); }
|
||||
void InstructionSelector::VisitI64x2Shl(Node* node) { UNIMPLEMENTED(); }
|
||||
void InstructionSelector::VisitI64x2ShrS(Node* node) { UNIMPLEMENTED(); }
|
||||
void InstructionSelector::VisitI64x2ShrU(Node* node) { UNIMPLEMENTED(); }
|
||||
#endif // !V8_TARGET_ARCH_ARM64
|
||||
void InstructionSelector::VisitI64x2Neg(Node* node) { UNIMPLEMENTED(); }
|
||||
void InstructionSelector::VisitS1x2AnyTrue(Node* node) { UNIMPLEMENTED(); }
|
||||
void InstructionSelector::VisitS1x2AllTrue(Node* node) { UNIMPLEMENTED(); }
|
||||
void InstructionSelector::VisitI64x2Shl(Node* node) { UNIMPLEMENTED(); }
|
||||
void InstructionSelector::VisitI64x2ShrS(Node* node) { UNIMPLEMENTED(); }
|
||||
void InstructionSelector::VisitI64x2Add(Node* node) { UNIMPLEMENTED(); }
|
||||
void InstructionSelector::VisitI64x2Sub(Node* node) { UNIMPLEMENTED(); }
|
||||
void InstructionSelector::VisitI64x2Mul(Node* node) { UNIMPLEMENTED(); }
|
||||
@ -2598,7 +2599,6 @@ void InstructionSelector::VisitI64x2Eq(Node* node) { UNIMPLEMENTED(); }
|
||||
void InstructionSelector::VisitI64x2Ne(Node* node) { UNIMPLEMENTED(); }
|
||||
void InstructionSelector::VisitI64x2GtS(Node* node) { UNIMPLEMENTED(); }
|
||||
void InstructionSelector::VisitI64x2GeS(Node* node) { UNIMPLEMENTED(); }
|
||||
void InstructionSelector::VisitI64x2ShrU(Node* node) { UNIMPLEMENTED(); }
|
||||
void InstructionSelector::VisitI64x2MinU(Node* node) { UNIMPLEMENTED(); }
|
||||
void InstructionSelector::VisitI64x2MaxU(Node* node) { UNIMPLEMENTED(); }
|
||||
void InstructionSelector::VisitI64x2GtU(Node* node) { UNIMPLEMENTED(); }
|
||||
|
@ -766,6 +766,44 @@ WASM_SIMD_TEST_NO_LOWERING(I64x2ReplaceLane) {
|
||||
CHECK_EQ(i, ReadLittleEndianValue<int64_t>(&g[i]));
|
||||
}
|
||||
}
|
||||
|
||||
void RunI64x2ShiftOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
|
||||
WasmOpcode opcode, Int64ShiftOp expected_op) {
|
||||
for (int shift = 1; shift < 64; shift++) {
|
||||
WasmRunner<int32_t, int64_t> r(execution_tier, lower_simd);
|
||||
int64_t* g = r.builder().AddGlobal<int64_t>(kWasmS128);
|
||||
byte value = 0;
|
||||
byte simd1 = r.AllocateLocal(kWasmS128);
|
||||
BUILD(r,
|
||||
WASM_SET_LOCAL(simd1, WASM_SIMD_I64x2_SPLAT(WASM_GET_LOCAL(value))),
|
||||
WASM_SET_GLOBAL(
|
||||
0, WASM_SIMD_SHIFT_OP(opcode, shift, WASM_GET_LOCAL(simd1))),
|
||||
WASM_ONE);
|
||||
|
||||
FOR_INT64_INPUTS(x) {
|
||||
r.Call(x);
|
||||
int64_t expected = expected_op(x, shift);
|
||||
for (int i = 0; i < 2; i++) {
|
||||
CHECK_EQ(expected, ReadLittleEndianValue<int64_t>(&g[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WASM_SIMD_TEST_NO_LOWERING(I64x2Shl) {
|
||||
RunI64x2ShiftOpTest(execution_tier, lower_simd, kExprI64x2Shl,
|
||||
LogicalShiftLeft);
|
||||
}
|
||||
|
||||
WASM_SIMD_TEST_NO_LOWERING(I64x2ShrS) {
|
||||
RunI64x2ShiftOpTest(execution_tier, lower_simd, kExprI64x2ShrS,
|
||||
ArithmeticShiftRight);
|
||||
}
|
||||
|
||||
WASM_SIMD_TEST_NO_LOWERING(I64x2ShrU) {
|
||||
RunI64x2ShiftOpTest(execution_tier, lower_simd, kExprI64x2ShrU,
|
||||
LogicalShiftRight);
|
||||
}
|
||||
#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64
|
||||
|
||||
#if V8_TARGET_ARCH_X64
|
||||
@ -1205,44 +1243,6 @@ WASM_SIMD_TEST_NO_LOWERING(I64x2GeU) {
|
||||
RunI64x2BinOpTest(execution_tier, lower_simd, kExprI64x2GeU,
|
||||
UnsignedGreaterEqual);
|
||||
}
|
||||
|
||||
void RunI64x2ShiftOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
|
||||
WasmOpcode opcode, Int64ShiftOp expected_op) {
|
||||
for (int shift = 1; shift < 64; shift++) {
|
||||
WasmRunner<int32_t, int64_t> r(execution_tier, lower_simd);
|
||||
int64_t* g = r.builder().AddGlobal<int64_t>(kWasmS128);
|
||||
byte value = 0;
|
||||
byte simd1 = r.AllocateLocal(kWasmS128);
|
||||
BUILD(r,
|
||||
WASM_SET_LOCAL(simd1, WASM_SIMD_I64x2_SPLAT(WASM_GET_LOCAL(value))),
|
||||
WASM_SET_GLOBAL(
|
||||
0, WASM_SIMD_SHIFT_OP(opcode, shift, WASM_GET_LOCAL(simd1))),
|
||||
WASM_ONE);
|
||||
|
||||
FOR_INT64_INPUTS(x) {
|
||||
r.Call(x);
|
||||
int64_t expected = expected_op(x, shift);
|
||||
for (int i = 0; i < 2; i++) {
|
||||
CHECK_EQ(expected, ReadLittleEndianValue<int64_t>(&g[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WASM_SIMD_TEST_NO_LOWERING(I64x2Shl) {
|
||||
RunI64x2ShiftOpTest(execution_tier, lower_simd, kExprI64x2Shl,
|
||||
LogicalShiftLeft);
|
||||
}
|
||||
|
||||
WASM_SIMD_TEST_NO_LOWERING(I64x2ShrS) {
|
||||
RunI64x2ShiftOpTest(execution_tier, lower_simd, kExprI64x2ShrS,
|
||||
ArithmeticShiftRight);
|
||||
}
|
||||
|
||||
WASM_SIMD_TEST_NO_LOWERING(I64x2ShrU) {
|
||||
RunI64x2ShiftOpTest(execution_tier, lower_simd, kExprI64x2ShrU,
|
||||
LogicalShiftRight);
|
||||
}
|
||||
#endif // V8_TARGET_ARCH_X64
|
||||
|
||||
WASM_SIMD_TEST(I32x4Splat) {
|
||||
|
Loading…
Reference in New Issue
Block a user