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

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

Issue 1179503003: [turbofan] Merge sar/shr into MulHigh on ARM64 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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
(...skipping 2347 matching lines...) Expand 10 before | Expand all | Expand 10 after
2358 ASSERT_EQ(1U, s[0]->OutputCount()); 2358 ASSERT_EQ(1U, s[0]->OutputCount());
2359 EXPECT_EQ(kArm64Asr, s[1]->arch_opcode()); 2359 EXPECT_EQ(kArm64Asr, s[1]->arch_opcode());
2360 ASSERT_EQ(2U, s[1]->InputCount()); 2360 ASSERT_EQ(2U, s[1]->InputCount());
2361 EXPECT_EQ(s.ToVreg(s[0]->Output()), s.ToVreg(s[1]->InputAt(0))); 2361 EXPECT_EQ(s.ToVreg(s[0]->Output()), s.ToVreg(s[1]->InputAt(0)));
2362 EXPECT_EQ(32, s.ToInt64(s[1]->InputAt(1))); 2362 EXPECT_EQ(32, s.ToInt64(s[1]->InputAt(1)));
2363 ASSERT_EQ(1U, s[1]->OutputCount()); 2363 ASSERT_EQ(1U, s[1]->OutputCount());
2364 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[1]->Output())); 2364 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[1]->Output()));
2365 } 2365 }
2366 2366
2367 2367
2368 TEST_F(InstructionSelectorTest, Int32MulHighWithSar) {
2369 TRACED_FORRANGE(int32_t, shift, -32, 63) {
2370 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
2371 Node* const p0 = m.Parameter(0);
2372 Node* const p1 = m.Parameter(1);
2373 Node* const n = m.Word32Sar(m.Int32MulHigh(p0, p1), m.Int32Constant(shift));
2374 m.Return(n);
2375 Stream s = m.Build();
2376 ASSERT_EQ(2U, s.size());
2377 EXPECT_EQ(kArm64Smull, s[0]->arch_opcode());
2378 ASSERT_EQ(2U, s[0]->InputCount());
2379 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
2380 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
2381 ASSERT_EQ(1U, s[0]->OutputCount());
2382 EXPECT_EQ(kArm64Asr, s[1]->arch_opcode());
2383 ASSERT_EQ(2U, s[1]->InputCount());
2384 EXPECT_EQ(s.ToVreg(s[0]->Output()), s.ToVreg(s[1]->InputAt(0)));
2385 EXPECT_EQ((shift & 0x1f) + 32, s.ToInt64(s[1]->InputAt(1)));
2386 ASSERT_EQ(1U, s[1]->OutputCount());
2387 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[1]->Output()));
2388 }
2389 }
2390
2391
2392 TEST_F(InstructionSelectorTest, Uint32MulHighWithShr) {
2393 TRACED_FORRANGE(int32_t, shift, -32, 63) {
2394 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
2395 Node* const p0 = m.Parameter(0);
2396 Node* const p1 = m.Parameter(1);
2397 Node* const n =
2398 m.Word32Shr(m.Uint32MulHigh(p0, p1), m.Int32Constant(shift));
2399 m.Return(n);
2400 Stream s = m.Build();
2401 ASSERT_EQ(2U, s.size());
2402 EXPECT_EQ(kArm64Umull, s[0]->arch_opcode());
2403 ASSERT_EQ(2U, s[0]->InputCount());
2404 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
2405 EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
2406 ASSERT_EQ(1U, s[0]->OutputCount());
2407 EXPECT_EQ(kArm64Lsr, s[1]->arch_opcode());
2408 ASSERT_EQ(2U, s[1]->InputCount());
2409 EXPECT_EQ(s.ToVreg(s[0]->Output()), s.ToVreg(s[1]->InputAt(0)));
2410 EXPECT_EQ((shift & 0x1f) + 32, s.ToInt64(s[1]->InputAt(1)));
2411 ASSERT_EQ(1U, s[1]->OutputCount());
2412 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[1]->Output()));
2413 }
2414 }
2415
2416
2368 TEST_F(InstructionSelectorTest, Word32SarWithWord32Shl) { 2417 TEST_F(InstructionSelectorTest, Word32SarWithWord32Shl) {
2369 TRACED_FORRANGE(int32_t, shift, 1, 31) { 2418 TRACED_FORRANGE(int32_t, shift, 1, 31) {
2370 StreamBuilder m(this, kMachInt32, kMachInt32); 2419 StreamBuilder m(this, kMachInt32, kMachInt32);
2371 Node* const p0 = m.Parameter(0); 2420 Node* const p0 = m.Parameter(0);
2372 Node* const r = m.Word32Sar(m.Word32Shl(p0, m.Int32Constant(shift)), 2421 Node* const r = m.Word32Sar(m.Word32Shl(p0, m.Int32Constant(shift)),
2373 m.Int32Constant(shift)); 2422 m.Int32Constant(shift));
2374 m.Return(r); 2423 m.Return(r);
2375 Stream s = m.Build(); 2424 Stream s = m.Build();
2376 ASSERT_EQ(1U, s.size()); 2425 ASSERT_EQ(1U, s.size());
2377 EXPECT_EQ(kArm64Sbfx32, s[0]->arch_opcode()); 2426 EXPECT_EQ(kArm64Sbfx32, s[0]->arch_opcode());
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
2518 EXPECT_EQ(kArm64Float64Neg, s[0]->arch_opcode()); 2567 EXPECT_EQ(kArm64Float64Neg, s[0]->arch_opcode());
2519 ASSERT_EQ(1U, s[0]->InputCount()); 2568 ASSERT_EQ(1U, s[0]->InputCount());
2520 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); 2569 EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
2521 ASSERT_EQ(1U, s[0]->OutputCount()); 2570 ASSERT_EQ(1U, s[0]->OutputCount());
2522 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); 2571 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
2523 } 2572 }
2524 2573
2525 } // namespace compiler 2574 } // namespace compiler
2526 } // namespace internal 2575 } // namespace internal
2527 } // namespace v8 2576 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698