[wasm-relaxed-simd] Fix Liftoff FMA dst register

R=clemensb@chromium.org

Change-Id: Ib65dc59d3c68fd563953a1ee8ec50d9c54310747
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3985845
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83957}
This commit is contained in:
Thibaud Michaud 2022-10-27 14:29:38 +02:00 committed by V8 LUCI CQ
parent cfc4a2d16e
commit caaaec8451
3 changed files with 32 additions and 1 deletions

View File

@ -3714,7 +3714,7 @@ class LiftoffCompiler {
RegClass dst_rc = reg_class_for(kS128);
LiftoffRegister dst = __ GetUnusedRegister(dst_rc, {});
(asm_.*emit_fn)(dst, src1, src2, src3);
__ PushRegister(kS128, src1);
__ PushRegister(kS128, dst);
return;
}

View File

@ -1095,6 +1095,7 @@
'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],
'test-run-wasm-relaxed-simd/RunWasm_RegressFmaReg_liftoff': [SKIP],
}],
]

View File

@ -226,6 +226,36 @@ WASM_RELAXED_SIMD_TEST(F64x2Qfms) {
}
}
}
TEST(RunWasm_RegressFmaReg_liftoff) {
EXPERIMENTAL_FLAG_SCOPE(relaxed_simd);
FLAG_SCOPE(liftoff_only);
TestExecutionTier execution_tier = TestExecutionTier::kLiftoff;
WasmRunner<int32_t, float, float, float> r(execution_tier);
byte local = r.AllocateLocal(kWasmS128);
float* g = r.builder().AddGlobal<float>(kWasmS128);
byte value1 = 0, value2 = 1, value3 = 2;
BUILD(r,
// Get the first arg from a local so that the register is blocked even
// after the arguments have been popped off the stack. This ensures that
// the first source register is not also the destination.
WASM_LOCAL_SET(local, WASM_SIMD_F32x4_SPLAT(WASM_LOCAL_GET(value1))),
WASM_GLOBAL_SET(0, WASM_SIMD_F32x4_QFMA(
WASM_LOCAL_GET(local),
WASM_SIMD_F32x4_SPLAT(WASM_LOCAL_GET(value2)),
WASM_SIMD_F32x4_SPLAT(WASM_LOCAL_GET(value3)))),
WASM_ONE);
for (FMOperation<float> x : qfma_vector<float>()) {
r.Call(x.a, x.b, x.c);
float expected =
ExpectFused(execution_tier) ? x.fused_result : x.unfused_result;
for (int i = 0; i < 4; i++) {
float actual = LANE(g, i);
CheckFloatResult(x.a, x.b, expected, actual, true /* exact */);
}
}
}
#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_S390X ||
// V8_TARGET_ARCH_PPC64 || V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_RISCV64