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

Unified Diff: test/cctest/compiler/test-machine-operator-reducer.cc

Issue 599383002: [turbofan] add some simplifications in the machine operator reducer (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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-machine-operator-reducer.cc
diff --git a/test/cctest/compiler/test-machine-operator-reducer.cc b/test/cctest/compiler/test-machine-operator-reducer.cc
index eca1f3cf97005a1042beaa33e4e17e2ef01916e4..e90dbb96e007650af31ea773c44d7325e2d6a971 100644
--- a/test/cctest/compiler/test-machine-operator-reducer.cc
+++ b/test/cctest/compiler/test-machine-operator-reducer.cc
@@ -164,6 +164,11 @@ class ReducerTester : public HandleAndZoneScope {
template <typename T>
void CheckPutConstantOnRight(volatile T constant) {
// TODO(titzer): CHECK(binop->HasProperty(Operator::kCommutative));
+ Double tmp(static_cast<double>(constant));
+ if (tmp.IsSpecial() && !tmp.IsInfinite()) {
titzer 2014/09/25 09:08:41 I would prefer to have this check in the callers.
vincent.belliard 2014/09/25 09:51:18 Done.
+ // Don't check NaNs as they are reduced more.
+ return;
+ }
Node* p = Parameter();
Node* k = Constant<T>(constant);
{
@@ -687,9 +692,9 @@ static void CheckNans(ReducerTester* R) {
pr != nans.end(); ++pr) {
Node* nan1 = R->Constant<double>(*pl);
Node* nan2 = R->Constant<double>(*pr);
- R->CheckBinop(nan1, x, nan1); // x % NaN => NaN
- R->CheckBinop(nan1, nan1, x); // NaN % x => NaN
- R->CheckBinop(nan1, nan2, nan1); // NaN % NaN => NaN
+ R->CheckBinop(nan1, x, nan1); // x op NaN => NaN
+ R->CheckBinop(nan1, nan1, x); // NaN op x => NaN
+ R->CheckBinop(nan1, nan2, nan1); // NaN op NaN => NaN
}
}
}
@@ -707,7 +712,8 @@ TEST(ReduceFloat64Add) {
}
FOR_FLOAT64_INPUTS(i) { R.CheckPutConstantOnRight(*i); }
- // TODO(titzer): CheckNans(&R);
+
+ CheckNans(&R);
}
@@ -721,7 +727,13 @@ TEST(ReduceFloat64Sub) {
R.CheckFoldBinop<double>(x - y, x, y);
}
}
- // TODO(titzer): CheckNans(&R);
+
+ Node* zero = R.Constant<double>(0.0);
+ Node* x = R.Parameter();
+
+ R.CheckBinop(x, x, zero); // x - 0.0 => x
+
+ CheckNans(&R);
}
@@ -783,6 +795,11 @@ TEST(ReduceFloat64Mod) {
}
}
+ Node* x = R.Parameter();
+ Node* zero = R.Constant<double>(0.0);
+
+ R.CheckFoldBinop<double>(v8::base::OS::nan_value(), x, zero);
+
CheckNans(&R);
}
« src/compiler/machine-operator-reducer.cc ('K') | « src/compiler/machine-operator-reducer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698