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

Unified Diff: test/unittests/compiler/x64/instruction-selector-x64-unittest.cc

Issue 928723003: Revert of [x64] Improve instruction selection for TruncateInt64ToInt32. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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/x64/instruction-selector-x64.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/x64/instruction-selector-x64-unittest.cc
diff --git a/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc b/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc
index e524764f828626c4d1459e2857c3b450d1987f7f..1f374c0f856d7662cbcda5812bf556a10696ab73 100644
--- a/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc
+++ b/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc
@@ -60,6 +60,15 @@
EXPECT_EQ(kSSECvtsd2ss, s[0]->arch_opcode());
EXPECT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
+}
+
+
+TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithParameter) {
+ StreamBuilder m(this, kMachInt32, kMachInt64);
+ m.Return(m.TruncateInt64ToInt32(m.Parameter(0)));
+ Stream s = m.Build();
+ ASSERT_EQ(1U, s.size());
+ EXPECT_EQ(kX64Movl, s[0]->arch_opcode());
}
@@ -197,49 +206,37 @@
// TruncateInt64ToInt32.
-TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithParameter) {
+TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithWord64Sar) {
StreamBuilder m(this, kMachInt32, kMachInt64);
- m.Return(m.TruncateInt64ToInt32(m.Parameter(0)));
- Stream s = m.Build();
- ASSERT_EQ(0U, s.size());
-}
-
-
-TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithWord64Sar) {
- TRACED_FORRANGE(int32_t, k, 1, 32) {
- StreamBuilder m(this, kMachInt32, kMachInt64);
- Node* const p = m.Parameter(0);
- Node* const t = m.TruncateInt64ToInt32(m.Word64Sar(p, m.Int64Constant(k)));
- m.Return(t);
- Stream s = m.Build();
- ASSERT_EQ(1U, s.size());
- EXPECT_EQ(kX64Shr, s[0]->arch_opcode());
- ASSERT_EQ(2U, s[0]->InputCount());
- EXPECT_EQ(s.ToVreg(p), s.ToVreg(s[0]->InputAt(0)));
- EXPECT_EQ(k, s.ToInt32(s[0]->InputAt(1)));
- ASSERT_EQ(1U, s[0]->OutputCount());
- EXPECT_TRUE(s.IsSameAsFirst(s[0]->OutputAt(0)));
- EXPECT_EQ(s.ToVreg(t), s.ToVreg(s[0]->OutputAt(0)));
- }
-}
-
-
-TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithWord64Shl) {
- TRACED_FORRANGE(int32_t, k, 1, 31) {
- StreamBuilder m(this, kMachInt32, kMachInt64);
- Node* const p = m.Parameter(0);
- Node* const t = m.TruncateInt64ToInt32(m.Word64Shl(p, m.Int64Constant(k)));
- m.Return(t);
- Stream s = m.Build();
- ASSERT_EQ(1U, s.size());
- EXPECT_EQ(kX64Shl32, s[0]->arch_opcode());
- ASSERT_EQ(2U, s[0]->InputCount());
- EXPECT_EQ(s.ToVreg(p), s.ToVreg(s[0]->InputAt(0)));
- EXPECT_EQ(k, s.ToInt32(s[0]->InputAt(1)));
- ASSERT_EQ(1U, s[0]->OutputCount());
- EXPECT_TRUE(s.IsSameAsFirst(s[0]->OutputAt(0)));
- EXPECT_EQ(s.ToVreg(t), s.ToVreg(s[0]->OutputAt(0)));
- }
+ Node* const p = m.Parameter(0);
+ Node* const t = m.TruncateInt64ToInt32(m.Word64Sar(p, m.Int64Constant(32)));
+ m.Return(t);
+ Stream s = m.Build();
+ ASSERT_EQ(1U, s.size());
+ EXPECT_EQ(kX64Shr, s[0]->arch_opcode());
+ ASSERT_EQ(2U, s[0]->InputCount());
+ EXPECT_EQ(s.ToVreg(p), s.ToVreg(s[0]->InputAt(0)));
+ EXPECT_EQ(32, s.ToInt32(s[0]->InputAt(1)));
+ ASSERT_EQ(1U, s[0]->OutputCount());
+ EXPECT_TRUE(s.IsSameAsFirst(s[0]->OutputAt(0)));
+ EXPECT_EQ(s.ToVreg(t), s.ToVreg(s[0]->OutputAt(0)));
+}
+
+
+TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithWord64Shr) {
+ StreamBuilder m(this, kMachInt32, kMachInt64);
+ Node* const p = m.Parameter(0);
+ Node* const t = m.TruncateInt64ToInt32(m.Word64Shr(p, m.Int64Constant(32)));
+ m.Return(t);
+ Stream s = m.Build();
+ ASSERT_EQ(1U, s.size());
+ EXPECT_EQ(kX64Shr, s[0]->arch_opcode());
+ ASSERT_EQ(2U, s[0]->InputCount());
+ EXPECT_EQ(s.ToVreg(p), s.ToVreg(s[0]->InputAt(0)));
+ EXPECT_EQ(32, s.ToInt32(s[0]->InputAt(1)));
+ ASSERT_EQ(1U, s[0]->OutputCount());
+ EXPECT_TRUE(s.IsSameAsFirst(s[0]->OutputAt(0)));
+ EXPECT_EQ(s.ToVreg(t), s.ToVreg(s[0]->OutputAt(0)));
}
« no previous file with comments | « src/compiler/x64/instruction-selector-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698