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

Unified Diff: test/cctest/compiler/test-run-machops.cc

Issue 487723002: [turbofan] Add proper conversion operators for int32<->int64. (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
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 b8c6b9393d0af1b996eddea82516f25ad732faa3..6f37e601f6def1e17630a9ebecbaacde8b3c22a2 100644
--- a/test/cctest/compiler/test-run-machops.cc
+++ b/test/cctest/compiler/test-run-machops.cc
@@ -4202,4 +4202,47 @@ TEST(RunInt32SubWithOverflowInBranchP) {
}
}
+
+TEST(RunChangeInt32ToInt64P) {
+ if (kPointerSize < 8) return;
+ int64_t actual = -1;
+ RawMachineAssemblerTester<int32_t> m(kMachInt32);
+ m.StoreToPointer(&actual, kMachInt64, m.ChangeInt32ToInt64(m.Parameter(0)));
+ m.Return(m.Int32Constant(0));
+ FOR_INT32_INPUTS(i) {
+ int64_t expected = *i;
+ CHECK_EQ(0, m.Call(*i));
+ CHECK_EQ(expected, actual);
+ }
+}
+
+
+TEST(RunChangeUint32ToUint64P) {
+ if (kPointerSize < 8) return;
+ int64_t actual = -1;
+ RawMachineAssemblerTester<int32_t> m(kMachUint32);
+ m.StoreToPointer(&actual, kMachUint64,
+ m.ChangeUint32ToUint64(m.Parameter(0)));
+ m.Return(m.Int32Constant(0));
+ FOR_UINT32_INPUTS(i) {
+ int64_t expected = static_cast<uint64_t>(*i);
+ CHECK_EQ(0, m.Call(*i));
+ CHECK_EQ(expected, actual);
+ }
+}
+
+
+TEST(RunTruncateInt64ToInt32P) {
+ if (kPointerSize < 8) return;
+ int64_t expected = -1;
+ RawMachineAssemblerTester<int32_t> m;
+ m.Return(m.TruncateInt64ToInt32(m.LoadFromPointer(&expected, kMachInt64)));
+ FOR_UINT32_INPUTS(i) {
+ FOR_UINT32_INPUTS(j) {
+ expected = (static_cast<uint64_t>(*j) << 32) | *i;
+ CHECK_UINT32_EQ(expected, m.Call());
+ }
+ }
+}
+
#endif // V8_TURBOFAN_TARGET

Powered by Google App Engine
This is Rietveld 408576698