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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // Arithmetic compare instructions. | 159 // Arithmetic compare instructions. |
160 // ---------------------------------------------------------------------------- | 160 // ---------------------------------------------------------------------------- |
161 | 161 |
162 | 162 |
163 const IntCmp kCmpInstructions[] = { | 163 const IntCmp kCmpInstructions[] = { |
164 {{&RawMachineAssembler::WordEqual, "WordEqual", kMips64Cmp, kMachInt64}, | 164 {{&RawMachineAssembler::WordEqual, "WordEqual", kMips64Cmp, kMachInt64}, |
165 1U}, | 165 1U}, |
166 {{&RawMachineAssembler::WordNotEqual, "WordNotEqual", kMips64Cmp, | 166 {{&RawMachineAssembler::WordNotEqual, "WordNotEqual", kMips64Cmp, |
167 kMachInt64}, | 167 kMachInt64}, |
168 1U}, | 168 1U}, |
169 {{&RawMachineAssembler::Word32Equal, "Word32Equal", kMips64Cmp32, | 169 {{&RawMachineAssembler::Word32Equal, "Word32Equal", kMips64Cmp, kMachInt32}, |
| 170 1U}, |
| 171 {{&RawMachineAssembler::Word32NotEqual, "Word32NotEqual", kMips64Cmp, |
170 kMachInt32}, | 172 kMachInt32}, |
171 1U}, | 173 1U}, |
172 {{&RawMachineAssembler::Word32NotEqual, "Word32NotEqual", kMips64Cmp32, | 174 {{&RawMachineAssembler::Int32LessThan, "Int32LessThan", kMips64Cmp, |
173 kMachInt32}, | |
174 1U}, | |
175 {{&RawMachineAssembler::Int32LessThan, "Int32LessThan", kMips64Cmp32, | |
176 kMachInt32}, | 175 kMachInt32}, |
177 1U}, | 176 1U}, |
178 {{&RawMachineAssembler::Int32LessThanOrEqual, "Int32LessThanOrEqual", | 177 {{&RawMachineAssembler::Int32LessThanOrEqual, "Int32LessThanOrEqual", |
179 kMips64Cmp32, kMachInt32}, | 178 kMips64Cmp, kMachInt32}, |
180 1U}, | 179 1U}, |
181 {{&RawMachineAssembler::Int32GreaterThan, "Int32GreaterThan", kMips64Cmp32, | 180 {{&RawMachineAssembler::Int32GreaterThan, "Int32GreaterThan", kMips64Cmp, |
182 kMachInt32}, | 181 kMachInt32}, |
183 1U}, | 182 1U}, |
184 {{&RawMachineAssembler::Int32GreaterThanOrEqual, "Int32GreaterThanOrEqual", | 183 {{&RawMachineAssembler::Int32GreaterThanOrEqual, "Int32GreaterThanOrEqual", |
185 kMips64Cmp32, kMachInt32}, | 184 kMips64Cmp, kMachInt32}, |
186 1U}, | 185 1U}, |
187 {{&RawMachineAssembler::Uint32LessThan, "Uint32LessThan", kMips64Cmp32, | 186 {{&RawMachineAssembler::Uint32LessThan, "Uint32LessThan", kMips64Cmp, |
188 kMachUint32}, | 187 kMachUint32}, |
189 1U}, | 188 1U}, |
190 {{&RawMachineAssembler::Uint32LessThanOrEqual, "Uint32LessThanOrEqual", | 189 {{&RawMachineAssembler::Uint32LessThanOrEqual, "Uint32LessThanOrEqual", |
191 kMips64Cmp32, kMachUint32}, | 190 kMips64Cmp, kMachUint32}, |
192 1U}}; | 191 1U}}; |
193 | 192 |
194 | 193 |
195 // ---------------------------------------------------------------------------- | 194 // ---------------------------------------------------------------------------- |
196 // Conversion instructions. | 195 // Conversion instructions. |
197 // ---------------------------------------------------------------------------- | 196 // ---------------------------------------------------------------------------- |
198 | 197 |
199 const Conversion kConversionInstructions[] = { | 198 const Conversion kConversionInstructions[] = { |
200 // Conversion instructions are related to machine_operator.h: | 199 // Conversion instructions are related to machine_operator.h: |
201 // FPU conversions: | 200 // FPU conversions: |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 // kMips64Cmp with zero testing. | 745 // kMips64Cmp with zero testing. |
747 // ---------------------------------------------------------------------------- | 746 // ---------------------------------------------------------------------------- |
748 | 747 |
749 | 748 |
750 TEST_F(InstructionSelectorTest, Word32EqualWithZero) { | 749 TEST_F(InstructionSelectorTest, Word32EqualWithZero) { |
751 { | 750 { |
752 StreamBuilder m(this, kMachInt32, kMachInt32); | 751 StreamBuilder m(this, kMachInt32, kMachInt32); |
753 m.Return(m.Word32Equal(m.Parameter(0), m.Int32Constant(0))); | 752 m.Return(m.Word32Equal(m.Parameter(0), m.Int32Constant(0))); |
754 Stream s = m.Build(); | 753 Stream s = m.Build(); |
755 ASSERT_EQ(1U, s.size()); | 754 ASSERT_EQ(1U, s.size()); |
756 EXPECT_EQ(kMips64Cmp32, s[0]->arch_opcode()); | 755 EXPECT_EQ(kMips64Cmp, s[0]->arch_opcode()); |
757 EXPECT_EQ(kMode_None, s[0]->addressing_mode()); | 756 EXPECT_EQ(kMode_None, s[0]->addressing_mode()); |
758 ASSERT_EQ(2U, s[0]->InputCount()); | 757 ASSERT_EQ(2U, s[0]->InputCount()); |
759 EXPECT_EQ(1U, s[0]->OutputCount()); | 758 EXPECT_EQ(1U, s[0]->OutputCount()); |
760 EXPECT_EQ(kFlags_set, s[0]->flags_mode()); | 759 EXPECT_EQ(kFlags_set, s[0]->flags_mode()); |
761 EXPECT_EQ(kEqual, s[0]->flags_condition()); | 760 EXPECT_EQ(kEqual, s[0]->flags_condition()); |
762 } | 761 } |
763 { | 762 { |
764 StreamBuilder m(this, kMachInt32, kMachInt32); | 763 StreamBuilder m(this, kMachInt32, kMachInt32); |
765 m.Return(m.Word32Equal(m.Int32Constant(0), m.Parameter(0))); | 764 m.Return(m.Word32Equal(m.Int32Constant(0), m.Parameter(0))); |
766 Stream s = m.Build(); | 765 Stream s = m.Build(); |
767 ASSERT_EQ(1U, s.size()); | 766 ASSERT_EQ(1U, s.size()); |
768 EXPECT_EQ(kMips64Cmp32, s[0]->arch_opcode()); | 767 EXPECT_EQ(kMips64Cmp, s[0]->arch_opcode()); |
769 EXPECT_EQ(kMode_None, s[0]->addressing_mode()); | 768 EXPECT_EQ(kMode_None, s[0]->addressing_mode()); |
770 ASSERT_EQ(2U, s[0]->InputCount()); | 769 ASSERT_EQ(2U, s[0]->InputCount()); |
771 EXPECT_EQ(1U, s[0]->OutputCount()); | 770 EXPECT_EQ(1U, s[0]->OutputCount()); |
772 EXPECT_EQ(kFlags_set, s[0]->flags_mode()); | 771 EXPECT_EQ(kFlags_set, s[0]->flags_mode()); |
773 EXPECT_EQ(kEqual, s[0]->flags_condition()); | 772 EXPECT_EQ(kEqual, s[0]->flags_condition()); |
774 } | 773 } |
775 } | 774 } |
776 | 775 |
777 | 776 |
778 TEST_F(InstructionSelectorTest, Word64EqualWithZero) { | 777 TEST_F(InstructionSelectorTest, Word64EqualWithZero) { |
(...skipping 19 matching lines...) Expand all Loading... |
798 ASSERT_EQ(2U, s[0]->InputCount()); | 797 ASSERT_EQ(2U, s[0]->InputCount()); |
799 EXPECT_EQ(1U, s[0]->OutputCount()); | 798 EXPECT_EQ(1U, s[0]->OutputCount()); |
800 EXPECT_EQ(kFlags_set, s[0]->flags_mode()); | 799 EXPECT_EQ(kFlags_set, s[0]->flags_mode()); |
801 EXPECT_EQ(kEqual, s[0]->flags_condition()); | 800 EXPECT_EQ(kEqual, s[0]->flags_condition()); |
802 } | 801 } |
803 } | 802 } |
804 | 803 |
805 } // namespace compiler | 804 } // namespace compiler |
806 } // namespace internal | 805 } // namespace internal |
807 } // namespace v8 | 806 } // namespace v8 |
OLD | NEW |