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

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

Issue 1209413008: [turbofan] Move MulHigh asr onto add on ARM64 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « src/compiler/arm64/instruction-selector-arm64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2585 matching lines...) Expand 10 before | Expand all | Expand 10 after
2596 EXPECT_EQ(kArm64Asr, s[1]->arch_opcode()); 2596 EXPECT_EQ(kArm64Asr, s[1]->arch_opcode());
2597 ASSERT_EQ(2U, s[1]->InputCount()); 2597 ASSERT_EQ(2U, s[1]->InputCount());
2598 EXPECT_EQ(s.ToVreg(s[0]->Output()), s.ToVreg(s[1]->InputAt(0))); 2598 EXPECT_EQ(s.ToVreg(s[0]->Output()), s.ToVreg(s[1]->InputAt(0)));
2599 EXPECT_EQ((shift & 0x1f) + 32, s.ToInt64(s[1]->InputAt(1))); 2599 EXPECT_EQ((shift & 0x1f) + 32, s.ToInt64(s[1]->InputAt(1)));
2600 ASSERT_EQ(1U, s[1]->OutputCount()); 2600 ASSERT_EQ(1U, s[1]->OutputCount());
2601 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[1]->Output())); 2601 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[1]->Output()));
2602 } 2602 }
2603 } 2603 }
2604 2604
2605 2605
2606 TEST_F(InstructionSelectorTest, Int32MulHighWithAdd) {
2607 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
2608 Node* const p0 = m.Parameter(0);
2609 Node* const p1 = m.Parameter(1);
2610 Node* const a = m.Int32Add(m.Int32MulHigh(p0, p1), p0);
2611 // Test only one shift constant here, as we're only interested in it being a
2612 // 32-bit operation; the shift amount is irrelevant.
2613 Node* const n = m.Word32Sar(a, m.Int32Constant(1));
2614 m.Return(n);
2615 Stream s = m.Build();
2616 ASSERT_EQ(3U, s.size());
2617 EXPECT_EQ(kArm64Smull, s[0]->arch_opcode());
2618 ASSERT_EQ(2U, s[0]->InputCount());
2619 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
2620 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
2621 ASSERT_EQ(1U, s[0]->OutputCount());
2622 EXPECT_EQ(kArm64Add, s[1]->arch_opcode());
2623 EXPECT_EQ(kMode_Operand2_R_ASR_I, s[1]->addressing_mode());
2624 ASSERT_EQ(3U, s[1]->InputCount());
2625 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[1]->InputAt(0)));
2626 EXPECT_EQ(s.ToVreg(s[0]->Output()), s.ToVreg(s[1]->InputAt(1)));
2627 EXPECT_EQ(32, s.ToInt64(s[1]->InputAt(2)));
2628 ASSERT_EQ(1U, s[1]->OutputCount());
2629 EXPECT_EQ(kArm64Asr32, s[2]->arch_opcode());
2630 ASSERT_EQ(2U, s[2]->InputCount());
2631 EXPECT_EQ(s.ToVreg(s[1]->Output()), s.ToVreg(s[2]->InputAt(0)));
2632 EXPECT_EQ(1, s.ToInt64(s[2]->InputAt(1)));
2633 ASSERT_EQ(1U, s[2]->OutputCount());
2634 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[2]->Output()));
2635 }
2636
2637
2606 TEST_F(InstructionSelectorTest, Uint32MulHighWithShr) { 2638 TEST_F(InstructionSelectorTest, Uint32MulHighWithShr) {
2607 TRACED_FORRANGE(int32_t, shift, -32, 63) { 2639 TRACED_FORRANGE(int32_t, shift, -32, 63) {
2608 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); 2640 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
2609 Node* const p0 = m.Parameter(0); 2641 Node* const p0 = m.Parameter(0);
2610 Node* const p1 = m.Parameter(1); 2642 Node* const p1 = m.Parameter(1);
2611 Node* const n = 2643 Node* const n =
2612 m.Word32Shr(m.Uint32MulHigh(p0, p1), m.Int32Constant(shift)); 2644 m.Word32Shr(m.Uint32MulHigh(p0, p1), m.Int32Constant(shift));
2613 m.Return(n); 2645 m.Return(n);
2614 Stream s = m.Build(); 2646 Stream s = m.Build();
2615 ASSERT_EQ(2U, s.size()); 2647 ASSERT_EQ(2U, s.size());
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
2781 EXPECT_EQ(kArm64Float64Neg, s[0]->arch_opcode()); 2813 EXPECT_EQ(kArm64Float64Neg, s[0]->arch_opcode());
2782 ASSERT_EQ(1U, s[0]->InputCount()); 2814 ASSERT_EQ(1U, s[0]->InputCount());
2783 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); 2815 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
2784 ASSERT_EQ(1U, s[0]->OutputCount()); 2816 ASSERT_EQ(1U, s[0]->OutputCount());
2785 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); 2817 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
2786 } 2818 }
2787 2819
2788 } // namespace compiler 2820 } // namespace compiler
2789 } // namespace internal 2821 } // namespace internal
2790 } // namespace v8 2822 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/arm64/instruction-selector-arm64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698