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

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

Issue 1485023004: MIPS:[turbofan] Use Ins, Dins to clear bits instead of And with inverted immediate. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix comments. 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
« 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 ASSERT_EQ(1U, s.size()); 370 ASSERT_EQ(1U, s.size());
371 EXPECT_EQ(kMips64Dext, s[0]->arch_opcode()); 371 EXPECT_EQ(kMips64Dext, s[0]->arch_opcode());
372 ASSERT_EQ(3U, s[0]->InputCount()); 372 ASSERT_EQ(3U, s[0]->InputCount());
373 EXPECT_EQ(lsb, s.ToInt64(s[0]->InputAt(1))); 373 EXPECT_EQ(lsb, s.ToInt64(s[0]->InputAt(1)));
374 EXPECT_EQ(width, s.ToInt64(s[0]->InputAt(2))); 374 EXPECT_EQ(width, s.ToInt64(s[0]->InputAt(2)));
375 } 375 }
376 } 376 }
377 } 377 }
378 378
379 379
380 TEST_F(InstructionSelectorTest, Word32AndToClearBits) {
381 TRACED_FORRANGE(int32_t, shift, 1, 31) {
382 int32_t mask = ~((1 << shift) - 1);
383 StreamBuilder m(this, kMachInt32, kMachInt32);
384 m.Return(m.Word32And(m.Parameter(0), m.Int32Constant(mask)));
385 Stream s = m.Build();
386 ASSERT_EQ(1U, s.size());
387 EXPECT_EQ(kMips64Ins, s[0]->arch_opcode());
388 ASSERT_EQ(3U, s[0]->InputCount());
389 EXPECT_EQ(0, s.ToInt32(s[0]->InputAt(1)));
390 EXPECT_EQ(shift, s.ToInt32(s[0]->InputAt(2)));
391 }
392 TRACED_FORRANGE(int32_t, shift, 1, 31) {
393 int32_t mask = ~((1 << shift) - 1);
394 StreamBuilder m(this, kMachInt32, kMachInt32);
395 m.Return(m.Word32And(m.Int32Constant(mask), m.Parameter(0)));
396 Stream s = m.Build();
397 ASSERT_EQ(1U, s.size());
398 EXPECT_EQ(kMips64Ins, s[0]->arch_opcode());
399 ASSERT_EQ(3U, s[0]->InputCount());
400 EXPECT_EQ(0, s.ToInt32(s[0]->InputAt(1)));
401 EXPECT_EQ(shift, s.ToInt32(s[0]->InputAt(2)));
402 }
403 }
404
405
406 TEST_F(InstructionSelectorTest, Word64AndToClearBits) {
407 TRACED_FORRANGE(int32_t, shift, 1, 31) {
408 int64_t mask = ~((1 << shift) - 1);
409 StreamBuilder m(this, kMachInt64, kMachInt64);
410 m.Return(m.Word64And(m.Parameter(0), m.Int64Constant(mask)));
411 Stream s = m.Build();
412 ASSERT_EQ(1U, s.size());
413 EXPECT_EQ(kMips64Dins, s[0]->arch_opcode());
414 ASSERT_EQ(3U, s[0]->InputCount());
415 EXPECT_EQ(0, s.ToInt32(s[0]->InputAt(1)));
416 EXPECT_EQ(shift, s.ToInt32(s[0]->InputAt(2)));
417 }
418 TRACED_FORRANGE(int32_t, shift, 1, 31) {
419 int64_t mask = ~((1 << shift) - 1);
420 StreamBuilder m(this, kMachInt64, kMachInt64);
421 m.Return(m.Word64And(m.Int64Constant(mask), m.Parameter(0)));
422 Stream s = m.Build();
423 ASSERT_EQ(1U, s.size());
424 EXPECT_EQ(kMips64Dins, s[0]->arch_opcode());
425 ASSERT_EQ(3U, s[0]->InputCount());
426 EXPECT_EQ(0, s.ToInt32(s[0]->InputAt(1)));
427 EXPECT_EQ(shift, s.ToInt32(s[0]->InputAt(2)));
428 }
429 }
430
431
380 // ---------------------------------------------------------------------------- 432 // ----------------------------------------------------------------------------
381 // Logical instructions. 433 // Logical instructions.
382 // ---------------------------------------------------------------------------- 434 // ----------------------------------------------------------------------------
383 typedef InstructionSelectorTestWithParam<MachInst2> 435 typedef InstructionSelectorTestWithParam<MachInst2>
384 InstructionSelectorLogicalTest; 436 InstructionSelectorLogicalTest;
385 437
386 438
387 TEST_P(InstructionSelectorLogicalTest, Parameter) { 439 TEST_P(InstructionSelectorLogicalTest, Parameter) {
388 const MachInst2 dpi = GetParam(); 440 const MachInst2 dpi = GetParam();
389 const MachineType type = dpi.machine_type; 441 const MachineType type = dpi.machine_type;
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 ASSERT_EQ(1U, s.size()); 1247 ASSERT_EQ(1U, s.size());
1196 EXPECT_EQ(kMips64Float64Min, s[0]->arch_opcode()); 1248 EXPECT_EQ(kMips64Float64Min, s[0]->arch_opcode());
1197 ASSERT_EQ(2U, s[0]->InputCount()); 1249 ASSERT_EQ(2U, s[0]->InputCount());
1198 ASSERT_EQ(1U, s[0]->OutputCount()); 1250 ASSERT_EQ(1U, s[0]->OutputCount());
1199 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); 1251 EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
1200 } 1252 }
1201 1253
1202 } // namespace compiler 1254 } // namespace compiler
1203 } // namespace internal 1255 } // namespace internal
1204 } // namespace v8 1256 } // 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