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

Unified Diff: test/cctest/compiler/test-simplified-lowering.cc

Issue 683873002: [turbofan] Avoid unnecessary (u)int32<->float64 changes in simplified lowering. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Test Created 6 years, 2 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/simplified-lowering.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-simplified-lowering.cc
diff --git a/test/cctest/compiler/test-simplified-lowering.cc b/test/cctest/compiler/test-simplified-lowering.cc
index dcbb9c8260320387d3ddff11c55d989db2cdb402..5ddc10d0513e5ccb1e1b38ed7a6d46b92ba997db 100644
--- a/test/cctest/compiler/test-simplified-lowering.cc
+++ b/test/cctest/compiler/test-simplified-lowering.cc
@@ -1957,3 +1957,51 @@ TEST(NumberModulus_Uint32) {
}
}
}
+
+
+TEST(PhiRepresentation) {
+ HandleAndZoneScope scope;
+ Zone* z = scope.main_zone();
+
+ Factory* f = z->isolate()->factory();
+ Handle<Object> range_min = f->NewNumber(-1e13);
+ Handle<Object> range_max = f->NewNumber(1e+15);
+ Type* range = Type::Range(range_min, range_max, z);
+
+ struct TestData {
+ Type* arg1;
+ Type* arg2;
+ MachineType use;
+ MachineTypeUnion expected;
+ };
+
+ TestData test_data[] = {
+ {Type::Signed32(), Type::Unsigned32(), kMachInt32,
+ kRepWord32 | kTypeNumber},
+ {range, range, kMachUint32, kRepWord32 | kTypeNumber},
+ {Type::Signed32(), Type::Signed32(), kMachInt32, kMachInt32},
+ {Type::Unsigned32(), Type::Unsigned32(), kMachInt32, kMachUint32},
+ {Type::Number(), Type::Signed32(), kMachInt32, kMachFloat64},
+ {Type::Signed32(), Type::String(), kMachInt32, kMachAnyTagged}};
+
+ for (auto const d : test_data) {
+ TestingGraph t(d.arg1, d.arg2, Type::Boolean());
+
+ Node* br = t.graph()->NewNode(t.common()->Branch(), t.p2, t.start);
+ Node* tb = t.graph()->NewNode(t.common()->IfTrue(), br);
+ Node* fb = t.graph()->NewNode(t.common()->IfFalse(), br);
+ Node* m = t.graph()->NewNode(t.common()->Merge(2), tb, fb);
+
+ Node* phi =
+ t.graph()->NewNode(t.common()->Phi(kMachAnyTagged, 2), t.p0, t.p1, m);
+
+ Bounds phi_bounds = Bounds::Either(Bounds(d.arg1), Bounds(d.arg2), z);
+ NodeProperties::SetBounds(phi, phi_bounds);
+
+ Node* use = t.Use(phi, d.use);
+ t.Return(use);
+ t.Lower();
+
+ CHECK_EQ(d.expected, OpParameter<MachineType>(phi));
+ }
+}
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698