Index: test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc |
diff --git a/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc b/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc |
index 457e157d05af4e18ebe7c1ac72f198a25074528a..69423fac1560f3a8e4b44834e3d4245d9c6c13d0 100644 |
--- a/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc |
+++ b/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc |
@@ -402,7 +402,6 @@ TEST_P(InstructionSelectorLogicalTest, Parameter) { |
TEST_P(InstructionSelectorLogicalTest, Immediate) { |
const MachInst2 dpi = GetParam(); |
const MachineType type = dpi.machine_type; |
- // TODO(all): Add support for testing 64-bit immediates. |
if (type == MachineType::Int32()) { |
// Immediate on the right. |
TRACED_FOREACH(int32_t, imm, kLogical32Immediates) { |
@@ -429,6 +428,32 @@ TEST_P(InstructionSelectorLogicalTest, Immediate) { |
EXPECT_EQ(imm, s.ToInt32(s[0]->InputAt(1))); |
EXPECT_EQ(1U, s[0]->OutputCount()); |
} |
+ } else if (type == MachineType::Int64()) { |
+ // Immediate on the right. |
+ TRACED_FOREACH(int64_t, imm, kLogical64Immediates) { |
+ StreamBuilder m(this, type, type); |
+ m.Return((m.*dpi.constructor)(m.Parameter(0), m.Int64Constant(imm))); |
+ Stream s = m.Build(); |
+ ASSERT_EQ(1U, s.size()); |
+ EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode()); |
+ ASSERT_EQ(2U, s[0]->InputCount()); |
+ EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate()); |
+ EXPECT_EQ(imm, s.ToInt64(s[0]->InputAt(1))); |
+ EXPECT_EQ(1U, s[0]->OutputCount()); |
+ } |
+ |
+ // Immediate on the left; all logical ops should commute. |
+ TRACED_FOREACH(int64_t, imm, kLogical64Immediates) { |
+ StreamBuilder m(this, type, type); |
+ m.Return((m.*dpi.constructor)(m.Int64Constant(imm), m.Parameter(0))); |
+ Stream s = m.Build(); |
+ ASSERT_EQ(1U, s.size()); |
+ EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode()); |
+ ASSERT_EQ(2U, s[0]->InputCount()); |
+ EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate()); |
+ EXPECT_EQ(imm, s.ToInt64(s[0]->InputAt(1))); |
+ EXPECT_EQ(1U, s[0]->OutputCount()); |
+ } |
} |
} |