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

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

Issue 2220483003: [x64] Zero/sign-extend loads to 64-bit registers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Removed a couple of wrong assertions. Created 4 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/x64/assembler-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 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
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698