| 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 fd4766477fbb0d3ce4ae558a8c8ceedd110b84b0..85b08e99ad10579061bb0afefa3a96b49b322319 100644
|
| --- a/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc
|
| +++ b/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc
|
| @@ -472,7 +472,7 @@ TEST_P(InstructionSelectorAddSubTest, ShiftByImmediateOnRight) {
|
| }
|
|
|
|
|
| -TEST_P(InstructionSelectorAddSubTest, ExtendByte) {
|
| +TEST_P(InstructionSelectorAddSubTest, UnsignedExtendByte) {
|
| const AddSub dpi = GetParam();
|
| const MachineType type = dpi.mi.machine_type;
|
| StreamBuilder m(this, type, type, type);
|
| @@ -487,7 +487,7 @@ TEST_P(InstructionSelectorAddSubTest, ExtendByte) {
|
| }
|
|
|
|
|
| -TEST_P(InstructionSelectorAddSubTest, ExtendHalfword) {
|
| +TEST_P(InstructionSelectorAddSubTest, UnsignedExtendHalfword) {
|
| const AddSub dpi = GetParam();
|
| const MachineType type = dpi.mi.machine_type;
|
| StreamBuilder m(this, type, type, type);
|
| @@ -502,6 +502,40 @@ TEST_P(InstructionSelectorAddSubTest, ExtendHalfword) {
|
| }
|
|
|
|
|
| +TEST_P(InstructionSelectorAddSubTest, SignedExtendByte) {
|
| + const AddSub dpi = GetParam();
|
| + const MachineType type = dpi.mi.machine_type;
|
| + StreamBuilder m(this, type, type, type);
|
| + m.Return((m.*dpi.mi.constructor)(
|
| + m.Parameter(0),
|
| + m.Word32Sar(m.Word32Shl(m.Parameter(1), m.Int32Constant(24)),
|
| + m.Int32Constant(24))));
|
| + Stream s = m.Build();
|
| + ASSERT_EQ(1U, s.size());
|
| + EXPECT_EQ(dpi.mi.arch_opcode, s[0]->arch_opcode());
|
| + EXPECT_EQ(kMode_Operand2_R_SXTB, s[0]->addressing_mode());
|
| + ASSERT_EQ(2U, s[0]->InputCount());
|
| + ASSERT_EQ(1U, s[0]->OutputCount());
|
| +}
|
| +
|
| +
|
| +TEST_P(InstructionSelectorAddSubTest, SignedExtendHalfword) {
|
| + const AddSub dpi = GetParam();
|
| + const MachineType type = dpi.mi.machine_type;
|
| + StreamBuilder m(this, type, type, type);
|
| + m.Return((m.*dpi.mi.constructor)(
|
| + m.Parameter(0),
|
| + m.Word32Sar(m.Word32Shl(m.Parameter(1), m.Int32Constant(16)),
|
| + m.Int32Constant(16))));
|
| + Stream s = m.Build();
|
| + ASSERT_EQ(1U, s.size());
|
| + EXPECT_EQ(dpi.mi.arch_opcode, s[0]->arch_opcode());
|
| + EXPECT_EQ(kMode_Operand2_R_SXTH, s[0]->addressing_mode());
|
| + ASSERT_EQ(2U, s[0]->InputCount());
|
| + ASSERT_EQ(1U, s[0]->OutputCount());
|
| +}
|
| +
|
| +
|
| INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorAddSubTest,
|
| ::testing::ValuesIn(kAddSubInstructions));
|
|
|
| @@ -646,7 +680,7 @@ TEST_F(InstructionSelectorTest, AddShiftByImmediateOnLeft) {
|
| }
|
|
|
|
|
| -TEST_F(InstructionSelectorTest, AddExtendByteOnLeft) {
|
| +TEST_F(InstructionSelectorTest, AddUnsignedExtendByteOnLeft) {
|
| {
|
| StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
|
| m.Return(m.Int32Add(m.Word32And(m.Parameter(0), m.Int32Constant(0xff)),
|
| @@ -672,7 +706,7 @@ TEST_F(InstructionSelectorTest, AddExtendByteOnLeft) {
|
| }
|
|
|
|
|
| -TEST_F(InstructionSelectorTest, AddExtendHalfwordOnLeft) {
|
| +TEST_F(InstructionSelectorTest, AddUnsignedExtendHalfwordOnLeft) {
|
| {
|
| StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
|
| m.Return(m.Int32Add(m.Word32And(m.Parameter(0), m.Int32Constant(0xffff)),
|
| @@ -698,6 +732,66 @@ TEST_F(InstructionSelectorTest, AddExtendHalfwordOnLeft) {
|
| }
|
|
|
|
|
| +TEST_F(InstructionSelectorTest, AddSignedExtendByteOnLeft) {
|
| + {
|
| + StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
|
| + m.Return(
|
| + m.Int32Add(m.Word32Sar(m.Word32Shl(m.Parameter(0), m.Int32Constant(24)),
|
| + m.Int32Constant(24)),
|
| + m.Parameter(1)));
|
| + Stream s = m.Build();
|
| + ASSERT_EQ(1U, s.size());
|
| + EXPECT_EQ(kArm64Add32, s[0]->arch_opcode());
|
| + EXPECT_EQ(kMode_Operand2_R_SXTB, s[0]->addressing_mode());
|
| + ASSERT_EQ(2U, s[0]->InputCount());
|
| + ASSERT_EQ(1U, s[0]->OutputCount());
|
| + }
|
| + {
|
| + StreamBuilder m(this, kMachInt64, kMachInt32, kMachInt64);
|
| + m.Return(
|
| + m.Int64Add(m.Word32Sar(m.Word32Shl(m.Parameter(0), m.Int32Constant(24)),
|
| + m.Int32Constant(24)),
|
| + m.Parameter(1)));
|
| + Stream s = m.Build();
|
| + ASSERT_EQ(1U, s.size());
|
| + EXPECT_EQ(kArm64Add, s[0]->arch_opcode());
|
| + EXPECT_EQ(kMode_Operand2_R_SXTB, s[0]->addressing_mode());
|
| + ASSERT_EQ(2U, s[0]->InputCount());
|
| + ASSERT_EQ(1U, s[0]->OutputCount());
|
| + }
|
| +}
|
| +
|
| +
|
| +TEST_F(InstructionSelectorTest, AddSignedExtendHalfwordOnLeft) {
|
| + {
|
| + StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
|
| + m.Return(
|
| + m.Int32Add(m.Word32Sar(m.Word32Shl(m.Parameter(0), m.Int32Constant(16)),
|
| + m.Int32Constant(16)),
|
| + m.Parameter(1)));
|
| + Stream s = m.Build();
|
| + ASSERT_EQ(1U, s.size());
|
| + EXPECT_EQ(kArm64Add32, s[0]->arch_opcode());
|
| + EXPECT_EQ(kMode_Operand2_R_SXTH, s[0]->addressing_mode());
|
| + ASSERT_EQ(2U, s[0]->InputCount());
|
| + ASSERT_EQ(1U, s[0]->OutputCount());
|
| + }
|
| + {
|
| + StreamBuilder m(this, kMachInt64, kMachInt32, kMachInt64);
|
| + m.Return(
|
| + m.Int64Add(m.Word32Sar(m.Word32Shl(m.Parameter(0), m.Int32Constant(16)),
|
| + m.Int32Constant(16)),
|
| + m.Parameter(1)));
|
| + Stream s = m.Build();
|
| + ASSERT_EQ(1U, s.size());
|
| + EXPECT_EQ(kArm64Add, s[0]->arch_opcode());
|
| + EXPECT_EQ(kMode_Operand2_R_SXTH, s[0]->addressing_mode());
|
| + ASSERT_EQ(2U, s[0]->InputCount());
|
| + ASSERT_EQ(1U, s[0]->OutputCount());
|
| + }
|
| +}
|
| +
|
| +
|
| // -----------------------------------------------------------------------------
|
| // Data processing controlled branches.
|
|
|
|
|