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 d6ed73266cabaf990b956f36a76433c51dc6207e..b16182c592b43785f43f30dc5936a4fdc03fab4d 100644 |
--- a/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc |
+++ b/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc |
@@ -33,7 +33,6 @@ TEST_F(InstructionSelectorTest, ChangeInt32ToInt64WithParameter) { |
EXPECT_EQ(kX64Movsxlq, s[0]->arch_opcode()); |
} |
- |
TEST_F(InstructionSelectorTest, ChangeUint32ToFloat64WithParameter) { |
StreamBuilder m(this, MachineType::Float64(), MachineType::Uint32()); |
m.Return(m.ChangeUint32ToFloat64(m.Parameter(0))); |
@@ -71,6 +70,41 @@ TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithParameter) { |
EXPECT_EQ(kX64Movl, s[0]->arch_opcode()); |
} |
+namespace { |
+struct LoadWithToInt64Extension { |
+ MachineType type; |
+ ArchOpcode expected_opcode; |
+}; |
+ |
+std::ostream& operator<<(std::ostream& os, |
+ const LoadWithToInt64Extension& i32toi64) { |
+ return os << i32toi64.type; |
+} |
+ |
+static const LoadWithToInt64Extension kLoadWithToInt64Extensions[] = { |
+ {MachineType::Int8(), kX64Movsxbq}, |
+ {MachineType::Uint8(), kX64Movzxbq}, |
+ {MachineType::Int16(), kX64Movsxwq}, |
+ {MachineType::Uint16(), kX64Movzxwq}, |
+ {MachineType::Int32(), kX64Movsxlq}}; |
+ |
+} // namespace |
+ |
+typedef InstructionSelectorTestWithParam<LoadWithToInt64Extension> |
+ InstructionSelectorChangeInt32ToInt64Test; |
+ |
+TEST_P(InstructionSelectorChangeInt32ToInt64Test, ChangeInt32ToInt64WithLoad) { |
+ const LoadWithToInt64Extension extension = GetParam(); |
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Pointer()); |
+ m.Return(m.ChangeInt32ToInt64(m.Load(extension.type, m.Parameter(0)))); |
+ Stream s = m.Build(); |
+ ASSERT_EQ(1U, s.size()); |
+ EXPECT_EQ(extension.expected_opcode, s[0]->arch_opcode()); |
+} |
+ |
+INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, |
+ InstructionSelectorChangeInt32ToInt64Test, |
+ ::testing::ValuesIn(kLoadWithToInt64Extensions)); |
// ----------------------------------------------------------------------------- |
// Loads and stores |