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

Unified Diff: test/compiler-unittests/change-lowering-unittest.cc

Issue 488043002: [turbofan] Add support for ChangeTaggedToUint32 in ChangeLowering. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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/compiler/change-lowering.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/compiler-unittests/change-lowering-unittest.cc
diff --git a/test/compiler-unittests/change-lowering-unittest.cc b/test/compiler-unittests/change-lowering-unittest.cc
index 303c1dc957c9f97175654acb1c26a4f066a8ae15..ce89622e2cc1eb424bb8477991fbcf8d1fa3637d 100644
--- a/test/compiler-unittests/change-lowering-unittest.cc
+++ b/test/compiler-unittests/change-lowering-unittest.cc
@@ -289,6 +289,31 @@ TARGET_TEST_F(ChangeLowering32Test, ChangeTaggedToInt32) {
}
+TARGET_TEST_F(ChangeLowering32Test, ChangeTaggedToUint32) {
+ STATIC_ASSERT(kSmiTag == 0);
+ STATIC_ASSERT(kSmiTagSize == 1);
+
+ Node* val = Parameter(0);
+ Node* node = graph()->NewNode(simplified()->ChangeTaggedToUint32(), val);
+ Reduction reduction = Reduce(node);
+ ASSERT_TRUE(reduction.Changed());
+
+ Node* phi = reduction.replacement();
+ Capture<Node*> branch, if_true;
+ EXPECT_THAT(
+ phi,
+ IsPhi(IsTruncateFloat64ToInt32(IsLoad(
+ kMachFloat64, val, IsInt32Constant(HeapNumberValueOffset()),
+ IsControlEffect(CaptureEq(&if_true)))),
+ IsWord32Sar(val, IsInt32Constant(SmiShiftAmount())),
+ IsMerge(AllOf(CaptureEq(&if_true), IsIfTrue(CaptureEq(&branch))),
+ IsIfFalse(AllOf(
+ CaptureEq(&branch),
+ IsBranch(IsWord32And(val, IsInt32Constant(kSmiTagMask)),
+ graph()->start()))))));
+}
+
+
TARGET_TEST_F(ChangeLowering32Test, ChangeUint32ToTagged) {
STATIC_ASSERT(kSmiTag == 0);
STATIC_ASSERT(kSmiTagSize == 1);
@@ -399,6 +424,32 @@ TARGET_TEST_F(ChangeLowering64Test, ChangeTaggedToInt32) {
}
+TARGET_TEST_F(ChangeLowering64Test, ChangeTaggedToUint32) {
+ STATIC_ASSERT(kSmiTag == 0);
+ STATIC_ASSERT(kSmiTagSize == 1);
+
+ Node* val = Parameter(0);
+ Node* node = graph()->NewNode(simplified()->ChangeTaggedToUint32(), val);
+ Reduction reduction = Reduce(node);
+ ASSERT_TRUE(reduction.Changed());
+
+ Node* phi = reduction.replacement();
+ Capture<Node*> branch, if_true;
+ EXPECT_THAT(
+ phi,
+ IsPhi(IsTruncateFloat64ToInt32(IsLoad(
+ kMachFloat64, val, IsInt32Constant(HeapNumberValueOffset()),
+ IsControlEffect(CaptureEq(&if_true)))),
+ IsTruncateInt64ToInt32(
+ IsWord64Sar(val, IsInt32Constant(SmiShiftAmount()))),
+ IsMerge(AllOf(CaptureEq(&if_true), IsIfTrue(CaptureEq(&branch))),
+ IsIfFalse(AllOf(
+ CaptureEq(&branch),
+ IsBranch(IsWord64And(val, IsInt32Constant(kSmiTagMask)),
+ graph()->start()))))));
+}
+
+
TARGET_TEST_F(ChangeLowering64Test, ChangeUint32ToTagged) {
STATIC_ASSERT(kSmiTag == 0);
STATIC_ASSERT(kSmiTagSize == 1);
« no previous file with comments | « src/compiler/change-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698