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 <list> | 5 #include <list> |
6 | 6 |
7 #include "test/cctest/compiler/instruction-selector-tester.h" | 7 #include "test/cctest/compiler/instruction-selector-tester.h" |
| 8 #include "test/cctest/compiler/value-helper.h" |
8 | 9 |
9 using namespace v8::internal; | 10 using namespace v8::internal; |
10 using namespace v8::internal::compiler; | 11 using namespace v8::internal::compiler; |
11 | 12 |
12 namespace { | 13 namespace { |
13 | 14 |
14 typedef RawMachineAssembler::Label MLabel; | 15 typedef RawMachineAssembler::Label MLabel; |
15 | 16 |
16 struct DPI { | 17 struct DPI { |
17 Operator* op; | 18 Operator* op; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 m.SelectInstructions(); | 124 m.SelectInstructions(); |
124 CHECK_EQ(1, m.code.size()); | 125 CHECK_EQ(1, m.code.size()); |
125 CHECK_EQ(dpi.reverse_arch_opcode, m.code[0]->arch_opcode()); | 126 CHECK_EQ(dpi.reverse_arch_opcode, m.code[0]->arch_opcode()); |
126 CHECK_EQ(shift.r_mode, m.code[0]->addressing_mode()); | 127 CHECK_EQ(shift.r_mode, m.code[0]->addressing_mode()); |
127 } | 128 } |
128 } | 129 } |
129 } | 130 } |
130 } | 131 } |
131 | 132 |
132 | 133 |
| 134 TEST(InstructionSelectorDPIAndRotateRightP) { |
| 135 DPIs dpis; |
| 136 for (DPIs::const_iterator i = dpis.begin(); i != dpis.end(); ++i) { |
| 137 DPI dpi = *i; |
| 138 { |
| 139 InstructionSelectorTester m; |
| 140 Node* value = m.Parameter(1); |
| 141 Node* shift = m.Parameter(2); |
| 142 Node* ror = m.Word32Or( |
| 143 m.Word32Shr(value, shift), |
| 144 m.Word32Shl(value, m.Int32Sub(m.Int32Constant(32), shift))); |
| 145 m.Return(m.NewNode(dpi.op, m.Parameter(0), ror)); |
| 146 m.SelectInstructions(); |
| 147 CHECK_EQ(1, m.code.size()); |
| 148 CHECK_EQ(dpi.arch_opcode, m.code[0]->arch_opcode()); |
| 149 CHECK_EQ(kMode_Operand2_R_ROR_R, m.code[0]->addressing_mode()); |
| 150 } |
| 151 { |
| 152 InstructionSelectorTester m; |
| 153 Node* value = m.Parameter(1); |
| 154 Node* shift = m.Parameter(2); |
| 155 Node* ror = |
| 156 m.Word32Or(m.Word32Shl(value, m.Int32Sub(m.Int32Constant(32), shift)), |
| 157 m.Word32Shr(value, shift)); |
| 158 m.Return(m.NewNode(dpi.op, m.Parameter(0), ror)); |
| 159 m.SelectInstructions(); |
| 160 CHECK_EQ(1, m.code.size()); |
| 161 CHECK_EQ(dpi.arch_opcode, m.code[0]->arch_opcode()); |
| 162 CHECK_EQ(kMode_Operand2_R_ROR_R, m.code[0]->addressing_mode()); |
| 163 } |
| 164 { |
| 165 InstructionSelectorTester m; |
| 166 Node* value = m.Parameter(1); |
| 167 Node* shift = m.Parameter(2); |
| 168 Node* ror = m.Word32Or( |
| 169 m.Word32Shr(value, shift), |
| 170 m.Word32Shl(value, m.Int32Sub(m.Int32Constant(32), shift))); |
| 171 m.Return(m.NewNode(dpi.op, ror, m.Parameter(0))); |
| 172 m.SelectInstructions(); |
| 173 CHECK_EQ(1, m.code.size()); |
| 174 CHECK_EQ(dpi.reverse_arch_opcode, m.code[0]->arch_opcode()); |
| 175 CHECK_EQ(kMode_Operand2_R_ROR_R, m.code[0]->addressing_mode()); |
| 176 } |
| 177 { |
| 178 InstructionSelectorTester m; |
| 179 Node* value = m.Parameter(1); |
| 180 Node* shift = m.Parameter(2); |
| 181 Node* ror = |
| 182 m.Word32Or(m.Word32Shl(value, m.Int32Sub(m.Int32Constant(32), shift)), |
| 183 m.Word32Shr(value, shift)); |
| 184 m.Return(m.NewNode(dpi.op, ror, m.Parameter(0))); |
| 185 m.SelectInstructions(); |
| 186 CHECK_EQ(1, m.code.size()); |
| 187 CHECK_EQ(dpi.reverse_arch_opcode, m.code[0]->arch_opcode()); |
| 188 CHECK_EQ(kMode_Operand2_R_ROR_R, m.code[0]->addressing_mode()); |
| 189 } |
| 190 } |
| 191 } |
| 192 |
| 193 |
133 TEST(InstructionSelectorDPIAndShiftImm) { | 194 TEST(InstructionSelectorDPIAndShiftImm) { |
134 DPIs dpis; | 195 DPIs dpis; |
135 Shifts shifts; | 196 Shifts shifts; |
136 for (DPIs::const_iterator i = dpis.begin(); i != dpis.end(); ++i) { | 197 for (DPIs::const_iterator i = dpis.begin(); i != dpis.end(); ++i) { |
137 DPI dpi = *i; | 198 DPI dpi = *i; |
138 for (Shifts::const_iterator j = shifts.begin(); j != shifts.end(); ++j) { | 199 for (Shifts::const_iterator j = shifts.begin(); j != shifts.end(); ++j) { |
139 Shift shift = *j; | 200 Shift shift = *j; |
140 for (int32_t imm = shift.i_low; imm <= shift.i_high; ++imm) { | 201 for (int32_t imm = shift.i_low; imm <= shift.i_high; ++imm) { |
141 { | 202 { |
142 InstructionSelectorTester m; | 203 InstructionSelectorTester m; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 InstructionSelectorTester m; | 278 InstructionSelectorTester m; |
218 m.Return(m.Word32Xor(m.Parameter(0), m.Int32Constant(-1))); | 279 m.Return(m.Word32Xor(m.Parameter(0), m.Int32Constant(-1))); |
219 m.SelectInstructions(); | 280 m.SelectInstructions(); |
220 CHECK_EQ(1, m.code.size()); | 281 CHECK_EQ(1, m.code.size()); |
221 CHECK_EQ(kArmMvn, m.code[0]->arch_opcode()); | 282 CHECK_EQ(kArmMvn, m.code[0]->arch_opcode()); |
222 CHECK_EQ(kMode_Operand2_R, m.code[0]->addressing_mode()); | 283 CHECK_EQ(kMode_Operand2_R, m.code[0]->addressing_mode()); |
223 } | 284 } |
224 } | 285 } |
225 | 286 |
226 | 287 |
| 288 TEST(InstructionSelectorShiftP) { |
| 289 Shifts shifts; |
| 290 for (Shifts::const_iterator i = shifts.begin(); i != shifts.end(); ++i) { |
| 291 Shift shift = *i; |
| 292 InstructionSelectorTester m; |
| 293 m.Return(m.NewNode(shift.op, m.Parameter(0), m.Parameter(1))); |
| 294 m.SelectInstructions(); |
| 295 CHECK_EQ(1, m.code.size()); |
| 296 CHECK_EQ(kArmMov, m.code[0]->arch_opcode()); |
| 297 CHECK_EQ(shift.r_mode, m.code[0]->addressing_mode()); |
| 298 CHECK_EQ(2, m.code[0]->InputCount()); |
| 299 } |
| 300 } |
| 301 |
| 302 |
| 303 TEST(InstructionSelectorShiftImm) { |
| 304 Shifts shifts; |
| 305 for (Shifts::const_iterator i = shifts.begin(); i != shifts.end(); ++i) { |
| 306 Shift shift = *i; |
| 307 for (int32_t imm = shift.i_low; imm <= shift.i_high; ++imm) { |
| 308 InstructionSelectorTester m; |
| 309 m.Return(m.NewNode(shift.op, m.Parameter(0), m.Int32Constant(imm))); |
| 310 m.SelectInstructions(); |
| 311 CHECK_EQ(1, m.code.size()); |
| 312 CHECK_EQ(kArmMov, m.code[0]->arch_opcode()); |
| 313 CHECK_EQ(shift.i_mode, m.code[0]->addressing_mode()); |
| 314 CHECK_EQ(2, m.code[0]->InputCount()); |
| 315 CHECK_EQ(imm, m.ToInt32(m.code[0]->InputAt(1))); |
| 316 } |
| 317 } |
| 318 } |
| 319 |
| 320 |
| 321 TEST(InstructionSelectorRotateRightP) { |
| 322 { |
| 323 InstructionSelectorTester m; |
| 324 Node* value = m.Parameter(0); |
| 325 Node* shift = m.Parameter(1); |
| 326 m.Return( |
| 327 m.Word32Or(m.Word32Shr(value, shift), |
| 328 m.Word32Shl(value, m.Int32Sub(m.Int32Constant(32), shift)))); |
| 329 m.SelectInstructions(); |
| 330 CHECK_EQ(1, m.code.size()); |
| 331 CHECK_EQ(kArmMov, m.code[0]->arch_opcode()); |
| 332 CHECK_EQ(kMode_Operand2_R_ROR_R, m.code[0]->addressing_mode()); |
| 333 CHECK_EQ(2, m.code[0]->InputCount()); |
| 334 } |
| 335 { |
| 336 InstructionSelectorTester m; |
| 337 Node* value = m.Parameter(0); |
| 338 Node* shift = m.Parameter(1); |
| 339 m.Return( |
| 340 m.Word32Or(m.Word32Shl(value, m.Int32Sub(m.Int32Constant(32), shift)), |
| 341 m.Word32Shr(value, shift))); |
| 342 m.SelectInstructions(); |
| 343 CHECK_EQ(1, m.code.size()); |
| 344 CHECK_EQ(kArmMov, m.code[0]->arch_opcode()); |
| 345 CHECK_EQ(kMode_Operand2_R_ROR_R, m.code[0]->addressing_mode()); |
| 346 CHECK_EQ(2, m.code[0]->InputCount()); |
| 347 } |
| 348 } |
| 349 |
| 350 |
| 351 TEST(InstructionSelectorRotateRightImm) { |
| 352 FOR_INPUTS(uint32_t, ror, i) { |
| 353 uint32_t shift = *i; |
| 354 { |
| 355 InstructionSelectorTester m; |
| 356 Node* value = m.Parameter(0); |
| 357 m.Return(m.Word32Or(m.Word32Shr(value, m.Int32Constant(shift)), |
| 358 m.Word32Shl(value, m.Int32Constant(32 - shift)))); |
| 359 m.SelectInstructions(); |
| 360 CHECK_EQ(1, m.code.size()); |
| 361 CHECK_EQ(kArmMov, m.code[0]->arch_opcode()); |
| 362 CHECK_EQ(kMode_Operand2_R_ROR_I, m.code[0]->addressing_mode()); |
| 363 CHECK_EQ(2, m.code[0]->InputCount()); |
| 364 CHECK_EQ(shift, m.ToInt32(m.code[0]->InputAt(1))); |
| 365 } |
| 366 { |
| 367 InstructionSelectorTester m; |
| 368 Node* value = m.Parameter(0); |
| 369 m.Return(m.Word32Or(m.Word32Shl(value, m.Int32Constant(32 - shift)), |
| 370 m.Word32Shr(value, m.Int32Constant(shift)))); |
| 371 m.SelectInstructions(); |
| 372 CHECK_EQ(1, m.code.size()); |
| 373 CHECK_EQ(kArmMov, m.code[0]->arch_opcode()); |
| 374 CHECK_EQ(kMode_Operand2_R_ROR_I, m.code[0]->addressing_mode()); |
| 375 CHECK_EQ(2, m.code[0]->InputCount()); |
| 376 CHECK_EQ(shift, m.ToInt32(m.code[0]->InputAt(1))); |
| 377 } |
| 378 } |
| 379 } |
| 380 |
| 381 |
227 TEST(InstructionSelectorInt32MulP) { | 382 TEST(InstructionSelectorInt32MulP) { |
228 InstructionSelectorTester m; | 383 InstructionSelectorTester m; |
229 m.Return(m.Int32Mul(m.Parameter(0), m.Parameter(1))); | 384 m.Return(m.Int32Mul(m.Parameter(0), m.Parameter(1))); |
230 m.SelectInstructions(); | 385 m.SelectInstructions(); |
231 CHECK_EQ(1, m.code.size()); | 386 CHECK_EQ(1, m.code.size()); |
232 CHECK_EQ(kArmMul, m.code[0]->arch_opcode()); | 387 CHECK_EQ(kArmMul, m.code[0]->arch_opcode()); |
233 } | 388 } |
234 | 389 |
235 | 390 |
236 TEST(InstructionSelectorInt32MulImm) { | 391 TEST(InstructionSelectorInt32MulImm) { |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 CHECK_EQ(kArmCmp, m.code[0]->arch_opcode()); | 1067 CHECK_EQ(kArmCmp, m.code[0]->arch_opcode()); |
913 CHECK_EQ(shift.i_mode, m.code[0]->addressing_mode()); | 1068 CHECK_EQ(shift.i_mode, m.code[0]->addressing_mode()); |
914 CHECK_EQ(kFlags_branch, m.code[0]->flags_mode()); | 1069 CHECK_EQ(kFlags_branch, m.code[0]->flags_mode()); |
915 CHECK_EQ(kEqual, m.code[0]->flags_condition()); | 1070 CHECK_EQ(kEqual, m.code[0]->flags_condition()); |
916 } | 1071 } |
917 } | 1072 } |
918 } | 1073 } |
919 } | 1074 } |
920 | 1075 |
921 | 1076 |
| 1077 TEST(InstructionSelectorBranchWithWord32EqualAndRotateRightP) { |
| 1078 { |
| 1079 InstructionSelectorTester m; |
| 1080 MLabel blocka, blockb; |
| 1081 Node* input = m.Parameter(0); |
| 1082 Node* value = m.Parameter(1); |
| 1083 Node* shift = m.Parameter(2); |
| 1084 Node* ror = |
| 1085 m.Word32Or(m.Word32Shr(value, shift), |
| 1086 m.Word32Shl(value, m.Int32Sub(m.Int32Constant(32), shift))); |
| 1087 m.Branch(m.Word32Equal(input, ror), &blocka, &blockb); |
| 1088 m.Bind(&blocka); |
| 1089 m.Return(m.Int32Constant(1)); |
| 1090 m.Bind(&blockb); |
| 1091 m.Return(m.Int32Constant(0)); |
| 1092 m.SelectInstructions(); |
| 1093 CHECK_EQ(1, m.code.size()); |
| 1094 CHECK_EQ(kArmCmp, m.code[0]->arch_opcode()); |
| 1095 CHECK_EQ(kMode_Operand2_R_ROR_R, m.code[0]->addressing_mode()); |
| 1096 CHECK_EQ(kFlags_branch, m.code[0]->flags_mode()); |
| 1097 CHECK_EQ(kEqual, m.code[0]->flags_condition()); |
| 1098 } |
| 1099 { |
| 1100 InstructionSelectorTester m; |
| 1101 MLabel blocka, blockb; |
| 1102 Node* input = m.Parameter(0); |
| 1103 Node* value = m.Parameter(1); |
| 1104 Node* shift = m.Parameter(2); |
| 1105 Node* ror = |
| 1106 m.Word32Or(m.Word32Shl(value, m.Int32Sub(m.Int32Constant(32), shift)), |
| 1107 m.Word32Shr(value, shift)); |
| 1108 m.Branch(m.Word32Equal(input, ror), &blocka, &blockb); |
| 1109 m.Bind(&blocka); |
| 1110 m.Return(m.Int32Constant(1)); |
| 1111 m.Bind(&blockb); |
| 1112 m.Return(m.Int32Constant(0)); |
| 1113 m.SelectInstructions(); |
| 1114 CHECK_EQ(1, m.code.size()); |
| 1115 CHECK_EQ(kArmCmp, m.code[0]->arch_opcode()); |
| 1116 CHECK_EQ(kMode_Operand2_R_ROR_R, m.code[0]->addressing_mode()); |
| 1117 CHECK_EQ(kFlags_branch, m.code[0]->flags_mode()); |
| 1118 CHECK_EQ(kEqual, m.code[0]->flags_condition()); |
| 1119 } |
| 1120 { |
| 1121 InstructionSelectorTester m; |
| 1122 MLabel blocka, blockb; |
| 1123 Node* input = m.Parameter(0); |
| 1124 Node* value = m.Parameter(1); |
| 1125 Node* shift = m.Parameter(2); |
| 1126 Node* ror = |
| 1127 m.Word32Or(m.Word32Shr(value, shift), |
| 1128 m.Word32Shl(value, m.Int32Sub(m.Int32Constant(32), shift))); |
| 1129 m.Branch(m.Word32Equal(ror, input), &blocka, &blockb); |
| 1130 m.Bind(&blocka); |
| 1131 m.Return(m.Int32Constant(1)); |
| 1132 m.Bind(&blockb); |
| 1133 m.Return(m.Int32Constant(0)); |
| 1134 m.SelectInstructions(); |
| 1135 CHECK_EQ(1, m.code.size()); |
| 1136 CHECK_EQ(kArmCmp, m.code[0]->arch_opcode()); |
| 1137 CHECK_EQ(kMode_Operand2_R_ROR_R, m.code[0]->addressing_mode()); |
| 1138 CHECK_EQ(kFlags_branch, m.code[0]->flags_mode()); |
| 1139 CHECK_EQ(kEqual, m.code[0]->flags_condition()); |
| 1140 } |
| 1141 { |
| 1142 InstructionSelectorTester m; |
| 1143 MLabel blocka, blockb; |
| 1144 Node* input = m.Parameter(0); |
| 1145 Node* value = m.Parameter(1); |
| 1146 Node* shift = m.Parameter(2); |
| 1147 Node* ror = |
| 1148 m.Word32Or(m.Word32Shl(value, m.Int32Sub(m.Int32Constant(32), shift)), |
| 1149 m.Word32Shr(value, shift)); |
| 1150 m.Branch(m.Word32Equal(ror, input), &blocka, &blockb); |
| 1151 m.Bind(&blocka); |
| 1152 m.Return(m.Int32Constant(1)); |
| 1153 m.Bind(&blockb); |
| 1154 m.Return(m.Int32Constant(0)); |
| 1155 m.SelectInstructions(); |
| 1156 CHECK_EQ(1, m.code.size()); |
| 1157 CHECK_EQ(kArmCmp, m.code[0]->arch_opcode()); |
| 1158 CHECK_EQ(kMode_Operand2_R_ROR_R, m.code[0]->addressing_mode()); |
| 1159 CHECK_EQ(kFlags_branch, m.code[0]->flags_mode()); |
| 1160 CHECK_EQ(kEqual, m.code[0]->flags_condition()); |
| 1161 } |
| 1162 } |
| 1163 |
| 1164 |
| 1165 TEST(InstructionSelectorBranchWithWord32EqualAndRotateRightImm) { |
| 1166 FOR_INPUTS(uint32_t, ror, i) { |
| 1167 uint32_t shift = *i; |
| 1168 { |
| 1169 InstructionSelectorTester m; |
| 1170 MLabel blocka, blockb; |
| 1171 Node* input = m.Parameter(0); |
| 1172 Node* value = m.Parameter(1); |
| 1173 Node* ror = m.Word32Or(m.Word32Shr(value, m.Int32Constant(shift)), |
| 1174 m.Word32Shl(value, m.Int32Constant(32 - shift))); |
| 1175 m.Branch(m.Word32Equal(input, ror), &blocka, &blockb); |
| 1176 m.Bind(&blocka); |
| 1177 m.Return(m.Int32Constant(1)); |
| 1178 m.Bind(&blockb); |
| 1179 m.Return(m.Int32Constant(0)); |
| 1180 m.SelectInstructions(); |
| 1181 CHECK_EQ(1, m.code.size()); |
| 1182 CHECK_EQ(kArmCmp, m.code[0]->arch_opcode()); |
| 1183 CHECK_EQ(kMode_Operand2_R_ROR_I, m.code[0]->addressing_mode()); |
| 1184 CHECK_EQ(kFlags_branch, m.code[0]->flags_mode()); |
| 1185 CHECK_EQ(kEqual, m.code[0]->flags_condition()); |
| 1186 CHECK_LE(3, m.code[0]->InputCount()); |
| 1187 CHECK_EQ(shift, m.ToInt32(m.code[0]->InputAt(2))); |
| 1188 } |
| 1189 { |
| 1190 InstructionSelectorTester m; |
| 1191 MLabel blocka, blockb; |
| 1192 Node* input = m.Parameter(0); |
| 1193 Node* value = m.Parameter(1); |
| 1194 Node* ror = m.Word32Or(m.Word32Shl(value, m.Int32Constant(32 - shift)), |
| 1195 m.Word32Shr(value, m.Int32Constant(shift))); |
| 1196 m.Branch(m.Word32Equal(input, ror), &blocka, &blockb); |
| 1197 m.Bind(&blocka); |
| 1198 m.Return(m.Int32Constant(1)); |
| 1199 m.Bind(&blockb); |
| 1200 m.Return(m.Int32Constant(0)); |
| 1201 m.SelectInstructions(); |
| 1202 CHECK_EQ(1, m.code.size()); |
| 1203 CHECK_EQ(kArmCmp, m.code[0]->arch_opcode()); |
| 1204 CHECK_EQ(kMode_Operand2_R_ROR_I, m.code[0]->addressing_mode()); |
| 1205 CHECK_EQ(kFlags_branch, m.code[0]->flags_mode()); |
| 1206 CHECK_EQ(kEqual, m.code[0]->flags_condition()); |
| 1207 CHECK_LE(3, m.code[0]->InputCount()); |
| 1208 CHECK_EQ(shift, m.ToInt32(m.code[0]->InputAt(2))); |
| 1209 } |
| 1210 { |
| 1211 InstructionSelectorTester m; |
| 1212 MLabel blocka, blockb; |
| 1213 Node* input = m.Parameter(0); |
| 1214 Node* value = m.Parameter(1); |
| 1215 Node* ror = m.Word32Or(m.Word32Shr(value, m.Int32Constant(shift)), |
| 1216 m.Word32Shl(value, m.Int32Constant(32 - shift))); |
| 1217 m.Branch(m.Word32Equal(ror, input), &blocka, &blockb); |
| 1218 m.Bind(&blocka); |
| 1219 m.Return(m.Int32Constant(1)); |
| 1220 m.Bind(&blockb); |
| 1221 m.Return(m.Int32Constant(0)); |
| 1222 m.SelectInstructions(); |
| 1223 CHECK_EQ(1, m.code.size()); |
| 1224 CHECK_EQ(kArmCmp, m.code[0]->arch_opcode()); |
| 1225 CHECK_EQ(kMode_Operand2_R_ROR_I, m.code[0]->addressing_mode()); |
| 1226 CHECK_EQ(kFlags_branch, m.code[0]->flags_mode()); |
| 1227 CHECK_EQ(kEqual, m.code[0]->flags_condition()); |
| 1228 CHECK_LE(3, m.code[0]->InputCount()); |
| 1229 CHECK_EQ(shift, m.ToInt32(m.code[0]->InputAt(2))); |
| 1230 } |
| 1231 { |
| 1232 InstructionSelectorTester m; |
| 1233 MLabel blocka, blockb; |
| 1234 Node* input = m.Parameter(0); |
| 1235 Node* value = m.Parameter(1); |
| 1236 Node* ror = m.Word32Or(m.Word32Shl(value, m.Int32Constant(32 - shift)), |
| 1237 m.Word32Shr(value, m.Int32Constant(shift))); |
| 1238 m.Branch(m.Word32Equal(ror, input), &blocka, &blockb); |
| 1239 m.Bind(&blocka); |
| 1240 m.Return(m.Int32Constant(1)); |
| 1241 m.Bind(&blockb); |
| 1242 m.Return(m.Int32Constant(0)); |
| 1243 m.SelectInstructions(); |
| 1244 CHECK_EQ(1, m.code.size()); |
| 1245 CHECK_EQ(kArmCmp, m.code[0]->arch_opcode()); |
| 1246 CHECK_EQ(kMode_Operand2_R_ROR_I, m.code[0]->addressing_mode()); |
| 1247 CHECK_EQ(kFlags_branch, m.code[0]->flags_mode()); |
| 1248 CHECK_EQ(kEqual, m.code[0]->flags_condition()); |
| 1249 CHECK_LE(3, m.code[0]->InputCount()); |
| 1250 CHECK_EQ(shift, m.ToInt32(m.code[0]->InputAt(2))); |
| 1251 } |
| 1252 } |
| 1253 } |
| 1254 |
| 1255 |
922 TEST(InstructionSelectorBranchWithDPIP) { | 1256 TEST(InstructionSelectorBranchWithDPIP) { |
923 DPIs dpis; | 1257 DPIs dpis; |
924 for (DPIs::const_iterator i = dpis.begin(); i != dpis.end(); ++i) { | 1258 for (DPIs::const_iterator i = dpis.begin(); i != dpis.end(); ++i) { |
925 DPI dpi = *i; | 1259 DPI dpi = *i; |
926 { | 1260 { |
927 InstructionSelectorTester m; | 1261 InstructionSelectorTester m; |
928 MLabel blocka, blockb; | 1262 MLabel blocka, blockb; |
929 m.Branch(m.NewNode(dpi.op, m.Parameter(0), m.Parameter(1)), &blocka, | 1263 m.Branch(m.NewNode(dpi.op, m.Parameter(0), m.Parameter(1)), &blocka, |
930 &blockb); | 1264 &blockb); |
931 m.Bind(&blocka); | 1265 m.Bind(&blocka); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 m.Return(m.Int32Constant(0)); | 1302 m.Return(m.Int32Constant(0)); |
969 m.SelectInstructions(); | 1303 m.SelectInstructions(); |
970 CHECK_EQ(1, m.code.size()); | 1304 CHECK_EQ(1, m.code.size()); |
971 CHECK_EQ(dpi.test_arch_opcode, m.code[0]->arch_opcode()); | 1305 CHECK_EQ(dpi.test_arch_opcode, m.code[0]->arch_opcode()); |
972 CHECK_EQ(kMode_Operand2_R, m.code[0]->addressing_mode()); | 1306 CHECK_EQ(kMode_Operand2_R, m.code[0]->addressing_mode()); |
973 CHECK_EQ(kFlags_branch, m.code[0]->flags_mode()); | 1307 CHECK_EQ(kFlags_branch, m.code[0]->flags_mode()); |
974 CHECK_EQ(kEqual, m.code[0]->flags_condition()); | 1308 CHECK_EQ(kEqual, m.code[0]->flags_condition()); |
975 } | 1309 } |
976 } | 1310 } |
977 } | 1311 } |
OLD | NEW |