Commit 4f7d37a5 authored by Thibaud Michaud's avatar Thibaud Michaud Committed by V8 LUCI CQ

[wasm-relaxed-simd] Implement qfma in Liftoff on ia32/x64

R=clemensb@chromium.org
CC=​gdeepti@chromium.org

Bug: v8:12284
Change-Id: If78b5a86364b015483131ef321ca9e928e8ddfc1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3585338Reviewed-by: 's avatarDeepti Gandluri <gdeepti@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80047}
parent ec41a70e
......@@ -4057,6 +4057,34 @@ void LiftoffAssembler::emit_i64x2_abs(LiftoffRegister dst,
I64x2Abs(liftoff::GetSimd128Register(dst), liftoff::GetSimd128Register(src));
}
void LiftoffAssembler::emit_f32x4_qfma(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f32x4_qfma");
}
void LiftoffAssembler::emit_f32x4_qfms(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f32x4_qfms");
}
void LiftoffAssembler::emit_f64x2_qfma(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f64x2_qfma");
}
void LiftoffAssembler::emit_f64x2_qfms(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f64x2_qfms");
}
void LiftoffAssembler::StackCheck(Label* ool_code, Register limit_address) {
ldr(limit_address, MemOperand(limit_address));
cmp(sp, limit_address);
......
......@@ -3122,6 +3122,34 @@ void LiftoffAssembler::emit_i64x2_abs(LiftoffRegister dst,
Abs(dst.fp().V2D(), src.fp().V2D());
}
void LiftoffAssembler::emit_f32x4_qfma(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f32x4_qfma");
}
void LiftoffAssembler::emit_f32x4_qfms(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f32x4_qfms");
}
void LiftoffAssembler::emit_f64x2_qfma(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f64x2_qfma");
}
void LiftoffAssembler::emit_f64x2_qfms(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f64x2_qfms");
}
void LiftoffAssembler::StackCheck(Label* ool_code, Register limit_address) {
Ldr(limit_address, MemOperand(limit_address));
Cmp(sp, limit_address);
......
......@@ -4455,6 +4455,38 @@ void LiftoffAssembler::emit_f64x2_replace_lane(LiftoffRegister dst,
F64x2ReplaceLane(dst.fp(), src1.fp(), src2.fp(), imm_lane_idx);
}
void LiftoffAssembler::emit_f32x4_qfma(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
F32x4Qfma(dst.fp(), src1.fp(), src2.fp(), src3.fp(),
liftoff::kScratchDoubleReg);
}
void LiftoffAssembler::emit_f32x4_qfms(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
F32x4Qfms(dst.fp(), src1.fp(), src2.fp(), src3.fp(),
liftoff::kScratchDoubleReg);
}
void LiftoffAssembler::emit_f64x2_qfma(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
F64x2Qfma(dst.fp(), src1.fp(), src2.fp(), src3.fp(),
liftoff::kScratchDoubleReg);
}
void LiftoffAssembler::emit_f64x2_qfms(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
F64x2Qfms(dst.fp(), src1.fp(), src2.fp(), src3.fp(),
liftoff::kScratchDoubleReg);
}
void LiftoffAssembler::StackCheck(Label* ool_code, Register limit_address) {
cmp(esp, Operand(limit_address, 0));
j(below_equal, ool_code);
......
......@@ -1452,6 +1452,14 @@ class LiftoffAssembler : public TurboAssembler {
inline void emit_f64x2_replace_lane(LiftoffRegister dst, LiftoffRegister src1,
LiftoffRegister src2,
uint8_t imm_lane_idx);
inline void emit_f32x4_qfma(LiftoffRegister dst, LiftoffRegister src1,
LiftoffRegister src2, LiftoffRegister src3);
inline void emit_f32x4_qfms(LiftoffRegister dst, LiftoffRegister src1,
LiftoffRegister src2, LiftoffRegister src3);
inline void emit_f64x2_qfma(LiftoffRegister dst, LiftoffRegister src1,
LiftoffRegister src2, LiftoffRegister src3);
inline void emit_f64x2_qfms(LiftoffRegister dst, LiftoffRegister src1,
LiftoffRegister src2, LiftoffRegister src3);
inline void StackCheck(Label* ool_code, Register limit_address);
......
......@@ -3503,6 +3503,18 @@ class LiftoffCompiler {
__ PushRegister(kS128, dst);
}
template <typename EmitFn>
void EmitSimdFmaOp(EmitFn emit_fn) {
LiftoffRegister src3 = __ PopToRegister();
LiftoffRegister src2 = __ PopToRegister({src3});
LiftoffRegister src1 = __ PopToRegister({src2, src3});
RegClass dst_rc = reg_class_for(kS128);
LiftoffRegister dst = __ GetUnusedRegister(dst_rc, {});
(asm_.*emit_fn)(dst, src1, src2, src3);
__ PushRegister(kS128, src1);
return;
}
void SimdOp(FullDecoder* decoder, WasmOpcode opcode, base::Vector<Value> args,
Value* result) {
if (!CpuFeatures::SupportsWasmSimd128()) {
......@@ -4009,6 +4021,14 @@ class LiftoffCompiler {
case wasm::kExprI32x4TruncSatF64x2UZero:
return EmitUnOp<kS128, kS128>(
&LiftoffAssembler::emit_i32x4_trunc_sat_f64x2_u_zero);
case wasm::kExprF32x4Qfma:
return EmitSimdFmaOp(&LiftoffAssembler::emit_f32x4_qfma);
case wasm::kExprF32x4Qfms:
return EmitSimdFmaOp(&LiftoffAssembler::emit_f32x4_qfms);
case wasm::kExprF64x2Qfma:
return EmitSimdFmaOp(&LiftoffAssembler::emit_f64x2_qfma);
case wasm::kExprF64x2Qfms:
return EmitSimdFmaOp(&LiftoffAssembler::emit_f64x2_qfms);
default:
unsupported(decoder, kSimd, "simd");
}
......
......@@ -2864,6 +2864,34 @@ void LiftoffAssembler::emit_f64x2_replace_lane(LiftoffRegister dst,
bailout(kSimd, "emit_f64x2_replace_lane");
}
void LiftoffAssembler::emit_f32x4_qfma(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f32x4_qfma");
}
void LiftoffAssembler::emit_f32x4_qfms(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f32x4_qfms");
}
void LiftoffAssembler::emit_f64x2_qfma(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f64x2_qfma");
}
void LiftoffAssembler::emit_f64x2_qfms(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f64x2_qfms");
}
void LiftoffAssembler::StackCheck(Label* ool_code, Register limit_address) {
TurboAssembler::Ld_d(limit_address, MemOperand(limit_address, 0));
TurboAssembler::Branch(ool_code, ule, sp, Operand(limit_address));
......
......@@ -2891,6 +2891,34 @@ void LiftoffAssembler::emit_f64x2_replace_lane(LiftoffRegister dst,
bailout(kSimd, "emit_f64x2_replace_lane");
}
void LiftoffAssembler::emit_f32x4_qfma(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f32x4_qfma");
}
void LiftoffAssembler::emit_f32x4_qfms(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f32x4_qfms");
}
void LiftoffAssembler::emit_f64x2_qfma(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f64x2_qfma");
}
void LiftoffAssembler::emit_f64x2_qfms(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f64x2_qfms");
}
void LiftoffAssembler::StackCheck(Label* ool_code, Register limit_address) {
TurboAssembler::Ulw(limit_address, MemOperand(limit_address));
TurboAssembler::Branch(ool_code, ule, sp, Operand(limit_address));
......
......@@ -3427,6 +3427,34 @@ void LiftoffAssembler::emit_f64x2_replace_lane(LiftoffRegister dst,
insert_d(dst.fp().toW(), imm_lane_idx, kScratchReg);
}
void LiftoffAssembler::emit_f32x4_qfma(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f32x4_qfma");
}
void LiftoffAssembler::emit_f32x4_qfms(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f32x4_qfms");
}
void LiftoffAssembler::emit_f64x2_qfma(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f64x2_qfma");
}
void LiftoffAssembler::emit_f64x2_qfms(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f64x2_qfms");
}
void LiftoffAssembler::StackCheck(Label* ool_code, Register limit_address) {
TurboAssembler::Uld(limit_address, MemOperand(limit_address));
TurboAssembler::Branch(ool_code, ule, sp, Operand(limit_address));
......
......@@ -2885,6 +2885,34 @@ void LiftoffAssembler::emit_i8x16_add_sat_u(LiftoffRegister dst,
bailout(kUnsupportedArchitecture, "emit_i8x16addsaturate_u");
}
void LiftoffAssembler::emit_f32x4_qfma(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f32x4_qfma");
}
void LiftoffAssembler::emit_f32x4_qfms(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f32x4_qfms");
}
void LiftoffAssembler::emit_f64x2_qfma(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f64x2_qfma");
}
void LiftoffAssembler::emit_f64x2_qfms(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f64x2_qfms");
}
void LiftoffAssembler::StackCheck(Label* ool_code, Register limit_address) {
LoadU64(limit_address, MemOperand(limit_address), r0);
CmpU64(sp, limit_address);
......
......@@ -3619,6 +3619,34 @@ void LiftoffAssembler::emit_s128_set_if_nan(Register dst, LiftoffRegister src,
Sw(kScratchReg, MemOperand(dst));
}
void LiftoffAssembler::emit_f32x4_qfma(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f32x4_qfma");
}
void LiftoffAssembler::emit_f32x4_qfms(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f32x4_qfms");
}
void LiftoffAssembler::emit_f64x2_qfma(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f64x2_qfma");
}
void LiftoffAssembler::emit_f64x2_qfms(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f64x2_qfms");
}
void LiftoffAssembler::StackCheck(Label* ool_code, Register limit_address) {
TurboAssembler::Ld(limit_address, MemOperand(limit_address));
TurboAssembler::Branch(ool_code, ule, sp, Operand(limit_address));
......
......@@ -2894,6 +2894,34 @@ void LiftoffAssembler::emit_i32x4_trunc_sat_f64x2_u_zero(LiftoffRegister dst,
I32x4TruncSatF64x2UZero(dst.fp(), src.fp(), kScratchDoubleReg);
}
void LiftoffAssembler::emit_f32x4_qfma(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f32x4_qfma");
}
void LiftoffAssembler::emit_f32x4_qfms(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f32x4_qfms");
}
void LiftoffAssembler::emit_f64x2_qfma(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f64x2_qfma");
}
void LiftoffAssembler::emit_f64x2_qfms(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
bailout(kSimd, "emit_f64x2_qfms");
}
void LiftoffAssembler::StackCheck(Label* ool_code, Register limit_address) {
LoadU64(limit_address, MemOperand(limit_address));
CmpU64(sp, limit_address);
......
......@@ -4004,6 +4004,34 @@ void LiftoffAssembler::emit_f64x2_replace_lane(LiftoffRegister dst,
F64x2ReplaceLane(dst.fp(), src1.fp(), src2.fp(), imm_lane_idx);
}
void LiftoffAssembler::emit_f32x4_qfma(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
F32x4Qfma(dst.fp(), src1.fp(), src2.fp(), src3.fp(), kScratchDoubleReg);
}
void LiftoffAssembler::emit_f32x4_qfms(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
F32x4Qfms(dst.fp(), src1.fp(), src2.fp(), src3.fp(), kScratchDoubleReg);
}
void LiftoffAssembler::emit_f64x2_qfma(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
F64x2Qfma(dst.fp(), src1.fp(), src2.fp(), src3.fp(), kScratchDoubleReg);
}
void LiftoffAssembler::emit_f64x2_qfms(LiftoffRegister dst,
LiftoffRegister src1,
LiftoffRegister src2,
LiftoffRegister src3) {
F64x2Qfms(dst.fp(), src1.fp(), src2.fp(), src3.fp(), kScratchDoubleReg);
}
void LiftoffAssembler::StackCheck(Label* ool_code, Register limit_address) {
cmpq(rsp, Operand(limit_address, 0));
j(below_equal, ool_code);
......
......@@ -138,6 +138,23 @@
'test-swiss-name-dictionary-csa/SameH2': [PASS, HEAVY],
'test-intl/StringLocaleCompareFastPath': [['mode != release', SKIP], SLOW, NO_VARIANTS],
# TODO(12284): Implement relaxed SIMD in Liftoff.
'test-run-wasm-relaxed-simd/RunWasm_I8x16RelaxedSwizzle_liftoff': [SKIP],
'test-run-wasm-relaxed-simd/RunWasm_I8x16RelaxedLaneSelect_liftoff': [SKIP],
'test-run-wasm-relaxed-simd/RunWasm_I16x8RelaxedLaneSelect_liftoff': [SKIP],
'test-run-wasm-relaxed-simd/RunWasm_I32x4RelaxedLaneSelect_liftoff': [SKIP],
'test-run-wasm-relaxed-simd/RunWasm_I64x2RelaxedLaneSelect_liftoff': [SKIP],
'test-run-wasm-relaxed-simd/RunWasm_F32x4RelaxedMin_liftoff': [SKIP],
'test-run-wasm-relaxed-simd/RunWasm_F32x4RelaxedMax_liftoff': [SKIP],
'test-run-wasm-relaxed-simd/RunWasm_F64x2RelaxedMin_liftoff': [SKIP],
'test-run-wasm-relaxed-simd/RunWasm_F64x2RelaxedMax_liftoff': [SKIP],
'test-run-wasm-relaxed-simd/RunWasm_I32x4RelaxedTruncF32x4S_liftoff': [SKIP],
'test-run-wasm-relaxed-simd/RunWasm_I32x4RelaxedTruncF32x4U_liftoff': [SKIP],
'test-run-wasm-relaxed-simd/RunWasm_I32x4RelaxedTruncF64x2SZero_liftoff': [SKIP],
'test-run-wasm-relaxed-simd/RunWasm_I32x4RelaxedTruncF64x2UZero_liftoff': [SKIP],
'test-run-wasm-relaxed-simd/RunWasm_F32x4RecipApprox_liftoff': [SKIP],
'test-run-wasm-relaxed-simd/RunWasm_F32x4RecipSqrtApprox_liftoff': [SKIP],
}], # ALWAYS
##############################################################################
......@@ -1228,4 +1245,12 @@
'test-concurrent-shared-function-info/TestConcurrentSharedFunctionInfo': [SKIP],
}], # variant == assert_types
['arch != ia32 and arch != x64', {
# TODO(12284): Implement relaxed SIMD in Liftoff on missing architectures.
'test-run-wasm-relaxed-simd/RunWasm_F32x4Qfma_liftoff': [SKIP],
'test-run-wasm-relaxed-simd/RunWasm_F32x4Qfms_liftoff': [SKIP],
'test-run-wasm-relaxed-simd/RunWasm_F64x2Qfma_liftoff': [SKIP],
'test-run-wasm-relaxed-simd/RunWasm_F64x2Qfms_liftoff': [SKIP],
}]
]
......@@ -31,6 +31,11 @@ namespace test_run_wasm_relaxed_simd {
EXPERIMENTAL_FLAG_SCOPE(relaxed_simd); \
RunWasm_##name##_Impl(TestExecutionTier::kInterpreter); \
} \
TEST(RunWasm_##name##_liftoff) { \
EXPERIMENTAL_FLAG_SCOPE(relaxed_simd); \
FLAG_SCOPE(liftoff_only); \
RunWasm_##name##_Impl(TestExecutionTier::kLiftoff); \
} \
void RunWasm_##name##_Impl(TestExecutionTier execution_tier)
#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_S390X || \
......
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