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 0c1175051d7c41f5626ee2fab63f13ea2e9e942e..60473380858f8ee73367fc167f79b5dbe4075ac0 100644 |
--- a/test/cctest/compiler/test-run-machops.cc |
+++ b/test/cctest/compiler/test-run-machops.cc |
@@ -3790,6 +3790,47 @@ TEST(RunFloat64MinP) { |
} |
} |
+namespace { |
+ |
+float fmax(float x, float y) { |
titzer
2016/08/17 11:26:09
Can you move this to a common place so that it can
ahaas
2016/08/18 07:13:20
Done.
|
+ 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); |
+} |
+ |
+float fmin(float x, float 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(RunFloat32Max) { |
+ RawMachineAssemblerTester<int32_t> m; |
+ Float32BinopTester bt(&m); |
+ bt.AddReturn(m.Float32Max(bt.param0, bt.param1)); |
+ |
+ FOR_FLOAT32_INPUTS(pl) { |
+ FOR_FLOAT32_INPUTS(pr) { |
+ CHECK_FLOAT_EQ(fmax(*pl, *pr), bt.call(*pl, *pr)); |
+ } |
+ } |
+} |
+ |
+TEST(RunFloat32Min) { |
+ RawMachineAssemblerTester<int32_t> m; |
+ Float32BinopTester bt(&m); |
+ bt.AddReturn(m.Float32Min(bt.param0, bt.param1)); |
+ |
+ FOR_FLOAT32_INPUTS(pl) { |
+ FOR_FLOAT32_INPUTS(pr) { |
+ CHECK_FLOAT_EQ(fmin(*pl, *pr), bt.call(*pl, *pr)); |
+ } |
+ } |
+} |
TEST(RunFloat32SubP) { |
RawMachineAssemblerTester<int32_t> m; |