| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "test/compiler-unittests/instruction-selector-unittest.h" | 5 #include "test/compiler-unittests/instruction-selector-unittest.h" |
| 6 | 6 |
| 7 namespace v8 { | 7 namespace v8 { |
| 8 namespace internal { | 8 namespace internal { |
| 9 namespace compiler { | 9 namespace compiler { |
| 10 | 10 |
| (...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1087 EXPECT_EQ(shift.i_mode, s[0]->addressing_mode()); | 1087 EXPECT_EQ(shift.i_mode, s[0]->addressing_mode()); |
| 1088 ASSERT_EQ(3U, s[0]->InputCount()); | 1088 ASSERT_EQ(3U, s[0]->InputCount()); |
| 1089 EXPECT_EQ(imm, s.ToInt32(s[0]->InputAt(2))); | 1089 EXPECT_EQ(imm, s.ToInt32(s[0]->InputAt(2))); |
| 1090 EXPECT_EQ(1U, s[0]->OutputCount()); | 1090 EXPECT_EQ(1U, s[0]->OutputCount()); |
| 1091 EXPECT_EQ(kFlags_set, s[0]->flags_mode()); | 1091 EXPECT_EQ(kFlags_set, s[0]->flags_mode()); |
| 1092 EXPECT_EQ(kEqual, s[0]->flags_condition()); | 1092 EXPECT_EQ(kEqual, s[0]->flags_condition()); |
| 1093 } | 1093 } |
| 1094 } | 1094 } |
| 1095 | 1095 |
| 1096 | 1096 |
| 1097 TEST_P(ShiftTest, Word32EqualToZeroWithParameters) { |
| 1098 const Shift shift = GetParam(); |
| 1099 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
| 1100 m.Return( |
| 1101 m.Word32Equal(m.Int32Constant(0), |
| 1102 (m.*shift.constructor)(m.Parameter(0), m.Parameter(1)))); |
| 1103 Stream s = m.Build(); |
| 1104 ASSERT_EQ(1U, s.size()); |
| 1105 EXPECT_EQ(kArmMov, s[0]->arch_opcode()); |
| 1106 EXPECT_EQ(shift.r_mode, s[0]->addressing_mode()); |
| 1107 EXPECT_EQ(2U, s[0]->InputCount()); |
| 1108 EXPECT_EQ(2U, s[0]->OutputCount()); |
| 1109 EXPECT_EQ(kFlags_set, s[0]->flags_mode()); |
| 1110 EXPECT_EQ(kEqual, s[0]->flags_condition()); |
| 1111 } |
| 1112 |
| 1113 |
| 1114 TEST_P(ShiftTest, Word32EqualToZeroWithImmediate) { |
| 1115 const Shift shift = GetParam(); |
| 1116 TRACED_FORRANGE(int32_t, imm, shift.i_low, shift.i_high) { |
| 1117 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
| 1118 m.Return(m.Word32Equal( |
| 1119 m.Int32Constant(0), |
| 1120 (m.*shift.constructor)(m.Parameter(0), m.Int32Constant(imm)))); |
| 1121 Stream s = m.Build(); |
| 1122 ASSERT_EQ(1U, s.size()); |
| 1123 EXPECT_EQ(kArmMov, s[0]->arch_opcode()); |
| 1124 EXPECT_EQ(shift.i_mode, s[0]->addressing_mode()); |
| 1125 ASSERT_EQ(2U, s[0]->InputCount()); |
| 1126 EXPECT_EQ(imm, s.ToInt32(s[0]->InputAt(1))); |
| 1127 EXPECT_EQ(2U, s[0]->OutputCount()); |
| 1128 EXPECT_EQ(kFlags_set, s[0]->flags_mode()); |
| 1129 EXPECT_EQ(kEqual, s[0]->flags_condition()); |
| 1130 } |
| 1131 } |
| 1132 |
| 1133 |
| 1097 TEST_P(ShiftTest, Word32NotWithParameters) { | 1134 TEST_P(ShiftTest, Word32NotWithParameters) { |
| 1098 const Shift shift = GetParam(); | 1135 const Shift shift = GetParam(); |
| 1099 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); | 1136 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
| 1100 m.Return(m.Word32Not((m.*shift.constructor)(m.Parameter(0), m.Parameter(1)))); | 1137 m.Return(m.Word32Not((m.*shift.constructor)(m.Parameter(0), m.Parameter(1)))); |
| 1101 Stream s = m.Build(); | 1138 Stream s = m.Build(); |
| 1102 ASSERT_EQ(1U, s.size()); | 1139 ASSERT_EQ(1U, s.size()); |
| 1103 EXPECT_EQ(kArmMvn, s[0]->arch_opcode()); | 1140 EXPECT_EQ(kArmMvn, s[0]->arch_opcode()); |
| 1104 EXPECT_EQ(shift.r_mode, s[0]->addressing_mode()); | 1141 EXPECT_EQ(shift.r_mode, s[0]->addressing_mode()); |
| 1105 EXPECT_EQ(2U, s[0]->InputCount()); | 1142 EXPECT_EQ(2U, s[0]->InputCount()); |
| 1106 EXPECT_EQ(1U, s[0]->OutputCount()); | 1143 EXPECT_EQ(1U, s[0]->OutputCount()); |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1717 ASSERT_EQ(3U, s[0]->InputCount()); | 1754 ASSERT_EQ(3U, s[0]->InputCount()); |
| 1718 EXPECT_EQ(lsb, s.ToInt32(s[0]->InputAt(1))); | 1755 EXPECT_EQ(lsb, s.ToInt32(s[0]->InputAt(1))); |
| 1719 EXPECT_EQ(width, s.ToInt32(s[0]->InputAt(2))); | 1756 EXPECT_EQ(width, s.ToInt32(s[0]->InputAt(2))); |
| 1720 } | 1757 } |
| 1721 } | 1758 } |
| 1722 } | 1759 } |
| 1723 | 1760 |
| 1724 } // namespace compiler | 1761 } // namespace compiler |
| 1725 } // namespace internal | 1762 } // namespace internal |
| 1726 } // namespace v8 | 1763 } // namespace v8 |
| OLD | NEW |