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

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

Issue 1485833003: MIPS:[turbofan] Use Nor instruction for bit negation instead of xori. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode()); 355 EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode());
356 EXPECT_EQ(2U, s[0]->InputCount()); 356 EXPECT_EQ(2U, s[0]->InputCount());
357 EXPECT_EQ(1U, s[0]->OutputCount()); 357 EXPECT_EQ(1U, s[0]->OutputCount());
358 } 358 }
359 359
360 360
361 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorLogicalTest, 361 INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorLogicalTest,
362 ::testing::ValuesIn(kLogicalInstructions)); 362 ::testing::ValuesIn(kLogicalInstructions));
363 363
364 364
365 TEST_F(InstructionSelectorTest, Word32XorMinusOneWithParameter) {
366 {
367 StreamBuilder m(this, kMachInt32, kMachInt32);
368 m.Return(m.Word32Xor(m.Parameter(0), m.Int32Constant(-1)));
369 Stream s = m.Build();
370 ASSERT_EQ(1U, s.size());
371 EXPECT_EQ(kMipsNor, s[0]->arch_opcode());
372 EXPECT_EQ(2U, s[0]->InputCount());
373 EXPECT_EQ(1U, s[0]->OutputCount());
374 }
375 {
376 StreamBuilder m(this, kMachInt32, kMachInt32);
377 m.Return(m.Word32Xor(m.Int32Constant(-1), m.Parameter(0)));
378 Stream s = m.Build();
379 ASSERT_EQ(1U, s.size());
380 EXPECT_EQ(kMipsNor, s[0]->arch_opcode());
381 EXPECT_EQ(2U, s[0]->InputCount());
382 EXPECT_EQ(1U, s[0]->OutputCount());
383 }
384 }
385
386
365 TEST_F(InstructionSelectorTest, Word32XorMinusOneWithWord32Or) { 387 TEST_F(InstructionSelectorTest, Word32XorMinusOneWithWord32Or) {
366 { 388 {
367 StreamBuilder m(this, kMachInt32, kMachInt32); 389 StreamBuilder m(this, kMachInt32, kMachInt32);
368 m.Return(m.Word32Xor(m.Word32Or(m.Parameter(0), m.Parameter(0)), 390 m.Return(m.Word32Xor(m.Word32Or(m.Parameter(0), m.Parameter(0)),
369 m.Int32Constant(-1))); 391 m.Int32Constant(-1)));
370 Stream s = m.Build(); 392 Stream s = m.Build();
371 ASSERT_EQ(1U, s.size()); 393 ASSERT_EQ(1U, s.size());
372 EXPECT_EQ(kMipsNor, s[0]->arch_opcode()); 394 EXPECT_EQ(kMipsNor, s[0]->arch_opcode());
373 EXPECT_EQ(2U, s[0]->InputCount()); 395 EXPECT_EQ(2U, s[0]->InputCount());
374 EXPECT_EQ(1U, s[0]->OutputCount()); 396 EXPECT_EQ(1U, s[0]->OutputCount());
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 EXPECT_EQ(kMipsFloat64Min, s[0]->arch_opcode()); 1031 EXPECT_EQ(kMipsFloat64Min, s[0]->arch_opcode());
1010 ASSERT_EQ(2U, s[0]->InputCount()); 1032 ASSERT_EQ(2U, s[0]->InputCount());
1011 ASSERT_EQ(1U, s[0]->OutputCount()); 1033 ASSERT_EQ(1U, s[0]->OutputCount());
1012 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); 1034 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
1013 } 1035 }
1014 1036
1015 1037
1016 } // namespace compiler 1038 } // namespace compiler
1017 } // namespace internal 1039 } // namespace internal
1018 } // namespace v8 1040 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698