Commit bf3cae9e authored by George Wort's avatar George Wort Committed by Commit Bot

[liftoff][arm] Handle trivial case for FloatMax.

Move lhs into dst when lhs == rhs.

Bug: v8:6600, chromium:910223
Change-Id: I5bcb01b57705c52f363a43b2036f0ade0fd451e7
Reviewed-on: https://chromium-review.googlesource.com/c/1357041
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57996}
parent 558c9504
......@@ -175,6 +175,10 @@ inline void EmitFloatMinOrMax(LiftoffAssembler* assm, RegisterType dst,
RegisterType lhs, RegisterType rhs,
MinOrMax min_or_max) {
DCHECK(RegisterType::kSizeInBytes == 4 || RegisterType::kSizeInBytes == 8);
if (lhs == rhs) {
assm->TurboAssembler::Move(dst, lhs);
return;
}
Label done, is_nan;
if (min_or_max == MinOrMax::kMin) {
assm->TurboAssembler::FloatMin(dst, lhs, rhs, &is_nan);
......
......@@ -2839,6 +2839,13 @@ WASM_EXEC_TEST(F32Min) {
}
}
WASM_EXEC_TEST(F32MinSameValue) {
WasmRunner<float, float> r(execution_tier);
BUILD(r, WASM_F32_MIN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
float result = r.Call(5.0f);
CHECK_FLOAT_EQ(5.0f, result);
}
WASM_EXEC_TEST(F64Min) {
WasmRunner<double, double, double> r(execution_tier);
BUILD(r, WASM_F64_MIN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
......@@ -2848,6 +2855,13 @@ WASM_EXEC_TEST(F64Min) {
}
}
WASM_EXEC_TEST(F64MinSameValue) {
WasmRunner<double, double> r(execution_tier);
BUILD(r, WASM_F64_MIN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
double result = r.Call(5.0);
CHECK_DOUBLE_EQ(5.0, result);
}
WASM_EXEC_TEST(F32Max) {
WasmRunner<float, float, float> r(execution_tier);
BUILD(r, WASM_F32_MAX(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
......@@ -2857,6 +2871,13 @@ WASM_EXEC_TEST(F32Max) {
}
}
WASM_EXEC_TEST(F32MaxSameValue) {
WasmRunner<float, float> r(execution_tier);
BUILD(r, WASM_F32_MAX(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
float result = r.Call(5.0f);
CHECK_FLOAT_EQ(5.0f, result);
}
WASM_EXEC_TEST(F64Max) {
WasmRunner<double, double, double> r(execution_tier);
BUILD(r, WASM_F64_MAX(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
......@@ -2869,6 +2890,13 @@ WASM_EXEC_TEST(F64Max) {
}
}
WASM_EXEC_TEST(F64MaxSameValue) {
WasmRunner<double, double> r(execution_tier);
BUILD(r, WASM_F64_MAX(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
double result = r.Call(5.0);
CHECK_DOUBLE_EQ(5.0, result);
}
WASM_EXEC_TEST(I32SConvertF32) {
WasmRunner<int32_t, float> r(execution_tier);
BUILD(r, WASM_I32_SCONVERT_F32(WASM_GET_LOCAL(0)));
......
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