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)); |
} |
} |
} |