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

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

Issue 1444423002: MIPS64: [turbofan] Combine untagging shifts with Mul, Div and Mod. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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/mips64/instruction-selector-mips64.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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 m.Word64Shl(m.ChangeInt32ToInt64(m.Parameter(0)), m.Int32Constant(32))); 462 m.Word64Shl(m.ChangeInt32ToInt64(m.Parameter(0)), m.Int32Constant(32)));
463 Stream s = m.Build(); 463 Stream s = m.Build();
464 ASSERT_EQ(1U, s.size()); 464 ASSERT_EQ(1U, s.size());
465 EXPECT_EQ(kMips64Dshl, s[0]->arch_opcode()); 465 EXPECT_EQ(kMips64Dshl, s[0]->arch_opcode());
466 ASSERT_EQ(2U, s[0]->InputCount()); 466 ASSERT_EQ(2U, s[0]->InputCount());
467 EXPECT_EQ(1U, s[0]->OutputCount()); 467 EXPECT_EQ(1U, s[0]->OutputCount());
468 } 468 }
469 } 469 }
470 470
471 471
472 TEST_F(InstructionSelectorTest, CombineShiftsWithMul) {
473 {
474 StreamBuilder m(this, kMachInt32, kMachInt32);
475 m.Return(m.Int32Mul(m.Word64Sar(m.Parameter(0), m.Int32Constant(32)),
476 m.Word64Sar(m.Parameter(0), m.Int32Constant(32))));
477 Stream s = m.Build();
478 ASSERT_EQ(1U, s.size());
479 EXPECT_EQ(kMips64DMulHigh, s[0]->arch_opcode());
480 EXPECT_EQ(kMode_None, s[0]->addressing_mode());
481 ASSERT_EQ(2U, s[0]->InputCount());
482 EXPECT_EQ(1U, s[0]->OutputCount());
483 }
484 }
485
486
487 TEST_F(InstructionSelectorTest, CombineShiftsWithDivMod) {
488 {
489 StreamBuilder m(this, kMachInt32, kMachInt32);
490 m.Return(m.Int32Div(m.Word64Sar(m.Parameter(0), m.Int32Constant(32)),
491 m.Word64Sar(m.Parameter(0), m.Int32Constant(32))));
492 Stream s = m.Build();
493 ASSERT_EQ(1U, s.size());
494 EXPECT_EQ(kMips64Ddiv, s[0]->arch_opcode());
495 EXPECT_EQ(kMode_None, s[0]->addressing_mode());
496 ASSERT_EQ(2U, s[0]->InputCount());
497 EXPECT_EQ(1U, s[0]->OutputCount());
498 }
499 {
500 StreamBuilder m(this, kMachInt32, kMachInt32);
501 m.Return(m.Int32Mod(m.Word64Sar(m.Parameter(0), m.Int32Constant(32)),
502 m.Word64Sar(m.Parameter(0), m.Int32Constant(32))));
503 Stream s = m.Build();
504 ASSERT_EQ(1U, s.size());
505 EXPECT_EQ(kMips64Dmod, s[0]->arch_opcode());
506 EXPECT_EQ(kMode_None, s[0]->addressing_mode());
507 ASSERT_EQ(2U, s[0]->InputCount());
508 EXPECT_EQ(1U, s[0]->OutputCount());
509 }
510 }
511
512
472 // ---------------------------------------------------------------------------- 513 // ----------------------------------------------------------------------------
473 // Loads and stores. 514 // Loads and stores.
474 // ---------------------------------------------------------------------------- 515 // ----------------------------------------------------------------------------
475 516
476 517
477 namespace { 518 namespace {
478 519
479 struct MemoryAccess { 520 struct MemoryAccess {
480 MachineType type; 521 MachineType type;
481 ArchOpcode load_opcode; 522 ArchOpcode load_opcode;
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 ASSERT_EQ(1U, s.size()); 986 ASSERT_EQ(1U, s.size());
946 EXPECT_EQ(kMips64Float64Min, s[0]->arch_opcode()); 987 EXPECT_EQ(kMips64Float64Min, s[0]->arch_opcode());
947 ASSERT_EQ(2U, s[0]->InputCount()); 988 ASSERT_EQ(2U, s[0]->InputCount());
948 ASSERT_EQ(1U, s[0]->OutputCount()); 989 ASSERT_EQ(1U, s[0]->OutputCount());
949 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); 990 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
950 } 991 }
951 992
952 } // namespace compiler 993 } // namespace compiler
953 } // namespace internal 994 } // namespace internal
954 } // namespace v8 995 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/mips64/instruction-selector-mips64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698