Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: test/cctest/compiler/test-instruction-selector-arm.cc

Issue 415403005: [turbofan] Support for combining branches with <Operation>WithOverflow. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/compiler/x64/instruction-selector-x64.cc ('k') | test/cctest/compiler/test-run-machops.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "test/cctest/compiler/value-helper.h"
9 9
10 using namespace v8::internal; 10 using namespace v8::internal;
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 InstructionSelectorTester m; 253 InstructionSelectorTester m;
254 m.Return( 254 m.Return(
255 m.Projection(1, m.NewNode(odpi.op, m.Parameter(0), m.Parameter(1)))); 255 m.Projection(1, m.NewNode(odpi.op, m.Parameter(0), m.Parameter(1))));
256 m.SelectInstructions(); 256 m.SelectInstructions();
257 CHECK_EQ(1, m.code.size()); 257 CHECK_EQ(1, m.code.size());
258 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode()); 258 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode());
259 CHECK_EQ(kMode_Operand2_R, m.code[0]->addressing_mode()); 259 CHECK_EQ(kMode_Operand2_R, m.code[0]->addressing_mode());
260 CHECK_EQ(kFlags_set, m.code[0]->flags_mode()); 260 CHECK_EQ(kFlags_set, m.code[0]->flags_mode());
261 CHECK_EQ(kOverflow, m.code[0]->flags_condition()); 261 CHECK_EQ(kOverflow, m.code[0]->flags_condition());
262 CHECK_EQ(2, m.code[0]->InputCount()); 262 CHECK_EQ(2, m.code[0]->InputCount());
263 CHECK_EQ(1, m.code[0]->OutputCount()); 263 CHECK_LE(1, m.code[0]->OutputCount());
264 } 264 }
265 { 265 {
266 InstructionSelectorTester m; 266 InstructionSelectorTester m;
267 m.Return( 267 m.Return(
268 m.Projection(0, m.NewNode(odpi.op, m.Parameter(0), m.Parameter(1)))); 268 m.Projection(0, m.NewNode(odpi.op, m.Parameter(0), m.Parameter(1))));
269 m.SelectInstructions(); 269 m.SelectInstructions();
270 CHECK_EQ(1, m.code.size()); 270 CHECK_EQ(1, m.code.size());
271 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode()); 271 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode());
272 CHECK_EQ(kMode_Operand2_R, m.code[0]->addressing_mode()); 272 CHECK_EQ(kMode_Operand2_R, m.code[0]->addressing_mode());
273 CHECK_EQ(kFlags_none, m.code[0]->flags_mode()); 273 CHECK_EQ(kFlags_none, m.code[0]->flags_mode());
274 CHECK_EQ(2, m.code[0]->InputCount()); 274 CHECK_EQ(2, m.code[0]->InputCount());
275 CHECK_EQ(1, m.code[0]->OutputCount()); 275 CHECK_LE(1, m.code[0]->OutputCount());
276 } 276 }
277 { 277 {
278 InstructionSelectorTester m; 278 InstructionSelectorTester m;
279 Node* node = m.NewNode(odpi.op, m.Parameter(0), m.Parameter(1)); 279 Node* node = m.NewNode(odpi.op, m.Parameter(0), m.Parameter(1));
280 m.Return(m.Word32Equal(m.Projection(0, node), m.Projection(1, node))); 280 m.Return(m.Word32Equal(m.Projection(0, node), m.Projection(1, node)));
281 m.SelectInstructions(); 281 m.SelectInstructions();
282 CHECK_LE(1, m.code.size()); 282 CHECK_LE(1, m.code.size());
283 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode()); 283 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode());
284 CHECK_EQ(kMode_Operand2_R, m.code[0]->addressing_mode()); 284 CHECK_EQ(kMode_Operand2_R, m.code[0]->addressing_mode());
285 CHECK_EQ(kFlags_set, m.code[0]->flags_mode()); 285 CHECK_EQ(kFlags_set, m.code[0]->flags_mode());
(...skipping 18 matching lines...) Expand all
304 m.Return(m.Projection( 304 m.Return(m.Projection(
305 1, m.NewNode(odpi.op, m.Parameter(0), m.Int32Constant(imm)))); 305 1, m.NewNode(odpi.op, m.Parameter(0), m.Int32Constant(imm))));
306 m.SelectInstructions(); 306 m.SelectInstructions();
307 CHECK_EQ(1, m.code.size()); 307 CHECK_EQ(1, m.code.size());
308 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode()); 308 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode());
309 CHECK_EQ(kMode_Operand2_I, m.code[0]->addressing_mode()); 309 CHECK_EQ(kMode_Operand2_I, m.code[0]->addressing_mode());
310 CHECK_EQ(kFlags_set, m.code[0]->flags_mode()); 310 CHECK_EQ(kFlags_set, m.code[0]->flags_mode());
311 CHECK_EQ(kOverflow, m.code[0]->flags_condition()); 311 CHECK_EQ(kOverflow, m.code[0]->flags_condition());
312 CHECK_EQ(2, m.code[0]->InputCount()); 312 CHECK_EQ(2, m.code[0]->InputCount());
313 CHECK_EQ(imm, m.ToInt32(m.code[0]->InputAt(1))); 313 CHECK_EQ(imm, m.ToInt32(m.code[0]->InputAt(1)));
314 CHECK_EQ(1, m.code[0]->OutputCount()); 314 CHECK_LE(1, m.code[0]->OutputCount());
315 } 315 }
316 { 316 {
317 InstructionSelectorTester m; 317 InstructionSelectorTester m;
318 m.Return(m.Projection( 318 m.Return(m.Projection(
319 1, m.NewNode(odpi.op, m.Int32Constant(imm), m.Parameter(0)))); 319 1, m.NewNode(odpi.op, m.Int32Constant(imm), m.Parameter(0))));
320 m.SelectInstructions(); 320 m.SelectInstructions();
321 CHECK_EQ(1, m.code.size()); 321 CHECK_EQ(1, m.code.size());
322 CHECK_EQ(odpi.reverse_arch_opcode, m.code[0]->arch_opcode()); 322 CHECK_EQ(odpi.reverse_arch_opcode, m.code[0]->arch_opcode());
323 CHECK_EQ(kMode_Operand2_I, m.code[0]->addressing_mode()); 323 CHECK_EQ(kMode_Operand2_I, m.code[0]->addressing_mode());
324 CHECK_EQ(kFlags_set, m.code[0]->flags_mode()); 324 CHECK_EQ(kFlags_set, m.code[0]->flags_mode());
325 CHECK_EQ(kOverflow, m.code[0]->flags_condition()); 325 CHECK_EQ(kOverflow, m.code[0]->flags_condition());
326 CHECK_EQ(2, m.code[0]->InputCount()); 326 CHECK_EQ(2, m.code[0]->InputCount());
327 CHECK_EQ(imm, m.ToInt32(m.code[0]->InputAt(1))); 327 CHECK_EQ(imm, m.ToInt32(m.code[0]->InputAt(1)));
328 CHECK_EQ(1, m.code[0]->OutputCount()); 328 CHECK_LE(1, m.code[0]->OutputCount());
329 } 329 }
330 { 330 {
331 InstructionSelectorTester m; 331 InstructionSelectorTester m;
332 m.Return(m.Projection( 332 m.Return(m.Projection(
333 0, m.NewNode(odpi.op, m.Parameter(0), m.Int32Constant(imm)))); 333 0, m.NewNode(odpi.op, m.Parameter(0), m.Int32Constant(imm))));
334 m.SelectInstructions(); 334 m.SelectInstructions();
335 CHECK_EQ(1, m.code.size()); 335 CHECK_EQ(1, m.code.size());
336 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode()); 336 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode());
337 CHECK_EQ(kMode_Operand2_I, m.code[0]->addressing_mode()); 337 CHECK_EQ(kMode_Operand2_I, m.code[0]->addressing_mode());
338 CHECK_EQ(kFlags_none, m.code[0]->flags_mode()); 338 CHECK_EQ(kFlags_none, m.code[0]->flags_mode());
339 CHECK_EQ(2, m.code[0]->InputCount()); 339 CHECK_EQ(2, m.code[0]->InputCount());
340 CHECK_EQ(imm, m.ToInt32(m.code[0]->InputAt(1))); 340 CHECK_EQ(imm, m.ToInt32(m.code[0]->InputAt(1)));
341 CHECK_EQ(1, m.code[0]->OutputCount()); 341 CHECK_LE(1, m.code[0]->OutputCount());
342 } 342 }
343 { 343 {
344 InstructionSelectorTester m; 344 InstructionSelectorTester m;
345 m.Return(m.Projection( 345 m.Return(m.Projection(
346 0, m.NewNode(odpi.op, m.Int32Constant(imm), m.Parameter(0)))); 346 0, m.NewNode(odpi.op, m.Int32Constant(imm), m.Parameter(0))));
347 m.SelectInstructions(); 347 m.SelectInstructions();
348 CHECK_EQ(1, m.code.size()); 348 CHECK_EQ(1, m.code.size());
349 CHECK_EQ(odpi.reverse_arch_opcode, m.code[0]->arch_opcode()); 349 CHECK_EQ(odpi.reverse_arch_opcode, m.code[0]->arch_opcode());
350 CHECK_EQ(kMode_Operand2_I, m.code[0]->addressing_mode()); 350 CHECK_EQ(kMode_Operand2_I, m.code[0]->addressing_mode());
351 CHECK_EQ(kFlags_none, m.code[0]->flags_mode()); 351 CHECK_EQ(kFlags_none, m.code[0]->flags_mode());
352 CHECK_EQ(2, m.code[0]->InputCount()); 352 CHECK_EQ(2, m.code[0]->InputCount());
353 CHECK_EQ(imm, m.ToInt32(m.code[0]->InputAt(1))); 353 CHECK_EQ(imm, m.ToInt32(m.code[0]->InputAt(1)));
354 CHECK_EQ(1, m.code[0]->OutputCount()); 354 CHECK_LE(1, m.code[0]->OutputCount());
355 } 355 }
356 { 356 {
357 InstructionSelectorTester m; 357 InstructionSelectorTester m;
358 Node* node = m.NewNode(odpi.op, m.Parameter(0), m.Int32Constant(imm)); 358 Node* node = m.NewNode(odpi.op, m.Parameter(0), m.Int32Constant(imm));
359 m.Return(m.Word32Equal(m.Projection(0, node), m.Projection(1, node))); 359 m.Return(m.Word32Equal(m.Projection(0, node), m.Projection(1, node)));
360 m.SelectInstructions(); 360 m.SelectInstructions();
361 CHECK_LE(1, m.code.size()); 361 CHECK_LE(1, m.code.size());
362 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode()); 362 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode());
363 CHECK_EQ(kMode_Operand2_I, m.code[0]->addressing_mode()); 363 CHECK_EQ(kMode_Operand2_I, m.code[0]->addressing_mode());
364 CHECK_EQ(kFlags_set, m.code[0]->flags_mode()); 364 CHECK_EQ(kFlags_set, m.code[0]->flags_mode());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 m.Return(m.Projection( 398 m.Return(m.Projection(
399 1, m.NewNode(odpi.op, m.Parameter(0), 399 1, m.NewNode(odpi.op, m.Parameter(0),
400 m.NewNode(shift.op, m.Parameter(1), m.Parameter(2))))); 400 m.NewNode(shift.op, m.Parameter(1), m.Parameter(2)))));
401 m.SelectInstructions(); 401 m.SelectInstructions();
402 CHECK_EQ(1, m.code.size()); 402 CHECK_EQ(1, m.code.size());
403 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode()); 403 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode());
404 CHECK_EQ(shift.r_mode, m.code[0]->addressing_mode()); 404 CHECK_EQ(shift.r_mode, m.code[0]->addressing_mode());
405 CHECK_EQ(kFlags_set, m.code[0]->flags_mode()); 405 CHECK_EQ(kFlags_set, m.code[0]->flags_mode());
406 CHECK_EQ(kOverflow, m.code[0]->flags_condition()); 406 CHECK_EQ(kOverflow, m.code[0]->flags_condition());
407 CHECK_EQ(3, m.code[0]->InputCount()); 407 CHECK_EQ(3, m.code[0]->InputCount());
408 CHECK_EQ(1, m.code[0]->OutputCount()); 408 CHECK_LE(1, m.code[0]->OutputCount());
409 } 409 }
410 { 410 {
411 InstructionSelectorTester m; 411 InstructionSelectorTester m;
412 m.Return(m.Projection( 412 m.Return(m.Projection(
413 1, m.NewNode(odpi.op, 413 1, m.NewNode(odpi.op,
414 m.NewNode(shift.op, m.Parameter(0), m.Parameter(1)), 414 m.NewNode(shift.op, m.Parameter(0), m.Parameter(1)),
415 m.Parameter(2)))); 415 m.Parameter(2))));
416 m.SelectInstructions(); 416 m.SelectInstructions();
417 CHECK_EQ(1, m.code.size()); 417 CHECK_EQ(1, m.code.size());
418 CHECK_EQ(odpi.reverse_arch_opcode, m.code[0]->arch_opcode()); 418 CHECK_EQ(odpi.reverse_arch_opcode, m.code[0]->arch_opcode());
419 CHECK_EQ(shift.r_mode, m.code[0]->addressing_mode()); 419 CHECK_EQ(shift.r_mode, m.code[0]->addressing_mode());
420 CHECK_EQ(kFlags_set, m.code[0]->flags_mode()); 420 CHECK_EQ(kFlags_set, m.code[0]->flags_mode());
421 CHECK_EQ(kOverflow, m.code[0]->flags_condition()); 421 CHECK_EQ(kOverflow, m.code[0]->flags_condition());
422 CHECK_EQ(3, m.code[0]->InputCount()); 422 CHECK_EQ(3, m.code[0]->InputCount());
423 CHECK_EQ(1, m.code[0]->OutputCount()); 423 CHECK_LE(1, m.code[0]->OutputCount());
424 } 424 }
425 { 425 {
426 InstructionSelectorTester m; 426 InstructionSelectorTester m;
427 m.Return(m.Projection( 427 m.Return(m.Projection(
428 0, m.NewNode(odpi.op, m.Parameter(0), 428 0, m.NewNode(odpi.op, m.Parameter(0),
429 m.NewNode(shift.op, m.Parameter(1), m.Parameter(2))))); 429 m.NewNode(shift.op, m.Parameter(1), m.Parameter(2)))));
430 m.SelectInstructions(); 430 m.SelectInstructions();
431 CHECK_EQ(1, m.code.size()); 431 CHECK_EQ(1, m.code.size());
432 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode()); 432 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode());
433 CHECK_EQ(shift.r_mode, m.code[0]->addressing_mode()); 433 CHECK_EQ(shift.r_mode, m.code[0]->addressing_mode());
434 CHECK_EQ(kFlags_none, m.code[0]->flags_mode()); 434 CHECK_EQ(kFlags_none, m.code[0]->flags_mode());
435 CHECK_EQ(3, m.code[0]->InputCount()); 435 CHECK_EQ(3, m.code[0]->InputCount());
436 CHECK_EQ(1, m.code[0]->OutputCount()); 436 CHECK_LE(1, m.code[0]->OutputCount());
437 } 437 }
438 { 438 {
439 InstructionSelectorTester m; 439 InstructionSelectorTester m;
440 m.Return(m.Projection( 440 m.Return(m.Projection(
441 0, m.NewNode(odpi.op, 441 0, m.NewNode(odpi.op,
442 m.NewNode(shift.op, m.Parameter(0), m.Parameter(1)), 442 m.NewNode(shift.op, m.Parameter(0), m.Parameter(1)),
443 m.Parameter(2)))); 443 m.Parameter(2))));
444 m.SelectInstructions(); 444 m.SelectInstructions();
445 CHECK_EQ(1, m.code.size()); 445 CHECK_EQ(1, m.code.size());
446 CHECK_EQ(odpi.reverse_arch_opcode, m.code[0]->arch_opcode()); 446 CHECK_EQ(odpi.reverse_arch_opcode, m.code[0]->arch_opcode());
447 CHECK_EQ(shift.r_mode, m.code[0]->addressing_mode()); 447 CHECK_EQ(shift.r_mode, m.code[0]->addressing_mode());
448 CHECK_EQ(kFlags_none, m.code[0]->flags_mode()); 448 CHECK_EQ(kFlags_none, m.code[0]->flags_mode());
449 CHECK_EQ(3, m.code[0]->InputCount()); 449 CHECK_EQ(3, m.code[0]->InputCount());
450 CHECK_EQ(1, m.code[0]->OutputCount()); 450 CHECK_LE(1, m.code[0]->OutputCount());
451 } 451 }
452 { 452 {
453 InstructionSelectorTester m; 453 InstructionSelectorTester m;
454 Node* node = 454 Node* node =
455 m.NewNode(odpi.op, m.Parameter(0), 455 m.NewNode(odpi.op, m.Parameter(0),
456 m.NewNode(shift.op, m.Parameter(1), m.Parameter(2))); 456 m.NewNode(shift.op, m.Parameter(1), m.Parameter(2)));
457 m.Return(m.Word32Equal(m.Projection(0, node), m.Projection(1, node))); 457 m.Return(m.Word32Equal(m.Projection(0, node), m.Projection(1, node)));
458 m.SelectInstructions(); 458 m.SelectInstructions();
459 CHECK_LE(1, m.code.size()); 459 CHECK_LE(1, m.code.size());
460 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode()); 460 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 m.NewNode(shift.op, m.Parameter(1), 498 m.NewNode(shift.op, m.Parameter(1),
499 m.Int32Constant(imm))))); 499 m.Int32Constant(imm)))));
500 m.SelectInstructions(); 500 m.SelectInstructions();
501 CHECK_EQ(1, m.code.size()); 501 CHECK_EQ(1, m.code.size());
502 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode()); 502 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode());
503 CHECK_EQ(shift.i_mode, m.code[0]->addressing_mode()); 503 CHECK_EQ(shift.i_mode, m.code[0]->addressing_mode());
504 CHECK_EQ(kFlags_set, m.code[0]->flags_mode()); 504 CHECK_EQ(kFlags_set, m.code[0]->flags_mode());
505 CHECK_EQ(kOverflow, m.code[0]->flags_condition()); 505 CHECK_EQ(kOverflow, m.code[0]->flags_condition());
506 CHECK_EQ(3, m.code[0]->InputCount()); 506 CHECK_EQ(3, m.code[0]->InputCount());
507 CHECK_EQ(imm, m.ToInt32(m.code[0]->InputAt(2))); 507 CHECK_EQ(imm, m.ToInt32(m.code[0]->InputAt(2)));
508 CHECK_EQ(1, m.code[0]->OutputCount()); 508 CHECK_LE(1, m.code[0]->OutputCount());
509 } 509 }
510 { 510 {
511 InstructionSelectorTester m; 511 InstructionSelectorTester m;
512 m.Return(m.Projection( 512 m.Return(m.Projection(
513 1, m.NewNode(odpi.op, m.NewNode(shift.op, m.Parameter(0), 513 1, m.NewNode(odpi.op, m.NewNode(shift.op, m.Parameter(0),
514 m.Int32Constant(imm)), 514 m.Int32Constant(imm)),
515 m.Parameter(1)))); 515 m.Parameter(1))));
516 m.SelectInstructions(); 516 m.SelectInstructions();
517 CHECK_EQ(1, m.code.size()); 517 CHECK_EQ(1, m.code.size());
518 CHECK_EQ(odpi.reverse_arch_opcode, m.code[0]->arch_opcode()); 518 CHECK_EQ(odpi.reverse_arch_opcode, m.code[0]->arch_opcode());
519 CHECK_EQ(shift.i_mode, m.code[0]->addressing_mode()); 519 CHECK_EQ(shift.i_mode, m.code[0]->addressing_mode());
520 CHECK_EQ(kFlags_set, m.code[0]->flags_mode()); 520 CHECK_EQ(kFlags_set, m.code[0]->flags_mode());
521 CHECK_EQ(kOverflow, m.code[0]->flags_condition()); 521 CHECK_EQ(kOverflow, m.code[0]->flags_condition());
522 CHECK_EQ(3, m.code[0]->InputCount()); 522 CHECK_EQ(3, m.code[0]->InputCount());
523 CHECK_EQ(imm, m.ToInt32(m.code[0]->InputAt(2))); 523 CHECK_EQ(imm, m.ToInt32(m.code[0]->InputAt(2)));
524 CHECK_EQ(1, m.code[0]->OutputCount()); 524 CHECK_LE(1, m.code[0]->OutputCount());
525 } 525 }
526 { 526 {
527 InstructionSelectorTester m; 527 InstructionSelectorTester m;
528 m.Return(m.Projection(0, m.NewNode(odpi.op, m.Parameter(0), 528 m.Return(m.Projection(0, m.NewNode(odpi.op, m.Parameter(0),
529 m.NewNode(shift.op, m.Parameter(1), 529 m.NewNode(shift.op, m.Parameter(1),
530 m.Int32Constant(imm))))); 530 m.Int32Constant(imm)))));
531 m.SelectInstructions(); 531 m.SelectInstructions();
532 CHECK_EQ(1, m.code.size()); 532 CHECK_EQ(1, m.code.size());
533 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode()); 533 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode());
534 CHECK_EQ(shift.i_mode, m.code[0]->addressing_mode()); 534 CHECK_EQ(shift.i_mode, m.code[0]->addressing_mode());
535 CHECK_EQ(kFlags_none, m.code[0]->flags_mode()); 535 CHECK_EQ(kFlags_none, m.code[0]->flags_mode());
536 CHECK_EQ(3, m.code[0]->InputCount()); 536 CHECK_EQ(3, m.code[0]->InputCount());
537 CHECK_EQ(imm, m.ToInt32(m.code[0]->InputAt(2))); 537 CHECK_EQ(imm, m.ToInt32(m.code[0]->InputAt(2)));
538 CHECK_EQ(1, m.code[0]->OutputCount()); 538 CHECK_LE(1, m.code[0]->OutputCount());
539 } 539 }
540 { 540 {
541 InstructionSelectorTester m; 541 InstructionSelectorTester m;
542 m.Return(m.Projection( 542 m.Return(m.Projection(
543 0, m.NewNode(odpi.op, m.NewNode(shift.op, m.Parameter(0), 543 0, m.NewNode(odpi.op, m.NewNode(shift.op, m.Parameter(0),
544 m.Int32Constant(imm)), 544 m.Int32Constant(imm)),
545 m.Parameter(1)))); 545 m.Parameter(1))));
546 m.SelectInstructions(); 546 m.SelectInstructions();
547 CHECK_EQ(1, m.code.size()); 547 CHECK_EQ(1, m.code.size());
548 CHECK_EQ(odpi.reverse_arch_opcode, m.code[0]->arch_opcode()); 548 CHECK_EQ(odpi.reverse_arch_opcode, m.code[0]->arch_opcode());
549 CHECK_EQ(shift.i_mode, m.code[0]->addressing_mode()); 549 CHECK_EQ(shift.i_mode, m.code[0]->addressing_mode());
550 CHECK_EQ(kFlags_none, m.code[0]->flags_mode()); 550 CHECK_EQ(kFlags_none, m.code[0]->flags_mode());
551 CHECK_EQ(3, m.code[0]->InputCount()); 551 CHECK_EQ(3, m.code[0]->InputCount());
552 CHECK_EQ(imm, m.ToInt32(m.code[0]->InputAt(2))); 552 CHECK_EQ(imm, m.ToInt32(m.code[0]->InputAt(2)));
553 CHECK_EQ(1, m.code[0]->OutputCount()); 553 CHECK_LE(1, m.code[0]->OutputCount());
554 } 554 }
555 { 555 {
556 InstructionSelectorTester m; 556 InstructionSelectorTester m;
557 Node* node = m.NewNode( 557 Node* node = m.NewNode(
558 odpi.op, m.Parameter(0), 558 odpi.op, m.Parameter(0),
559 m.NewNode(shift.op, m.Parameter(1), m.Int32Constant(imm))); 559 m.NewNode(shift.op, m.Parameter(1), m.Int32Constant(imm)));
560 m.Return(m.Word32Equal(m.Projection(0, node), m.Projection(1, node))); 560 m.Return(m.Word32Equal(m.Projection(0, node), m.Projection(1, node)));
561 m.SelectInstructions(); 561 m.SelectInstructions();
562 CHECK_LE(1, m.code.size()); 562 CHECK_LE(1, m.code.size());
563 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode()); 563 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode());
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1746 m.Return(m.Int32Constant(0)); 1746 m.Return(m.Int32Constant(0));
1747 m.SelectInstructions(); 1747 m.SelectInstructions();
1748 CHECK_EQ(1, m.code.size()); 1748 CHECK_EQ(1, m.code.size());
1749 CHECK_EQ(dpi.test_arch_opcode, m.code[0]->arch_opcode()); 1749 CHECK_EQ(dpi.test_arch_opcode, m.code[0]->arch_opcode());
1750 CHECK_EQ(kMode_Operand2_R, m.code[0]->addressing_mode()); 1750 CHECK_EQ(kMode_Operand2_R, m.code[0]->addressing_mode());
1751 CHECK_EQ(kFlags_branch, m.code[0]->flags_mode()); 1751 CHECK_EQ(kFlags_branch, m.code[0]->flags_mode());
1752 CHECK_EQ(kEqual, m.code[0]->flags_condition()); 1752 CHECK_EQ(kEqual, m.code[0]->flags_condition());
1753 } 1753 }
1754 } 1754 }
1755 } 1755 }
1756
1757
1758 TEST(InstructionSelectorBranchWithODPIP) {
1759 ODPIs odpis;
1760 for (ODPIs::const_iterator i = odpis.begin(); i != odpis.end(); ++i) {
1761 ODPI odpi = *i;
1762 {
1763 InstructionSelectorTester m;
1764 MLabel blocka, blockb;
1765 Node* node = m.NewNode(odpi.op, m.Parameter(0), m.Parameter(1));
1766 m.Branch(m.Projection(1, node), &blocka, &blockb);
1767 m.Bind(&blocka);
1768 m.Return(m.Int32Constant(0));
1769 m.Bind(&blockb);
1770 m.Return(m.Projection(0, node));
1771 m.SelectInstructions();
1772 CHECK_EQ(1, m.code.size());
1773 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode());
1774 CHECK_EQ(kMode_Operand2_R, m.code[0]->addressing_mode());
1775 CHECK_EQ(kFlags_branch, m.code[0]->flags_mode());
1776 CHECK_EQ(kOverflow, m.code[0]->flags_condition());
1777 }
1778 {
1779 InstructionSelectorTester m;
1780 MLabel blocka, blockb;
1781 Node* node = m.NewNode(odpi.op, m.Parameter(0), m.Parameter(1));
1782 m.Branch(m.Word32Equal(m.Projection(1, node), m.Int32Constant(0)),
1783 &blocka, &blockb);
1784 m.Bind(&blocka);
1785 m.Return(m.Int32Constant(0));
1786 m.Bind(&blockb);
1787 m.Return(m.Projection(0, node));
1788 m.SelectInstructions();
1789 CHECK_EQ(1, m.code.size());
1790 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode());
1791 CHECK_EQ(kMode_Operand2_R, m.code[0]->addressing_mode());
1792 CHECK_EQ(kFlags_branch, m.code[0]->flags_mode());
1793 CHECK_EQ(kNotOverflow, m.code[0]->flags_condition());
1794 }
1795 {
1796 InstructionSelectorTester m;
1797 MLabel blocka, blockb;
1798 Node* node = m.NewNode(odpi.op, m.Parameter(0), m.Parameter(1));
1799 m.Branch(m.Word32Equal(m.Int32Constant(0), m.Projection(1, node)),
1800 &blocka, &blockb);
1801 m.Bind(&blocka);
1802 m.Return(m.Int32Constant(0));
1803 m.Bind(&blockb);
1804 m.Return(m.Projection(0, node));
1805 m.SelectInstructions();
1806 CHECK_EQ(1, m.code.size());
1807 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode());
1808 CHECK_EQ(kMode_Operand2_R, m.code[0]->addressing_mode());
1809 CHECK_EQ(kFlags_branch, m.code[0]->flags_mode());
1810 CHECK_EQ(kNotOverflow, m.code[0]->flags_condition());
1811 }
1812 }
1813 }
1814
1815
1816 TEST(InstructionSelectorBranchWithODPIImm) {
1817 ODPIs odpis;
1818 Immediates immediates;
1819 for (ODPIs::const_iterator i = odpis.begin(); i != odpis.end(); ++i) {
1820 ODPI odpi = *i;
1821 for (Immediates::const_iterator j = immediates.begin();
1822 j != immediates.end(); ++j) {
1823 int32_t imm = *j;
1824 {
1825 InstructionSelectorTester m;
1826 MLabel blocka, blockb;
1827 Node* node = m.NewNode(odpi.op, m.Parameter(0), m.Int32Constant(imm));
1828 m.Branch(m.Projection(1, node), &blocka, &blockb);
1829 m.Bind(&blocka);
1830 m.Return(m.Int32Constant(0));
1831 m.Bind(&blockb);
1832 m.Return(m.Projection(0, node));
1833 m.SelectInstructions();
1834 CHECK_EQ(1, m.code.size());
1835 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode());
1836 CHECK_EQ(kMode_Operand2_I, m.code[0]->addressing_mode());
1837 CHECK_EQ(kFlags_branch, m.code[0]->flags_mode());
1838 CHECK_EQ(kOverflow, m.code[0]->flags_condition());
1839 CHECK_LE(2, m.code[0]->InputCount());
1840 CHECK_EQ(imm, m.ToInt32(m.code[0]->InputAt(1)));
1841 }
1842 {
1843 InstructionSelectorTester m;
1844 MLabel blocka, blockb;
1845 Node* node = m.NewNode(odpi.op, m.Int32Constant(imm), m.Parameter(0));
1846 m.Branch(m.Projection(1, node), &blocka, &blockb);
1847 m.Bind(&blocka);
1848 m.Return(m.Int32Constant(0));
1849 m.Bind(&blockb);
1850 m.Return(m.Projection(0, node));
1851 m.SelectInstructions();
1852 CHECK_EQ(1, m.code.size());
1853 CHECK_EQ(odpi.reverse_arch_opcode, m.code[0]->arch_opcode());
1854 CHECK_EQ(kMode_Operand2_I, m.code[0]->addressing_mode());
1855 CHECK_EQ(kFlags_branch, m.code[0]->flags_mode());
1856 CHECK_EQ(kOverflow, m.code[0]->flags_condition());
1857 CHECK_LE(2, m.code[0]->InputCount());
1858 CHECK_EQ(imm, m.ToInt32(m.code[0]->InputAt(1)));
1859 }
1860 {
1861 InstructionSelectorTester m;
1862 MLabel blocka, blockb;
1863 Node* node = m.NewNode(odpi.op, m.Parameter(0), m.Int32Constant(imm));
1864 m.Branch(m.Word32Equal(m.Projection(1, node), m.Int32Constant(0)),
1865 &blocka, &blockb);
1866 m.Bind(&blocka);
1867 m.Return(m.Int32Constant(0));
1868 m.Bind(&blockb);
1869 m.Return(m.Projection(0, node));
1870 m.SelectInstructions();
1871 CHECK_EQ(1, m.code.size());
1872 CHECK_EQ(odpi.arch_opcode, m.code[0]->arch_opcode());
1873 CHECK_EQ(kMode_Operand2_I, m.code[0]->addressing_mode());
1874 CHECK_EQ(kFlags_branch, m.code[0]->flags_mode());
1875 CHECK_EQ(kNotOverflow, m.code[0]->flags_condition());
1876 CHECK_LE(2, m.code[0]->InputCount());
1877 CHECK_EQ(imm, m.ToInt32(m.code[0]->InputAt(1)));
1878 }
1879 {
1880 InstructionSelectorTester m;
1881 MLabel blocka, blockb;
1882 Node* node = m.NewNode(odpi.op, m.Int32Constant(imm), m.Parameter(0));
1883 m.Branch(m.Word32Equal(m.Projection(1, node), m.Int32Constant(0)),
1884 &blocka, &blockb);
1885 m.Bind(&blocka);
1886 m.Return(m.Int32Constant(0));
1887 m.Bind(&blockb);
1888 m.Return(m.Projection(0, node));
1889 m.SelectInstructions();
1890 CHECK_EQ(1, m.code.size());
1891 CHECK_EQ(odpi.reverse_arch_opcode, m.code[0]->arch_opcode());
1892 CHECK_EQ(kMode_Operand2_I, m.code[0]->addressing_mode());
1893 CHECK_EQ(kFlags_branch, m.code[0]->flags_mode());
1894 CHECK_EQ(kNotOverflow, m.code[0]->flags_condition());
1895 CHECK_LE(2, m.code[0]->InputCount());
1896 CHECK_EQ(imm, m.ToInt32(m.code[0]->InputAt(1)));
1897 }
1898 }
1899 }
1900 }
OLDNEW
« no previous file with comments | « src/compiler/x64/instruction-selector-x64.cc ('k') | test/cctest/compiler/test-run-machops.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698