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

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

Issue 1021183002: [turbofan] Turn Math.clz32 into an inlinable builtin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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
11 namespace { 11 namespace {
12 12
13 // Immediates (random subset). 13 // Immediates (random subset).
14 static const int32_t kImmediates[] = { 14 const int32_t kImmediates[] = {kMinInt, -42, -1, 0, 1, 2,
15 kMinInt, -42, -1, 0, 1, 2, 3, 4, 5, 15 3, 4, 5, 6, 7, 8,
16 6, 7, 8, 16, 42, 0xff, 0xffff, 0x0f0f0f0f, kMaxInt}; 16 16, 42, 0xff, 0xffff, 0x0f0f0f0f, kMaxInt};
17 17
18 } // namespace 18 } // namespace
19 19
20 20
21 TEST_F(InstructionSelectorTest, Int32AddWithParameter) { 21 TEST_F(InstructionSelectorTest, Int32AddWithParameter) {
22 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); 22 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
23 m.Return(m.Int32Add(m.Parameter(0), m.Parameter(1))); 23 m.Return(m.Int32Add(m.Parameter(0), m.Parameter(1)));
24 Stream s = m.Build(); 24 Stream s = m.Build();
25 ASSERT_EQ(1U, s.size()); 25 ASSERT_EQ(1U, s.size());
26 EXPECT_EQ(kIA32Lea, s[0]->arch_opcode()); 26 EXPECT_EQ(kIA32Lea, s[0]->arch_opcode());
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 Stream s = m.Build(); 682 Stream s = m.Build();
683 ASSERT_EQ(1U, s.size()); 683 ASSERT_EQ(1U, s.size());
684 EXPECT_EQ(kIA32StackCheck, s[0]->arch_opcode()); 684 EXPECT_EQ(kIA32StackCheck, s[0]->arch_opcode());
685 ASSERT_EQ(0U, s[0]->InputCount()); 685 ASSERT_EQ(0U, s[0]->InputCount());
686 ASSERT_EQ(1U, s[0]->OutputCount()); 686 ASSERT_EQ(1U, s[0]->OutputCount());
687 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); 687 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
688 EXPECT_EQ(kFlags_set, s[0]->flags_mode()); 688 EXPECT_EQ(kFlags_set, s[0]->flags_mode());
689 EXPECT_EQ(kUnsignedGreaterThan, s[0]->flags_condition()); 689 EXPECT_EQ(kUnsignedGreaterThan, s[0]->flags_condition());
690 } 690 }
691 691
692
693 TEST_F(InstructionSelectorTest, Word32Clz) {
694 StreamBuilder m(this, kMachUint32, kMachUint32);
695 Node* const p0 = m.Parameter(0);
696 Node* const n = m.Word32Clz(p0);
697 m.Return(n);
698 Stream s = m.Build();
699 ASSERT_EQ(1U, s.size());
700 EXPECT_EQ(kIA32Lzcnt, s[0]->arch_opcode());
701 ASSERT_EQ(1U, s[0]->InputCount());
702 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
703 ASSERT_EQ(1U, s[0]->OutputCount());
704 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
705 }
706
692 } // namespace compiler 707 } // namespace compiler
693 } // namespace internal 708 } // namespace internal
694 } // namespace v8 709 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698