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

Side by Side Diff: src/compiler/mips64/instruction-selector-mips64.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 "src/base/adapters.h" 5 #include "src/base/adapters.h"
6 #include "src/base/bits.h" 6 #include "src/base/bits.h"
7 #include "src/compiler/instruction-selector-impl.h" 7 #include "src/compiler/instruction-selector-impl.h"
8 #include "src/compiler/node-matchers.h" 8 #include "src/compiler/node-matchers.h"
9 #include "src/compiler/node-properties.h" 9 #include "src/compiler/node-properties.h"
10 10
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 m.right().Is(-1)) { 352 m.right().Is(-1)) {
353 Int32BinopMatcher mleft(m.left().node()); 353 Int32BinopMatcher mleft(m.left().node());
354 if (!mleft.right().HasValue()) { 354 if (!mleft.right().HasValue()) {
355 Mips64OperandGenerator g(this); 355 Mips64OperandGenerator g(this);
356 Emit(kMips64Nor, g.DefineAsRegister(node), 356 Emit(kMips64Nor, g.DefineAsRegister(node),
357 g.UseRegister(mleft.left().node()), 357 g.UseRegister(mleft.left().node()),
358 g.UseRegister(mleft.right().node())); 358 g.UseRegister(mleft.right().node()));
359 return; 359 return;
360 } 360 }
361 } 361 }
362 if (m.right().Is(-1)) {
363 // Use Nor for bit negation and eliminate constant loading for xori.
364 Mips64OperandGenerator g(this);
365 Emit(kMips64Nor, g.DefineAsRegister(node), g.UseRegister(m.left().node()),
366 g.TempImmediate(0));
367 return;
368 }
362 VisitBinop(this, node, kMips64Xor); 369 VisitBinop(this, node, kMips64Xor);
363 } 370 }
364 371
365 372
366 void InstructionSelector::VisitWord64Xor(Node* node) { 373 void InstructionSelector::VisitWord64Xor(Node* node) {
367 Int64BinopMatcher m(node); 374 Int64BinopMatcher m(node);
368 if (m.left().IsWord64Or() && CanCover(node, m.left().node()) && 375 if (m.left().IsWord64Or() && CanCover(node, m.left().node()) &&
369 m.right().Is(-1)) { 376 m.right().Is(-1)) {
370 Int64BinopMatcher mleft(m.left().node()); 377 Int64BinopMatcher mleft(m.left().node());
371 if (!mleft.right().HasValue()) { 378 if (!mleft.right().HasValue()) {
372 Mips64OperandGenerator g(this); 379 Mips64OperandGenerator g(this);
373 Emit(kMips64Nor, g.DefineAsRegister(node), 380 Emit(kMips64Nor, g.DefineAsRegister(node),
374 g.UseRegister(mleft.left().node()), 381 g.UseRegister(mleft.left().node()),
375 g.UseRegister(mleft.right().node())); 382 g.UseRegister(mleft.right().node()));
376 return; 383 return;
377 } 384 }
378 } 385 }
386 if (m.right().Is(-1)) {
387 // Use Nor for bit negation and eliminate constant loading for xori.
388 Mips64OperandGenerator g(this);
389 Emit(kMips64Nor, g.DefineAsRegister(node), g.UseRegister(m.left().node()),
390 g.TempImmediate(0));
391 return;
392 }
379 VisitBinop(this, node, kMips64Xor); 393 VisitBinop(this, node, kMips64Xor);
380 } 394 }
381 395
382 396
383 void InstructionSelector::VisitWord32Shl(Node* node) { 397 void InstructionSelector::VisitWord32Shl(Node* node) {
384 VisitRRO(this, kMips64Shl, node); 398 VisitRRO(this, kMips64Shl, node);
385 } 399 }
386 400
387 401
388 void InstructionSelector::VisitWord32Shr(Node* node) { 402 void InstructionSelector::VisitWord32Shr(Node* node) {
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1621 MachineOperatorBuilder::kFloat32RoundUp | 1635 MachineOperatorBuilder::kFloat32RoundUp |
1622 MachineOperatorBuilder::kFloat64RoundTruncate | 1636 MachineOperatorBuilder::kFloat64RoundTruncate |
1623 MachineOperatorBuilder::kFloat32RoundTruncate | 1637 MachineOperatorBuilder::kFloat32RoundTruncate |
1624 MachineOperatorBuilder::kFloat64RoundTiesEven | 1638 MachineOperatorBuilder::kFloat64RoundTiesEven |
1625 MachineOperatorBuilder::kFloat32RoundTiesEven; 1639 MachineOperatorBuilder::kFloat32RoundTiesEven;
1626 } 1640 }
1627 1641
1628 } // namespace compiler 1642 } // namespace compiler
1629 } // namespace internal 1643 } // namespace internal
1630 } // namespace v8 1644 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/mips64/code-generator-mips64.cc ('k') | test/unittests/compiler/mips/instruction-selector-mips-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698