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

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

Issue 846913002: [turbofan] Canonicalize x - K to x + -K. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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/compiler/machine-operator-reducer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/compiler/machine-operator-reducer-unittest.cc
diff --git a/test/unittests/compiler/machine-operator-reducer-unittest.cc b/test/unittests/compiler/machine-operator-reducer-unittest.cc
index 6fdba35f580b451f3892b1303bc74b84b163c199..41e69f0a833532647e0b024e5e9467fb5ce180a7 100644
--- a/test/unittests/compiler/machine-operator-reducer-unittest.cc
+++ b/test/unittests/compiler/machine-operator-reducer-unittest.cc
@@ -842,6 +842,25 @@ TEST_F(MachineOperatorReducerTest, Word32ShlWithWord32Shr) {
// -----------------------------------------------------------------------------
+// Int32Sub
+
+
+TEST_F(MachineOperatorReducerTest, Int32SubWithConstant) {
+ Node* const p0 = Parameter(0);
+ TRACED_FOREACH(int32_t, k, kInt32Values) {
+ Reduction const r =
+ Reduce(graph()->NewNode(machine()->Int32Sub(), p0, Int32Constant(k)));
+ ASSERT_TRUE(r.Changed());
+ if (k == 0) {
+ EXPECT_EQ(p0, r.replacement());
+ } else {
+ EXPECT_THAT(r.replacement(), IsInt32Add(p0, IsInt32Constant(-k)));
+ }
+ }
+}
+
+
+// -----------------------------------------------------------------------------
// Int32Div
« no previous file with comments | « src/compiler/machine-operator-reducer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698