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

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

Issue 434923002: [arm] Unify instruction selector for Word32Neg. (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
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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 m.Return(m.Word32And(m.Word32Xor(m.Parameter(0), m.Int32Constant(-1)), 615 m.Return(m.Word32And(m.Word32Xor(m.Parameter(0), m.Int32Constant(-1)),
616 m.Parameter(1))); 616 m.Parameter(1)));
617 m.SelectInstructions(); 617 m.SelectInstructions();
618 CHECK_EQ(1, m.code.size()); 618 CHECK_EQ(1, m.code.size());
619 CHECK_EQ(kArmBic, m.code[0]->arch_opcode()); 619 CHECK_EQ(kArmBic, m.code[0]->arch_opcode());
620 CHECK_EQ(kMode_Operand2_R, m.code[0]->addressing_mode()); 620 CHECK_EQ(kMode_Operand2_R, m.code[0]->addressing_mode());
621 } 621 }
622 } 622 }
623 623
624 624
625 TEST(InstructionSelectorWord32AndAndWord32XorWithMinus1AndShiftP) {
626 Shifts shifts;
627 for (Shifts::const_iterator i = shifts.begin(); i != shifts.end(); ++i) {
628 Shift shift = *i;
629 {
630 InstructionSelectorTester m;
631 m.Return(m.Word32And(
632 m.Parameter(0),
633 m.Word32Xor(m.Int32Constant(-1),
634 m.NewNode(shift.op, m.Parameter(1), m.Parameter(2)))));
635 m.SelectInstructions();
636 CHECK_EQ(1, m.code.size());
637 CHECK_EQ(kArmBic, m.code[0]->arch_opcode());
638 CHECK_EQ(shift.r_mode, m.code[0]->addressing_mode());
639 }
640 {
641 InstructionSelectorTester m;
642 m.Return(m.Word32And(
643 m.Parameter(0),
644 m.Word32Xor(m.NewNode(shift.op, m.Parameter(1), m.Parameter(2)),
645 m.Int32Constant(-1))));
646 m.SelectInstructions();
647 CHECK_EQ(1, m.code.size());
648 CHECK_EQ(kArmBic, m.code[0]->arch_opcode());
649 CHECK_EQ(shift.r_mode, m.code[0]->addressing_mode());
650 }
651 {
652 InstructionSelectorTester m;
653 m.Return(m.Word32And(
654 m.Word32Xor(m.Int32Constant(-1),
655 m.NewNode(shift.op, m.Parameter(0), m.Parameter(1))),
656 m.Parameter(2)));
657 m.SelectInstructions();
658 CHECK_EQ(1, m.code.size());
659 CHECK_EQ(kArmBic, m.code[0]->arch_opcode());
660 CHECK_EQ(shift.r_mode, m.code[0]->addressing_mode());
661 }
662 {
663 InstructionSelectorTester m;
664 m.Return(m.Word32And(
665 m.Word32Xor(m.NewNode(shift.op, m.Parameter(0), m.Parameter(1)),
666 m.Int32Constant(-1)),
667 m.Parameter(2)));
668 m.SelectInstructions();
669 CHECK_EQ(1, m.code.size());
670 CHECK_EQ(kArmBic, m.code[0]->arch_opcode());
671 CHECK_EQ(shift.r_mode, m.code[0]->addressing_mode());
672 }
673 }
674 }
675
676
625 TEST(InstructionSelectorWord32XorWithMinus1P) { 677 TEST(InstructionSelectorWord32XorWithMinus1P) {
626 { 678 {
627 InstructionSelectorTester m; 679 InstructionSelectorTester m;
628 m.Return(m.Word32Xor(m.Int32Constant(-1), m.Parameter(0))); 680 m.Return(m.Word32Xor(m.Int32Constant(-1), m.Parameter(0)));
629 m.SelectInstructions(); 681 m.SelectInstructions();
630 CHECK_EQ(1, m.code.size()); 682 CHECK_EQ(1, m.code.size());
631 CHECK_EQ(kArmMvn, m.code[0]->arch_opcode()); 683 CHECK_EQ(kArmMvn, m.code[0]->arch_opcode());
632 CHECK_EQ(kMode_Operand2_R, m.code[0]->addressing_mode()); 684 CHECK_EQ(kMode_Operand2_R, m.code[0]->addressing_mode());
633 } 685 }
634 { 686 {
635 InstructionSelectorTester m; 687 InstructionSelectorTester m;
636 m.Return(m.Word32Xor(m.Parameter(0), m.Int32Constant(-1))); 688 m.Return(m.Word32Xor(m.Parameter(0), m.Int32Constant(-1)));
637 m.SelectInstructions(); 689 m.SelectInstructions();
638 CHECK_EQ(1, m.code.size()); 690 CHECK_EQ(1, m.code.size());
639 CHECK_EQ(kArmMvn, m.code[0]->arch_opcode()); 691 CHECK_EQ(kArmMvn, m.code[0]->arch_opcode());
640 CHECK_EQ(kMode_Operand2_R, m.code[0]->addressing_mode()); 692 CHECK_EQ(kMode_Operand2_R, m.code[0]->addressing_mode());
641 } 693 }
642 } 694 }
643 695
644 696
697 TEST(InstructionSelectorWord32XorWithMinus1AndShiftP) {
698 Shifts shifts;
699 for (Shifts::const_iterator i = shifts.begin(); i != shifts.end(); ++i) {
700 Shift shift = *i;
701 {
702 InstructionSelectorTester m;
703 m.Return(
704 m.Word32Xor(m.Int32Constant(-1),
705 m.NewNode(shift.op, m.Parameter(0), m.Parameter(1))));
706 m.SelectInstructions();
707 CHECK_EQ(1, m.code.size());
708 CHECK_EQ(kArmMvn, m.code[0]->arch_opcode());
709 CHECK_EQ(shift.r_mode, m.code[0]->addressing_mode());
710 }
711 {
712 InstructionSelectorTester m;
713 m.Return(m.Word32Xor(m.NewNode(shift.op, m.Parameter(0), m.Parameter(1)),
714 m.Int32Constant(-1)));
715 m.SelectInstructions();
716 CHECK_EQ(1, m.code.size());
717 CHECK_EQ(kArmMvn, m.code[0]->arch_opcode());
718 CHECK_EQ(shift.r_mode, m.code[0]->addressing_mode());
719 }
720 }
721 }
722
723
645 TEST(InstructionSelectorShiftP) { 724 TEST(InstructionSelectorShiftP) {
646 Shifts shifts; 725 Shifts shifts;
647 for (Shifts::const_iterator i = shifts.begin(); i != shifts.end(); ++i) { 726 for (Shifts::const_iterator i = shifts.begin(); i != shifts.end(); ++i) {
648 Shift shift = *i; 727 Shift shift = *i;
649 InstructionSelectorTester m; 728 InstructionSelectorTester m;
650 m.Return(m.NewNode(shift.op, m.Parameter(0), m.Parameter(1))); 729 m.Return(m.NewNode(shift.op, m.Parameter(0), m.Parameter(1)));
651 m.SelectInstructions(); 730 m.SelectInstructions();
652 CHECK_EQ(1, m.code.size()); 731 CHECK_EQ(1, m.code.size());
653 CHECK_EQ(kArmMov, m.code[0]->arch_opcode()); 732 CHECK_EQ(kArmMov, m.code[0]->arch_opcode());
654 CHECK_EQ(shift.r_mode, m.code[0]->addressing_mode()); 733 CHECK_EQ(shift.r_mode, m.code[0]->addressing_mode());
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 m.Return(m.Int32Constant(0)); 1738 m.Return(m.Int32Constant(0));
1660 m.SelectInstructions(); 1739 m.SelectInstructions();
1661 CHECK_EQ(1, m.code.size()); 1740 CHECK_EQ(1, m.code.size());
1662 CHECK_EQ(dpi.test_arch_opcode, m.code[0]->arch_opcode()); 1741 CHECK_EQ(dpi.test_arch_opcode, m.code[0]->arch_opcode());
1663 CHECK_EQ(kMode_Operand2_R, m.code[0]->addressing_mode()); 1742 CHECK_EQ(kMode_Operand2_R, m.code[0]->addressing_mode());
1664 CHECK_EQ(kFlags_branch, m.code[0]->flags_mode()); 1743 CHECK_EQ(kFlags_branch, m.code[0]->flags_mode());
1665 CHECK_EQ(kEqual, m.code[0]->flags_condition()); 1744 CHECK_EQ(kEqual, m.code[0]->flags_condition());
1666 } 1745 }
1667 } 1746 }
1668 } 1747 }
OLDNEW
« src/compiler/arm/instruction-selector-arm.cc ('K') | « src/compiler/arm/instruction-selector-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698