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

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: 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
« src/compiler/machine-operator.cc ('K') | « src/x64/macro-assembler-x64.cc ('k') | no next file » | 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..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;
« src/compiler/machine-operator.cc ('K') | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698