Commit 11eb95fb authored by Ng Zhi An's avatar Ng Zhi An Committed by Commit Bot

[wasm-simd][arm64] Add load and zero extend instructions

Load and zero extend is still in prototype phase [0], implementing for ARM64 in
order to get more benchmark results.

[0] https://github.com/WebAssembly/simd/pull/237

Bug: v8:10713
Change-Id: I7d632324e4bdb0934ab024911201a06b19a1a83d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2416407
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70069}
parent d362c7da
...@@ -2647,6 +2647,14 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -2647,6 +2647,14 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ Uxtl(i.OutputSimd128Register().V2D(), i.OutputSimd128Register().V2S()); __ Uxtl(i.OutputSimd128Register().V2D(), i.OutputSimd128Register().V2S());
break; break;
} }
case kArm64S128LoadMem32Zero: {
__ Ldr(i.OutputSimd128Register().S(), i.MemoryOperand(0));
break;
}
case kArm64S128LoadMem64Zero: {
__ Ldr(i.OutputSimd128Register().D(), i.MemoryOperand(0));
break;
}
#define SIMD_REDUCE_OP_CASE(Op, Instr, format, FORMAT) \ #define SIMD_REDUCE_OP_CASE(Op, Instr, format, FORMAT) \
case Op: { \ case Op: { \
UseScratchRegisterScope scope(tasm()); \ UseScratchRegisterScope scope(tasm()); \
......
...@@ -425,7 +425,11 @@ namespace compiler { ...@@ -425,7 +425,11 @@ namespace compiler {
V(Arm64Word64AtomicCompareExchangeUint8) \ V(Arm64Word64AtomicCompareExchangeUint8) \
V(Arm64Word64AtomicCompareExchangeUint16) \ V(Arm64Word64AtomicCompareExchangeUint16) \
V(Arm64Word64AtomicCompareExchangeUint32) \ V(Arm64Word64AtomicCompareExchangeUint32) \
V(Arm64Word64AtomicCompareExchangeUint64) V(Arm64Word64AtomicCompareExchangeUint64) \
V(Arm64S128LoadMem32Zero) \
V(Arm64S128LoadMem64Zero)
// TODO(v8:10930) Adding new codes before these atomic instructions causes a
// mksnapshot error.
// Addressing modes represent the "shape" of inputs to an instruction. // Addressing modes represent the "shape" of inputs to an instruction.
// Many instructions support multiple addressing modes. Addressing modes // Many instructions support multiple addressing modes. Addressing modes
......
...@@ -380,6 +380,8 @@ int InstructionScheduler::GetTargetInstructionFlags( ...@@ -380,6 +380,8 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kArm64I32x4Load16x4U: case kArm64I32x4Load16x4U:
case kArm64I64x2Load32x2S: case kArm64I64x2Load32x2S:
case kArm64I64x2Load32x2U: case kArm64I64x2Load32x2U:
case kArm64S128LoadMem32Zero:
case kArm64S128LoadMem64Zero:
return kIsLoadOperation; return kIsLoadOperation;
case kArm64Claim: case kArm64Claim:
......
...@@ -640,6 +640,12 @@ void InstructionSelector::VisitLoadTransform(Node* node) { ...@@ -640,6 +640,12 @@ void InstructionSelector::VisitLoadTransform(Node* node) {
case LoadTransformation::kI64x2Load32x2U: case LoadTransformation::kI64x2Load32x2U:
opcode = kArm64I64x2Load32x2U; opcode = kArm64I64x2Load32x2U;
break; break;
case LoadTransformation::kS128LoadMem32Zero:
opcode = kArm64S128LoadMem32Zero;
break;
case LoadTransformation::kS128LoadMem64Zero:
opcode = kArm64S128LoadMem64Zero;
break;
default: default:
UNIMPLEMENTED(); UNIMPLEMENTED();
} }
......
...@@ -3594,7 +3594,7 @@ WASM_SIMD_TEST(I64x2Load32x2S) { ...@@ -3594,7 +3594,7 @@ WASM_SIMD_TEST(I64x2Load32x2S) {
} }
// TODO(v8:10713): Prototyping v128.load32_zero and v128.load64_zero. // TODO(v8:10713): Prototyping v128.load32_zero and v128.load64_zero.
#if V8_TARGET_ARCH_X64 #if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64
template <typename S> template <typename S>
void RunLoadZeroTest(TestExecutionTier execution_tier, LowerSimd lower_simd, void RunLoadZeroTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode op) { WasmOpcode op) {
...@@ -3626,7 +3626,7 @@ WASM_SIMD_TEST_NO_LOWERING(S128LoadMem32Zero) { ...@@ -3626,7 +3626,7 @@ WASM_SIMD_TEST_NO_LOWERING(S128LoadMem32Zero) {
WASM_SIMD_TEST_NO_LOWERING(S128LoadMem64Zero) { WASM_SIMD_TEST_NO_LOWERING(S128LoadMem64Zero) {
RunLoadZeroTest<int64_t>(execution_tier, lower_simd, kExprS128LoadMem64Zero); RunLoadZeroTest<int64_t>(execution_tier, lower_simd, kExprS128LoadMem64Zero);
} }
#endif // V8_TARGET_ARCH_X64 #endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64
#define WASM_SIMD_ANYTRUE_TEST(format, lanes, max, param_type) \ #define WASM_SIMD_ANYTRUE_TEST(format, lanes, max, param_type) \
WASM_SIMD_TEST(S##format##AnyTrue) { \ WASM_SIMD_TEST(S##format##AnyTrue) { \
......
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