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 #include "src/compiler/node-matchers.h" | 7 #include "src/compiler/node-matchers.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 Node* const n = m.Int32MulHigh(p0, p1); | 291 Node* const n = m.Int32MulHigh(p0, p1); |
292 m.Return(n); | 292 m.Return(n); |
293 Stream s = m.Build(); | 293 Stream s = m.Build(); |
294 ASSERT_EQ(1U, s.size()); | 294 ASSERT_EQ(1U, s.size()); |
295 EXPECT_EQ(kX64ImulHigh32, s[0]->arch_opcode()); | 295 EXPECT_EQ(kX64ImulHigh32, s[0]->arch_opcode()); |
296 ASSERT_EQ(2U, s[0]->InputCount()); | 296 ASSERT_EQ(2U, s[0]->InputCount()); |
297 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); | 297 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
298 EXPECT_TRUE(s.IsFixed(s[0]->InputAt(0), rax)); | 298 EXPECT_TRUE(s.IsFixed(s[0]->InputAt(0), rax)); |
299 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); | 299 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); |
300 EXPECT_TRUE(!s.IsUsedAtStart(s[0]->InputAt(1))); | 300 EXPECT_TRUE(!s.IsUsedAtStart(s[0]->InputAt(1))); |
301 ASSERT_EQ(1U, s[0]->OutputCount()); | 301 ASSERT_LE(1U, s[0]->OutputCount()); |
302 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); | 302 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
303 EXPECT_TRUE(s.IsFixed(s[0]->OutputAt(0), rdx)); | 303 EXPECT_TRUE(s.IsFixed(s[0]->OutputAt(0), rdx)); |
304 } | 304 } |
| 305 |
| 306 |
| 307 TEST_F(InstructionSelectorTest, Uint32MulHigh) { |
| 308 StreamBuilder m(this, kMachUint32, kMachUint32, kMachUint32); |
| 309 Node* const p0 = m.Parameter(0); |
| 310 Node* const p1 = m.Parameter(1); |
| 311 Node* const n = m.Uint32MulHigh(p0, p1); |
| 312 m.Return(n); |
| 313 Stream s = m.Build(); |
| 314 ASSERT_EQ(1U, s.size()); |
| 315 EXPECT_EQ(kX64UmulHigh32, s[0]->arch_opcode()); |
| 316 ASSERT_EQ(2U, s[0]->InputCount()); |
| 317 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
| 318 EXPECT_TRUE(s.IsFixed(s[0]->InputAt(0), rax)); |
| 319 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); |
| 320 EXPECT_TRUE(!s.IsUsedAtStart(s[0]->InputAt(1))); |
| 321 ASSERT_LE(1U, s[0]->OutputCount()); |
| 322 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
| 323 EXPECT_TRUE(s.IsFixed(s[0]->OutputAt(0), rdx)); |
| 324 } |
305 | 325 |
306 } // namespace compiler | 326 } // namespace compiler |
307 } // namespace internal | 327 } // namespace internal |
308 } // namespace v8 | 328 } // namespace v8 |
OLD | NEW |