| OLD | NEW |
| 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 VisitRRO(this, kMips64Shr, node); | 279 VisitRRO(this, kMips64Shr, node); |
| 280 } | 280 } |
| 281 | 281 |
| 282 | 282 |
| 283 void InstructionSelector::VisitWord32Sar(Node* node) { | 283 void InstructionSelector::VisitWord32Sar(Node* node) { |
| 284 VisitRRO(this, kMips64Sar, node); | 284 VisitRRO(this, kMips64Sar, node); |
| 285 } | 285 } |
| 286 | 286 |
| 287 | 287 |
| 288 void InstructionSelector::VisitWord64Shl(Node* node) { | 288 void InstructionSelector::VisitWord64Shl(Node* node) { |
| 289 Mips64OperandGenerator g(this); |
| 290 Int64BinopMatcher m(node); |
| 291 if ((m.left().IsChangeInt32ToInt64() || m.left().IsChangeUint32ToUint64()) && |
| 292 m.right().IsInRange(32, 63)) { |
| 293 // There's no need to sign/zero-extend to 64-bit if we shift out the upper |
| 294 // 32 bits anyway. |
| 295 Emit(kMips64Dshl, g.DefineSameAsFirst(node), |
| 296 g.UseRegister(m.left().node()->InputAt(0)), |
| 297 g.UseImmediate(m.right().node())); |
| 298 return; |
| 299 } |
| 289 VisitRRO(this, kMips64Dshl, node); | 300 VisitRRO(this, kMips64Dshl, node); |
| 290 } | 301 } |
| 291 | 302 |
| 292 | 303 |
| 293 void InstructionSelector::VisitWord64Shr(Node* node) { | 304 void InstructionSelector::VisitWord64Shr(Node* node) { |
| 294 VisitRRO(this, kMips64Dshr, node); | 305 VisitRRO(this, kMips64Dshr, node); |
| 295 } | 306 } |
| 296 | 307 |
| 297 | 308 |
| 298 void InstructionSelector::VisitWord64Sar(Node* node) { | 309 void InstructionSelector::VisitWord64Sar(Node* node) { |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 | 533 |
| 523 void InstructionSelector::VisitChangeUint32ToUint64(Node* node) { | 534 void InstructionSelector::VisitChangeUint32ToUint64(Node* node) { |
| 524 Mips64OperandGenerator g(this); | 535 Mips64OperandGenerator g(this); |
| 525 Emit(kMips64Dext, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)), | 536 Emit(kMips64Dext, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)), |
| 526 g.TempImmediate(0), g.TempImmediate(32)); | 537 g.TempImmediate(0), g.TempImmediate(32)); |
| 527 } | 538 } |
| 528 | 539 |
| 529 | 540 |
| 530 void InstructionSelector::VisitTruncateInt64ToInt32(Node* node) { | 541 void InstructionSelector::VisitTruncateInt64ToInt32(Node* node) { |
| 531 Mips64OperandGenerator g(this); | 542 Mips64OperandGenerator g(this); |
| 543 Node* value = node->InputAt(0); |
| 544 if (CanCover(node, value)) { |
| 545 switch (value->opcode()) { |
| 546 case IrOpcode::kWord64Sar: { |
| 547 Int64BinopMatcher m(value); |
| 548 if (m.right().IsInRange(32, 63)) { |
| 549 // After smi untagging no need for truncate. Combine sequence. |
| 550 Emit(kMips64Dsar, g.DefineSameAsFirst(node), |
| 551 g.UseRegister(m.left().node()), g.TempImmediate(kSmiShift)); |
| 552 return; |
| 553 } |
| 554 break; |
| 555 } |
| 556 default: |
| 557 break; |
| 558 } |
| 559 } |
| 532 Emit(kMips64Ext, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)), | 560 Emit(kMips64Ext, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)), |
| 533 g.TempImmediate(0), g.TempImmediate(32)); | 561 g.TempImmediate(0), g.TempImmediate(32)); |
| 534 } | 562 } |
| 535 | 563 |
| 536 | 564 |
| 537 void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) { | 565 void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) { |
| 538 VisitRR(this, kMips64CvtSD, node); | 566 VisitRR(this, kMips64CvtSD, node); |
| 539 } | 567 } |
| 540 | 568 |
| 541 | 569 |
| (...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1317 // static | 1345 // static |
| 1318 MachineOperatorBuilder::Flags | 1346 MachineOperatorBuilder::Flags |
| 1319 InstructionSelector::SupportedMachineOperatorFlags() { | 1347 InstructionSelector::SupportedMachineOperatorFlags() { |
| 1320 return MachineOperatorBuilder::kFloat64RoundDown | | 1348 return MachineOperatorBuilder::kFloat64RoundDown | |
| 1321 MachineOperatorBuilder::kFloat64RoundTruncate; | 1349 MachineOperatorBuilder::kFloat64RoundTruncate; |
| 1322 } | 1350 } |
| 1323 | 1351 |
| 1324 } // namespace compiler | 1352 } // namespace compiler |
| 1325 } // namespace internal | 1353 } // namespace internal |
| 1326 } // namespace v8 | 1354 } // namespace v8 |
| OLD | NEW |