| 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 ae4cff92b25e2e167defcee7c23f081bd292b85e..a743d54f35392693262ac2e6fcf5232c14c5d92f 100644
|
| --- a/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc
|
| +++ b/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc
|
| @@ -2396,6 +2396,89 @@ TEST_F(InstructionSelectorTest, ChangeUint32ToUint64AfterLoad) {
|
| }
|
| }
|
|
|
| +TEST_F(InstructionSelectorTest, ChangeInt32ToInt64AfterLoad) {
|
| + // For each case, test that the conversion is merged into the load
|
| + // operation.
|
| + // ChangeInt32ToInt64(Load_Uint8) -> Ldrb
|
| + {
|
| + StreamBuilder m(this, MachineType::Int64(), MachineType::Pointer(),
|
| + MachineType::Int32());
|
| + m.Return(m.ChangeInt32ToInt64(
|
| + m.Load(MachineType::Uint8(), m.Parameter(0), m.Parameter(1))));
|
| + Stream s = m.Build();
|
| + ASSERT_EQ(1U, s.size());
|
| + EXPECT_EQ(kArm64Ldrb, s[0]->arch_opcode());
|
| + EXPECT_EQ(kMode_MRR, s[0]->addressing_mode());
|
| + EXPECT_EQ(2U, s[0]->InputCount());
|
| + EXPECT_EQ(1U, s[0]->OutputCount());
|
| + }
|
| + // ChangeInt32ToInt64(Load_Int8) -> Ldrsb
|
| + {
|
| + StreamBuilder m(this, MachineType::Int64(), MachineType::Pointer(),
|
| + MachineType::Int32());
|
| + m.Return(m.ChangeInt32ToInt64(
|
| + m.Load(MachineType::Int8(), m.Parameter(0), m.Parameter(1))));
|
| + Stream s = m.Build();
|
| + ASSERT_EQ(1U, s.size());
|
| + EXPECT_EQ(kArm64Ldrsb, s[0]->arch_opcode());
|
| + EXPECT_EQ(kMode_MRR, s[0]->addressing_mode());
|
| + EXPECT_EQ(2U, s[0]->InputCount());
|
| + EXPECT_EQ(1U, s[0]->OutputCount());
|
| + }
|
| + // ChangeInt32ToInt64(Load_Uint16) -> Ldrh
|
| + {
|
| + StreamBuilder m(this, MachineType::Int64(), MachineType::Pointer(),
|
| + MachineType::Int32());
|
| + m.Return(m.ChangeInt32ToInt64(
|
| + m.Load(MachineType::Uint16(), m.Parameter(0), m.Parameter(1))));
|
| + Stream s = m.Build();
|
| + ASSERT_EQ(1U, s.size());
|
| + EXPECT_EQ(kArm64Ldrh, s[0]->arch_opcode());
|
| + EXPECT_EQ(kMode_MRR, s[0]->addressing_mode());
|
| + EXPECT_EQ(2U, s[0]->InputCount());
|
| + EXPECT_EQ(1U, s[0]->OutputCount());
|
| + }
|
| + // ChangeInt32ToInt64(Load_Int16) -> Ldrsh
|
| + {
|
| + StreamBuilder m(this, MachineType::Int64(), MachineType::Pointer(),
|
| + MachineType::Int32());
|
| + m.Return(m.ChangeInt32ToInt64(
|
| + m.Load(MachineType::Int16(), m.Parameter(0), m.Parameter(1))));
|
| + Stream s = m.Build();
|
| + ASSERT_EQ(1U, s.size());
|
| + EXPECT_EQ(kArm64Ldrsh, s[0]->arch_opcode());
|
| + EXPECT_EQ(kMode_MRR, s[0]->addressing_mode());
|
| + EXPECT_EQ(2U, s[0]->InputCount());
|
| + EXPECT_EQ(1U, s[0]->OutputCount());
|
| + }
|
| + // ChangeInt32ToInt64(Load_Uint32) -> Ldrsw
|
| + {
|
| + StreamBuilder m(this, MachineType::Int64(), MachineType::Pointer(),
|
| + MachineType::Int32());
|
| + m.Return(m.ChangeInt32ToInt64(
|
| + m.Load(MachineType::Uint32(), m.Parameter(0), m.Parameter(1))));
|
| + Stream s = m.Build();
|
| + ASSERT_EQ(1U, s.size());
|
| + EXPECT_EQ(kArm64Ldrsw, s[0]->arch_opcode());
|
| + EXPECT_EQ(kMode_MRR, s[0]->addressing_mode());
|
| + EXPECT_EQ(2U, s[0]->InputCount());
|
| + EXPECT_EQ(1U, s[0]->OutputCount());
|
| + }
|
| + // ChangeInt32ToInt64(Load_Int32) -> Ldrsw
|
| + {
|
| + StreamBuilder m(this, MachineType::Int64(), MachineType::Pointer(),
|
| + MachineType::Int32());
|
| + m.Return(m.ChangeInt32ToInt64(
|
| + m.Load(MachineType::Int32(), m.Parameter(0), m.Parameter(1))));
|
| + Stream s = m.Build();
|
| + ASSERT_EQ(1U, s.size());
|
| + EXPECT_EQ(kArm64Ldrsw, s[0]->arch_opcode());
|
| + EXPECT_EQ(kMode_MRR, s[0]->addressing_mode());
|
| + EXPECT_EQ(2U, s[0]->InputCount());
|
| + EXPECT_EQ(1U, s[0]->OutputCount());
|
| + }
|
| +}
|
| +
|
| // -----------------------------------------------------------------------------
|
| // Memory access instructions.
|
|
|
|
|