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

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

Issue 2252863003: [turbofan] Add Float32(Max|Min) machine operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Type is number now. Created 4 years, 4 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
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | test/cctest/compiler/value-helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..50b46d7d0e288424e10ab97155590f346b6a4bf6 100644
--- a/test/cctest/compiler/test-run-machops.cc
+++ b/test/cctest/compiler/test-run-machops.cc
@@ -10,6 +10,7 @@
#include "src/base/ieee754.h"
#include "src/base/utils/random-number-generator.h"
#include "src/codegen.h"
+#include "src/utils.h"
#include "test/cctest/cctest.h"
#include "test/cctest/compiler/codegen-tester.h"
#include "test/cctest/compiler/graph-builder-tester.h"
@@ -3747,24 +3748,6 @@ TEST(RunFloat64AddP) {
}
}
-namespace {
-
-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);
-}
-
-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);
@@ -3772,7 +3755,7 @@ TEST(RunFloat64MaxP) {
FOR_FLOAT64_INPUTS(pl) {
FOR_FLOAT64_INPUTS(pr) {
- CHECK_DOUBLE_EQ(fmax(*pl, *pr), bt.call(*pl, *pr));
+ CHECK_DOUBLE_EQ(JSMax(*pl, *pr), bt.call(*pl, *pr));
}
}
}
@@ -3785,11 +3768,34 @@ TEST(RunFloat64MinP) {
FOR_FLOAT64_INPUTS(pl) {
FOR_FLOAT64_INPUTS(pr) {
- CHECK_DOUBLE_EQ(fmin(*pl, *pr), bt.call(*pl, *pr));
+ CHECK_DOUBLE_EQ(JSMin(*pl, *pr), bt.call(*pl, *pr));
}
}
}
+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(JSMax(*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(JSMin(*pl, *pr), bt.call(*pl, *pr));
+ }
+ }
+}
TEST(RunFloat32SubP) {
RawMachineAssemblerTester<int32_t> m;
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | test/cctest/compiler/value-helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698