| 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/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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 154 |
| 155 | 155 |
| 156 // ---------------------------------------------------------------------------- | 156 // ---------------------------------------------------------------------------- |
| 157 // Arithmetic compare instructions. | 157 // Arithmetic compare instructions. |
| 158 // ---------------------------------------------------------------------------- | 158 // ---------------------------------------------------------------------------- |
| 159 | 159 |
| 160 | 160 |
| 161 const IntCmp kCmpInstructions[] = { | 161 const IntCmp kCmpInstructions[] = { |
| 162 {{&RawMachineAssembler::WordEqual, "WordEqual", kMipsCmp, kMachInt16}, 1U}, | 162 {{&RawMachineAssembler::WordEqual, "WordEqual", kMipsCmp, kMachInt16}, 1U}, |
| 163 {{&RawMachineAssembler::WordNotEqual, "WordNotEqual", kMipsCmp, kMachInt16}, | 163 {{&RawMachineAssembler::WordNotEqual, "WordNotEqual", kMipsCmp, kMachInt16}, |
| 164 2U}, | 164 1U}, |
| 165 {{&RawMachineAssembler::Word32Equal, "Word32Equal", kMipsCmp, kMachInt32}, | 165 {{&RawMachineAssembler::Word32Equal, "Word32Equal", kMipsCmp, kMachInt32}, |
| 166 1U}, | 166 1U}, |
| 167 {{&RawMachineAssembler::Word32NotEqual, "Word32NotEqual", kMipsCmp, | 167 {{&RawMachineAssembler::Word32NotEqual, "Word32NotEqual", kMipsCmp, |
| 168 kMachInt32}, | 168 kMachInt32}, |
| 169 2U}, | 169 1U}, |
| 170 {{&RawMachineAssembler::Int32LessThan, "Int32LessThan", kMipsCmp, | 170 {{&RawMachineAssembler::Int32LessThan, "Int32LessThan", kMipsCmp, |
| 171 kMachInt32}, | 171 kMachInt32}, |
| 172 1U}, | 172 1U}, |
| 173 {{&RawMachineAssembler::Int32LessThanOrEqual, "Int32LessThanOrEqual", | 173 {{&RawMachineAssembler::Int32LessThanOrEqual, "Int32LessThanOrEqual", |
| 174 kMipsCmp, kMachInt32}, | 174 kMipsCmp, kMachInt32}, |
| 175 1U}, | 175 1U}, |
| 176 {{&RawMachineAssembler::Int32GreaterThan, "Int32GreaterThan", kMipsCmp, | 176 {{&RawMachineAssembler::Int32GreaterThan, "Int32GreaterThan", kMipsCmp, |
| 177 kMachInt32}, | 177 kMachInt32}, |
| 178 1U}, | 178 1U}, |
| 179 {{&RawMachineAssembler::Int32GreaterThanOrEqual, "Int32GreaterThanOrEqual", | 179 {{&RawMachineAssembler::Int32GreaterThanOrEqual, "Int32GreaterThanOrEqual", |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 // kMipsTst testing. | 772 // kMipsTst testing. |
| 773 // ---------------------------------------------------------------------------- | 773 // ---------------------------------------------------------------------------- |
| 774 | 774 |
| 775 | 775 |
| 776 TEST_F(InstructionSelectorTest, Word32EqualWithZero) { | 776 TEST_F(InstructionSelectorTest, Word32EqualWithZero) { |
| 777 { | 777 { |
| 778 StreamBuilder m(this, kMachInt32, kMachInt32); | 778 StreamBuilder m(this, kMachInt32, kMachInt32); |
| 779 m.Return(m.Word32Equal(m.Parameter(0), m.Int32Constant(0))); | 779 m.Return(m.Word32Equal(m.Parameter(0), m.Int32Constant(0))); |
| 780 Stream s = m.Build(); | 780 Stream s = m.Build(); |
| 781 ASSERT_EQ(1U, s.size()); | 781 ASSERT_EQ(1U, s.size()); |
| 782 EXPECT_EQ(kMipsTst, s[0]->arch_opcode()); | 782 EXPECT_EQ(kMipsCmp, s[0]->arch_opcode()); |
| 783 EXPECT_EQ(kMode_None, s[0]->addressing_mode()); | 783 EXPECT_EQ(kMode_None, s[0]->addressing_mode()); |
| 784 ASSERT_EQ(2U, s[0]->InputCount()); | 784 ASSERT_EQ(2U, s[0]->InputCount()); |
| 785 EXPECT_EQ(s.ToVreg(s[0]->InputAt(0)), s.ToVreg(s[0]->InputAt(1))); | |
| 786 EXPECT_EQ(1U, s[0]->OutputCount()); | 785 EXPECT_EQ(1U, s[0]->OutputCount()); |
| 787 EXPECT_EQ(kFlags_set, s[0]->flags_mode()); | 786 EXPECT_EQ(kFlags_set, s[0]->flags_mode()); |
| 788 EXPECT_EQ(kEqual, s[0]->flags_condition()); | 787 EXPECT_EQ(kEqual, s[0]->flags_condition()); |
| 789 } | 788 } |
| 790 { | 789 { |
| 791 StreamBuilder m(this, kMachInt32, kMachInt32); | 790 StreamBuilder m(this, kMachInt32, kMachInt32); |
| 792 m.Return(m.Word32Equal(m.Int32Constant(0), m.Parameter(0))); | 791 m.Return(m.Word32Equal(m.Int32Constant(0), m.Parameter(0))); |
| 793 Stream s = m.Build(); | 792 Stream s = m.Build(); |
| 794 ASSERT_EQ(1U, s.size()); | 793 ASSERT_EQ(1U, s.size()); |
| 795 EXPECT_EQ(kMipsTst, s[0]->arch_opcode()); | 794 EXPECT_EQ(kMipsCmp, s[0]->arch_opcode()); |
| 796 EXPECT_EQ(kMode_None, s[0]->addressing_mode()); | 795 EXPECT_EQ(kMode_None, s[0]->addressing_mode()); |
| 797 ASSERT_EQ(2U, s[0]->InputCount()); | 796 ASSERT_EQ(2U, s[0]->InputCount()); |
| 798 EXPECT_EQ(s.ToVreg(s[0]->InputAt(0)), s.ToVreg(s[0]->InputAt(1))); | |
| 799 EXPECT_EQ(1U, s[0]->OutputCount()); | 797 EXPECT_EQ(1U, s[0]->OutputCount()); |
| 800 EXPECT_EQ(kFlags_set, s[0]->flags_mode()); | 798 EXPECT_EQ(kFlags_set, s[0]->flags_mode()); |
| 801 EXPECT_EQ(kEqual, s[0]->flags_condition()); | 799 EXPECT_EQ(kEqual, s[0]->flags_condition()); |
| 802 } | 800 } |
| 803 } | 801 } |
| 804 | 802 |
| 805 } // namespace compiler | 803 } // namespace compiler |
| 806 } // namespace internal | 804 } // namespace internal |
| 807 } // namespace v8 | 805 } // namespace v8 |
| OLD | NEW |