Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Unified Diff: test/cctest/compiler/test-run-machops.cc

Issue 2170343002: [turbofan] Change Float64Max/Float64Min to JavaScript semantics. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: mips/mips64 ports. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/cctest/compiler/test-run-machops.cc
diff --git a/test/cctest/compiler/test-run-machops.cc b/test/cctest/compiler/test-run-machops.cc
index 1b09c9bfc6df95e000c42e3b3204bd61c067bff0..485d084e0dbfcfffe6b1f1c49c165f02edc8ffc0 100644
--- a/test/cctest/compiler/test-run-machops.cc
+++ b/test/cctest/compiler/test-run-machops.cc
@@ -3715,47 +3715,32 @@ TEST(RunFloat64AddP) {
}
}
+namespace {
-TEST(RunFloa32MaxP) {
- RawMachineAssemblerTester<int32_t> m;
- Float32BinopTester bt(&m);
- if (!m.machine()->Float32Max().IsSupported()) return;
-
- bt.AddReturn(m.Float32Max(bt.param0, bt.param1));
+double fmax(double x, double y) {
+ if (std::isnan(x)) return x;
+ if (std::isnan(y)) return y;
+ if (std::signbit(x) < std::signbit(y)) return x;
+ return std::max(x, y);
+}
- FOR_FLOAT32_INPUTS(pl) {
- FOR_FLOAT32_INPUTS(pr) {
- CHECK_DOUBLE_EQ(*pl > *pr ? *pl : *pr, bt.call(*pl, *pr));
- }
- }
+double fmin(double x, double y) {
+ if (std::isnan(x)) return x;
+ if (std::isnan(y)) return y;
+ if (std::signbit(x) < std::signbit(y)) return y;
+ return std::min(x, y);
}
+} // namespace
TEST(RunFloat64MaxP) {
RawMachineAssemblerTester<int32_t> m;
Float64BinopTester bt(&m);
- if (!m.machine()->Float64Max().IsSupported()) return;
-
bt.AddReturn(m.Float64Max(bt.param0, bt.param1));
FOR_FLOAT64_INPUTS(pl) {
FOR_FLOAT64_INPUTS(pr) {
- CHECK_DOUBLE_EQ(*pl > *pr ? *pl : *pr, bt.call(*pl, *pr));
- }
- }
-}
-
-
-TEST(RunFloat32MinP) {
- RawMachineAssemblerTester<int32_t> m;
- Float32BinopTester bt(&m);
- if (!m.machine()->Float32Min().IsSupported()) return;
-
- bt.AddReturn(m.Float32Min(bt.param0, bt.param1));
-
- FOR_FLOAT32_INPUTS(pl) {
- FOR_FLOAT32_INPUTS(pr) {
- CHECK_DOUBLE_EQ(*pl < *pr ? *pl : *pr, bt.call(*pl, *pr));
+ CHECK_DOUBLE_EQ(fmax(*pl, *pr), bt.call(*pl, *pr));
}
}
}
@@ -3764,13 +3749,11 @@ TEST(RunFloat32MinP) {
TEST(RunFloat64MinP) {
RawMachineAssemblerTester<int32_t> m;
Float64BinopTester bt(&m);
- if (!m.machine()->Float64Min().IsSupported()) return;
-
bt.AddReturn(m.Float64Min(bt.param0, bt.param1));
FOR_FLOAT64_INPUTS(pl) {
FOR_FLOAT64_INPUTS(pr) {
- CHECK_DOUBLE_EQ(*pl < *pr ? *pl : *pr, bt.call(*pl, *pr));
+ CHECK_DOUBLE_EQ(fmin(*pl, *pr), bt.call(*pl, *pr));
}
}
}
« no previous file with comments | « src/compiler/x64/instruction-selector-x64.cc ('k') | test/unittests/compiler/arm/instruction-selector-arm-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698