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

Side by Side Diff: test/unittests/compiler/ia32/instruction-selector-ia32-unittest.cc

Issue 1072343002: [x86] Introduce vandps/vandpd/vxorps/vxorpd. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 5 years, 8 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
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 "test/unittests/compiler/instruction-selector-unittest.h" 5 #include "test/unittests/compiler/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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); 633 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
634 EXPECT_TRUE(s.IsFixed(s[0]->OutputAt(0), edx)); 634 EXPECT_TRUE(s.IsFixed(s[0]->OutputAt(0), edx));
635 } 635 }
636 636
637 637
638 // ----------------------------------------------------------------------------- 638 // -----------------------------------------------------------------------------
639 // Floating point operations. 639 // Floating point operations.
640 640
641 641
642 TEST_F(InstructionSelectorTest, Float32Abs) { 642 TEST_F(InstructionSelectorTest, Float32Abs) {
643 StreamBuilder m(this, kMachFloat32, kMachFloat32); 643 {
644 Node* const p0 = m.Parameter(0); 644 StreamBuilder m(this, kMachFloat32, kMachFloat32);
645 Node* const n = m.Float32Abs(p0); 645 Node* const p0 = m.Parameter(0);
646 m.Return(n); 646 Node* const n = m.Float32Abs(p0);
647 Stream s = m.Build(); 647 m.Return(n);
648 ASSERT_EQ(1U, s.size()); 648 Stream s = m.Build();
649 EXPECT_EQ(kSSEFloat32Abs, s[0]->arch_opcode()); 649 ASSERT_EQ(1U, s.size());
650 ASSERT_EQ(1U, s[0]->InputCount()); 650 EXPECT_EQ(kSSEFloat32Abs, s[0]->arch_opcode());
651 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); 651 ASSERT_EQ(1U, s[0]->InputCount());
652 ASSERT_EQ(1U, s[0]->OutputCount()); 652 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
653 EXPECT_TRUE(s.IsSameAsFirst(s[0]->Output())); 653 ASSERT_EQ(1U, s[0]->OutputCount());
654 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); 654 EXPECT_TRUE(s.IsSameAsFirst(s[0]->Output()));
655 EXPECT_EQ(kFlags_none, s[0]->flags_mode()); 655 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
656 EXPECT_EQ(kFlags_none, s[0]->flags_mode());
657 }
658 {
659 StreamBuilder m(this, kMachFloat32, kMachFloat32);
660 Node* const p0 = m.Parameter(0);
661 Node* const n = m.Float32Abs(p0);
662 m.Return(n);
663 Stream s = m.Build(AVX);
664 ASSERT_EQ(1U, s.size());
665 EXPECT_EQ(kAVXFloat32Abs, s[0]->arch_opcode());
666 ASSERT_EQ(1U, s[0]->InputCount());
667 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
668 ASSERT_EQ(1U, s[0]->OutputCount());
669 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
670 EXPECT_EQ(kFlags_none, s[0]->flags_mode());
671 }
656 } 672 }
657 673
658 674
659 TEST_F(InstructionSelectorTest, Float64Abs) { 675 TEST_F(InstructionSelectorTest, Float64Abs) {
660 StreamBuilder m(this, kMachFloat64, kMachFloat64); 676 {
661 Node* const p0 = m.Parameter(0); 677 StreamBuilder m(this, kMachFloat64, kMachFloat64);
662 Node* const n = m.Float64Abs(p0); 678 Node* const p0 = m.Parameter(0);
663 m.Return(n); 679 Node* const n = m.Float64Abs(p0);
664 Stream s = m.Build(); 680 m.Return(n);
665 ASSERT_EQ(1U, s.size()); 681 Stream s = m.Build();
666 EXPECT_EQ(kSSEFloat64Abs, s[0]->arch_opcode()); 682 ASSERT_EQ(1U, s.size());
667 ASSERT_EQ(1U, s[0]->InputCount()); 683 EXPECT_EQ(kSSEFloat64Abs, s[0]->arch_opcode());
668 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); 684 ASSERT_EQ(1U, s[0]->InputCount());
669 ASSERT_EQ(1U, s[0]->OutputCount()); 685 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
670 EXPECT_TRUE(s.IsSameAsFirst(s[0]->Output())); 686 ASSERT_EQ(1U, s[0]->OutputCount());
671 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); 687 EXPECT_TRUE(s.IsSameAsFirst(s[0]->Output()));
672 EXPECT_EQ(kFlags_none, s[0]->flags_mode()); 688 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
689 EXPECT_EQ(kFlags_none, s[0]->flags_mode());
690 }
691 {
692 StreamBuilder m(this, kMachFloat64, kMachFloat64);
693 Node* const p0 = m.Parameter(0);
694 Node* const n = m.Float64Abs(p0);
695 m.Return(n);
696 Stream s = m.Build(AVX);
697 ASSERT_EQ(1U, s.size());
698 EXPECT_EQ(kAVXFloat64Abs, s[0]->arch_opcode());
699 ASSERT_EQ(1U, s[0]->InputCount());
700 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
701 ASSERT_EQ(1U, s[0]->OutputCount());
702 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
703 EXPECT_EQ(kFlags_none, s[0]->flags_mode());
704 }
673 } 705 }
674 706
675 707
676 TEST_F(InstructionSelectorTest, Float64BinopArithmetic) { 708 TEST_F(InstructionSelectorTest, Float64BinopArithmetic) {
677 { 709 {
678 StreamBuilder m(this, kMachFloat64, kMachFloat64, kMachFloat64); 710 StreamBuilder m(this, kMachFloat64, kMachFloat64, kMachFloat64);
679 Node* add = m.Float64Add(m.Parameter(0), m.Parameter(1)); 711 Node* add = m.Float64Add(m.Parameter(0), m.Parameter(1));
680 Node* mul = m.Float64Mul(add, m.Parameter(1)); 712 Node* mul = m.Float64Mul(add, m.Parameter(1));
681 Node* sub = m.Float64Sub(mul, add); 713 Node* sub = m.Float64Sub(mul, add);
682 Node* ret = m.Float64Div(mul, sub); 714 Node* ret = m.Float64Div(mul, sub);
(...skipping 16 matching lines...) Expand all
699 ASSERT_EQ(4U, s.size()); 731 ASSERT_EQ(4U, s.size());
700 EXPECT_EQ(kSSEFloat64Add, s[0]->arch_opcode()); 732 EXPECT_EQ(kSSEFloat64Add, s[0]->arch_opcode());
701 EXPECT_EQ(kSSEFloat64Mul, s[1]->arch_opcode()); 733 EXPECT_EQ(kSSEFloat64Mul, s[1]->arch_opcode());
702 EXPECT_EQ(kSSEFloat64Sub, s[2]->arch_opcode()); 734 EXPECT_EQ(kSSEFloat64Sub, s[2]->arch_opcode());
703 EXPECT_EQ(kSSEFloat64Div, s[3]->arch_opcode()); 735 EXPECT_EQ(kSSEFloat64Div, s[3]->arch_opcode());
704 } 736 }
705 } 737 }
706 738
707 739
708 TEST_F(InstructionSelectorTest, Float32SubWithMinusZeroAndParameter) { 740 TEST_F(InstructionSelectorTest, Float32SubWithMinusZeroAndParameter) {
709 StreamBuilder m(this, kMachFloat32, kMachFloat32); 741 {
710 Node* const p0 = m.Parameter(0); 742 StreamBuilder m(this, kMachFloat32, kMachFloat32);
711 Node* const n = m.Float32Sub(m.Float32Constant(-0.0f), p0); 743 Node* const p0 = m.Parameter(0);
712 m.Return(n); 744 Node* const n = m.Float32Sub(m.Float32Constant(-0.0f), p0);
713 Stream s = m.Build(); 745 m.Return(n);
714 ASSERT_EQ(1U, s.size()); 746 Stream s = m.Build();
715 EXPECT_EQ(kSSEFloat32Neg, s[0]->arch_opcode()); 747 ASSERT_EQ(1U, s.size());
716 ASSERT_EQ(1U, s[0]->InputCount()); 748 EXPECT_EQ(kSSEFloat32Neg, s[0]->arch_opcode());
717 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); 749 ASSERT_EQ(1U, s[0]->InputCount());
718 ASSERT_EQ(1U, s[0]->OutputCount()); 750 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
719 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); 751 ASSERT_EQ(1U, s[0]->OutputCount());
720 EXPECT_EQ(kFlags_none, s[0]->flags_mode()); 752 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
753 EXPECT_EQ(kFlags_none, s[0]->flags_mode());
754 }
755 {
756 StreamBuilder m(this, kMachFloat32, kMachFloat32);
757 Node* const p0 = m.Parameter(0);
758 Node* const n = m.Float32Sub(m.Float32Constant(-0.0f), p0);
759 m.Return(n);
760 Stream s = m.Build(AVX);
761 ASSERT_EQ(1U, s.size());
762 EXPECT_EQ(kAVXFloat32Neg, s[0]->arch_opcode());
763 ASSERT_EQ(1U, s[0]->InputCount());
764 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
765 ASSERT_EQ(1U, s[0]->OutputCount());
766 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
767 EXPECT_EQ(kFlags_none, s[0]->flags_mode());
768 }
721 } 769 }
722 770
723 771
724 TEST_F(InstructionSelectorTest, Float64SubWithMinusZeroAndParameter) { 772 TEST_F(InstructionSelectorTest, Float64SubWithMinusZeroAndParameter) {
725 StreamBuilder m(this, kMachFloat64, kMachFloat64); 773 {
726 Node* const p0 = m.Parameter(0); 774 StreamBuilder m(this, kMachFloat64, kMachFloat64);
727 Node* const n = m.Float64Sub(m.Float64Constant(-0.0), p0); 775 Node* const p0 = m.Parameter(0);
728 m.Return(n); 776 Node* const n = m.Float64Sub(m.Float64Constant(-0.0), p0);
729 Stream s = m.Build(); 777 m.Return(n);
730 ASSERT_EQ(1U, s.size()); 778 Stream s = m.Build();
731 EXPECT_EQ(kSSEFloat64Neg, s[0]->arch_opcode()); 779 ASSERT_EQ(1U, s.size());
732 ASSERT_EQ(1U, s[0]->InputCount()); 780 EXPECT_EQ(kSSEFloat64Neg, s[0]->arch_opcode());
733 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); 781 ASSERT_EQ(1U, s[0]->InputCount());
734 ASSERT_EQ(1U, s[0]->OutputCount()); 782 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
735 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); 783 ASSERT_EQ(1U, s[0]->OutputCount());
736 EXPECT_EQ(kFlags_none, s[0]->flags_mode()); 784 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
785 EXPECT_EQ(kFlags_none, s[0]->flags_mode());
786 }
787 {
788 StreamBuilder m(this, kMachFloat64, kMachFloat64);
789 Node* const p0 = m.Parameter(0);
790 Node* const n = m.Float64Sub(m.Float64Constant(-0.0), p0);
791 m.Return(n);
792 Stream s = m.Build(AVX);
793 ASSERT_EQ(1U, s.size());
794 EXPECT_EQ(kAVXFloat64Neg, s[0]->arch_opcode());
795 ASSERT_EQ(1U, s[0]->InputCount());
796 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
797 ASSERT_EQ(1U, s[0]->OutputCount());
798 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
799 EXPECT_EQ(kFlags_none, s[0]->flags_mode());
800 }
737 } 801 }
738 802
739 803
740 // ----------------------------------------------------------------------------- 804 // -----------------------------------------------------------------------------
741 // Miscellaneous. 805 // Miscellaneous.
742 806
743 807
744 TEST_F(InstructionSelectorTest, Uint32LessThanWithLoadAndLoadStackPointer) { 808 TEST_F(InstructionSelectorTest, Uint32LessThanWithLoadAndLoadStackPointer) {
745 StreamBuilder m(this, kMachBool); 809 StreamBuilder m(this, kMachBool);
746 Node* const sl = m.Load( 810 Node* const sl = m.Load(
(...skipping 23 matching lines...) Expand all
770 EXPECT_EQ(kIA32Lzcnt, s[0]->arch_opcode()); 834 EXPECT_EQ(kIA32Lzcnt, s[0]->arch_opcode());
771 ASSERT_EQ(1U, s[0]->InputCount()); 835 ASSERT_EQ(1U, s[0]->InputCount());
772 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); 836 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
773 ASSERT_EQ(1U, s[0]->OutputCount()); 837 ASSERT_EQ(1U, s[0]->OutputCount());
774 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); 838 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
775 } 839 }
776 840
777 } // namespace compiler 841 } // namespace compiler
778 } // namespace internal 842 } // namespace internal
779 } // namespace v8 843 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/test-disasm-x64.cc ('k') | test/unittests/compiler/x64/instruction-selector-x64-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698