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

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

Issue 1459723002: MIPS: [turbofan] Add matching rule to use Nor instruction. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed typo. 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 | « test/unittests/compiler/mips/instruction-selector-mips-unittest.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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 ASSERT_EQ(1U, s.size()); 393 ASSERT_EQ(1U, s.size());
394 EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode()); 394 EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode());
395 EXPECT_EQ(2U, s[0]->InputCount()); 395 EXPECT_EQ(2U, s[0]->InputCount());
396 EXPECT_EQ(1U, s[0]->OutputCount()); 396 EXPECT_EQ(1U, s[0]->OutputCount());
397 } 397 }
398 398
399 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorLogicalTest, 399 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorLogicalTest,
400 ::testing::ValuesIn(kLogicalInstructions)); 400 ::testing::ValuesIn(kLogicalInstructions));
401 401
402 402
403 TEST_F(InstructionSelectorTest, Word64XorMinusOneWithWord64Or) {
404 {
405 StreamBuilder m(this, kMachInt64, kMachInt64);
406 m.Return(m.Word64Xor(m.Word64Or(m.Parameter(0), m.Parameter(0)),
407 m.Int64Constant(-1)));
408 Stream s = m.Build();
409 ASSERT_EQ(1U, s.size());
410 EXPECT_EQ(kMips64Nor, s[0]->arch_opcode());
411 EXPECT_EQ(2U, s[0]->InputCount());
412 EXPECT_EQ(1U, s[0]->OutputCount());
413 }
414 {
415 StreamBuilder m(this, kMachInt64, kMachInt64);
416 m.Return(m.Word64Xor(m.Int64Constant(-1),
417 m.Word64Or(m.Parameter(0), m.Parameter(0))));
418 Stream s = m.Build();
419 ASSERT_EQ(1U, s.size());
420 EXPECT_EQ(kMips64Nor, s[0]->arch_opcode());
421 EXPECT_EQ(2U, s[0]->InputCount());
422 EXPECT_EQ(1U, s[0]->OutputCount());
423 }
424 }
425
426
427 TEST_F(InstructionSelectorTest, Word32XorMinusOneWithWord32Or) {
428 {
429 StreamBuilder m(this, kMachInt32, kMachInt32);
430 m.Return(m.Word32Xor(m.Word32Or(m.Parameter(0), m.Parameter(0)),
431 m.Int32Constant(-1)));
432 Stream s = m.Build();
433 ASSERT_EQ(1U, s.size());
434 EXPECT_EQ(kMips64Nor, s[0]->arch_opcode());
435 EXPECT_EQ(2U, s[0]->InputCount());
436 EXPECT_EQ(1U, s[0]->OutputCount());
437 }
438 {
439 StreamBuilder m(this, kMachInt32, kMachInt32);
440 m.Return(m.Word32Xor(m.Int32Constant(-1),
441 m.Word32Or(m.Parameter(0), m.Parameter(0))));
442 Stream s = m.Build();
443 ASSERT_EQ(1U, s.size());
444 EXPECT_EQ(kMips64Nor, s[0]->arch_opcode());
445 EXPECT_EQ(2U, s[0]->InputCount());
446 EXPECT_EQ(1U, s[0]->OutputCount());
447 }
448 }
449
450
403 TEST_F(InstructionSelectorTest, Word32AndWithImmediateWithWord32Shr) { 451 TEST_F(InstructionSelectorTest, Word32AndWithImmediateWithWord32Shr) {
404 // The available shift operand range is `0 <= imm < 32`, but we also test 452 // The available shift operand range is `0 <= imm < 32`, but we also test
405 // that immediates outside this range are handled properly (modulo-32). 453 // that immediates outside this range are handled properly (modulo-32).
406 TRACED_FORRANGE(int32_t, shift, -32, 63) { 454 TRACED_FORRANGE(int32_t, shift, -32, 63) {
407 int32_t lsb = shift & 0x1f; 455 int32_t lsb = shift & 0x1f;
408 TRACED_FORRANGE(int32_t, width, 1, 31) { 456 TRACED_FORRANGE(int32_t, width, 1, 31) {
409 uint32_t msk = (1 << width) - 1; 457 uint32_t msk = (1 << width) - 1;
410 StreamBuilder m(this, kMachInt32, kMachInt32); 458 StreamBuilder m(this, kMachInt32, kMachInt32);
411 m.Return(m.Word32And(m.Word32Shr(m.Parameter(0), m.Int32Constant(shift)), 459 m.Return(m.Word32And(m.Word32Shr(m.Parameter(0), m.Int32Constant(shift)),
412 m.Int32Constant(msk))); 460 m.Int32Constant(msk)));
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 ASSERT_EQ(1U, s.size()); 1195 ASSERT_EQ(1U, s.size());
1148 EXPECT_EQ(kMips64Float64Min, s[0]->arch_opcode()); 1196 EXPECT_EQ(kMips64Float64Min, s[0]->arch_opcode());
1149 ASSERT_EQ(2U, s[0]->InputCount()); 1197 ASSERT_EQ(2U, s[0]->InputCount());
1150 ASSERT_EQ(1U, s[0]->OutputCount()); 1198 ASSERT_EQ(1U, s[0]->OutputCount());
1151 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); 1199 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
1152 } 1200 }
1153 1201
1154 } // namespace compiler 1202 } // namespace compiler
1155 } // namespace internal 1203 } // namespace internal
1156 } // namespace v8 1204 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/mips/instruction-selector-mips-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698