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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
529 return; | 529 return; |
530 case IrOpcode::kFloat64RoundTiesEven: | 530 case IrOpcode::kFloat64RoundTiesEven: |
531 Emit(kMipsRoundWD, g.DefineAsRegister(node), | 531 Emit(kMipsRoundWD, g.DefineAsRegister(node), |
532 g.UseRegister(value->InputAt(0))); | 532 g.UseRegister(value->InputAt(0))); |
533 return; | 533 return; |
534 case IrOpcode::kFloat64RoundTruncate: | 534 case IrOpcode::kFloat64RoundTruncate: |
535 Emit(kMipsTruncWD, g.DefineAsRegister(node), | 535 Emit(kMipsTruncWD, g.DefineAsRegister(node), |
536 g.UseRegister(value->InputAt(0))); | 536 g.UseRegister(value->InputAt(0))); |
537 return; | 537 return; |
538 default: | 538 default: |
539 VisitRR(this, kMipsTruncWD, node); | 539 break; |
540 } | |
541 if (value->opcode() == IrOpcode::kChangeFloat32ToFloat64) { | |
542 Node* next = value->InputAt(0); | |
543 if (CanCover(value, next)) { | |
544 // Match ChangeFloat64ToInt32(ChangeFloat32ToFloat64(Float64Round##OP)) | |
545 switch (next->opcode()) { | |
546 case IrOpcode::kFloat32RoundDown: | |
547 Emit(kMipsFloorWS, g.DefineAsRegister(node), | |
548 g.UseRegister(next->InputAt(0))); | |
549 return; | |
550 case IrOpcode::kFloat32RoundUp: | |
551 Emit(kMipsCeilWS, g.DefineAsRegister(node), | |
552 g.UseRegister(next->InputAt(0))); | |
553 return; | |
554 case IrOpcode::kFloat32RoundTiesEven: | |
555 Emit(kMipsRoundWS, g.DefineAsRegister(node), | |
556 g.UseRegister(next->InputAt(0))); | |
557 return; | |
558 case IrOpcode::kFloat32RoundTruncate: | |
559 Emit(kMipsTruncWS, g.DefineAsRegister(node), | |
560 g.UseRegister(next->InputAt(0))); | |
561 return; | |
562 default: | |
563 Emit(kMips64TruncWS, g.DefineAsRegister(node), | |
Alan Li
2015/12/17 02:27:04
For mips32, it seems that you haven't implemented
dusan.milosavljevic
2015/12/17 13:44:10
Done.
| |
564 g.UseRegister(value->InputAt(0))); | |
565 return; | |
566 } | |
567 } else { | |
568 // Match float32 -> float64 -> int32 representation change path. | |
569 Emit(kMipsTruncWS, g.DefineAsRegister(node), | |
570 g.UseRegister(value->InputAt(0))); | |
540 return; | 571 return; |
572 } | |
541 } | 573 } |
542 } | 574 } |
543 VisitRR(this, kMipsTruncWD, node); | 575 VisitRR(this, kMipsTruncWD, node); |
544 } | 576 } |
545 | 577 |
546 | 578 |
547 void InstructionSelector::VisitChangeFloat64ToUint32(Node* node) { | 579 void InstructionSelector::VisitChangeFloat64ToUint32(Node* node) { |
548 VisitRR(this, kMipsTruncUwD, node); | 580 VisitRR(this, kMipsTruncUwD, node); |
549 } | 581 } |
550 | 582 |
551 | 583 |
552 void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) { | 584 void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) { |
585 MipsOperandGenerator g(this); | |
586 Node* value = node->InputAt(0); | |
587 // Match TruncateFloat64ToFloat32(ChangeInt32ToFloat64) to corresponding | |
588 // instruction. | |
589 if (CanCover(node, value) && | |
590 value->opcode() == IrOpcode::kChangeInt32ToFloat64) { | |
591 Emit(kMipsCvtSW, g.DefineAsRegister(node), | |
592 g.UseRegister(value->InputAt(0))); | |
593 return; | |
594 } | |
553 VisitRR(this, kMipsCvtSD, node); | 595 VisitRR(this, kMipsCvtSD, node); |
554 } | 596 } |
555 | 597 |
556 | 598 |
557 void InstructionSelector::VisitTruncateFloat64ToInt32(Node* node) { | 599 void InstructionSelector::VisitTruncateFloat64ToInt32(Node* node) { |
558 switch (TruncationModeOf(node->op())) { | 600 switch (TruncationModeOf(node->op())) { |
559 case TruncationMode::kJavaScript: | 601 case TruncationMode::kJavaScript: |
560 return VisitRR(this, kArchTruncateDoubleToI, node); | 602 return VisitRR(this, kArchTruncateDoubleToI, node); |
561 case TruncationMode::kRoundToZero: | 603 case TruncationMode::kRoundToZero: |
562 return VisitRR(this, kMipsTruncWD, node); | 604 return VisitRR(this, kMipsTruncWD, node); |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1281 MachineOperatorBuilder::kFloat32Max | | 1323 MachineOperatorBuilder::kFloat32Max | |
1282 MachineOperatorBuilder::kFloat32RoundDown | | 1324 MachineOperatorBuilder::kFloat32RoundDown | |
1283 MachineOperatorBuilder::kFloat32RoundUp | | 1325 MachineOperatorBuilder::kFloat32RoundUp | |
1284 MachineOperatorBuilder::kFloat32RoundTruncate | | 1326 MachineOperatorBuilder::kFloat32RoundTruncate | |
1285 MachineOperatorBuilder::kFloat32RoundTiesEven; | 1327 MachineOperatorBuilder::kFloat32RoundTiesEven; |
1286 } | 1328 } |
1287 | 1329 |
1288 } // namespace compiler | 1330 } // namespace compiler |
1289 } // namespace internal | 1331 } // namespace internal |
1290 } // namespace v8 | 1332 } // namespace v8 |
OLD | NEW |