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/compiler/instruction-selector-impl.h" | 6 #include "src/compiler/instruction-selector-impl.h" |
7 #include "src/compiler/node-matchers.h" | 7 #include "src/compiler/node-matchers.h" |
8 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 | 592 |
593 InstructionOperand outputs[] = { | 593 InstructionOperand outputs[] = { |
594 g.DefineAsFixed(node, eax), | 594 g.DefineAsFixed(node, eax), |
595 g.DefineAsFixed(NodeProperties::FindProjection(node, 1), ecx)}; | 595 g.DefineAsFixed(NodeProperties::FindProjection(node, 1), ecx)}; |
596 | 596 |
597 InstructionOperand temps[] = {g.TempRegister(edx)}; | 597 InstructionOperand temps[] = {g.TempRegister(edx)}; |
598 | 598 |
599 Emit(kX87MulPair, 2, outputs, 4, inputs, 1, temps); | 599 Emit(kX87MulPair, 2, outputs, 4, inputs, 1, temps); |
600 } | 600 } |
601 | 601 |
602 void InstructionSelector::VisitWord32PairShl(Node* node) { | 602 void VisitWord32PairShift(InstructionSelector* selector, InstructionCode opcode, |
603 X87OperandGenerator g(this); | 603 Node* node) { |
| 604 X87OperandGenerator g(selector); |
604 | 605 |
605 Node* shift = node->InputAt(2); | 606 Node* shift = node->InputAt(2); |
606 InstructionOperand shift_operand; | 607 InstructionOperand shift_operand; |
607 if (g.CanBeImmediate(shift)) { | 608 if (g.CanBeImmediate(shift)) { |
608 shift_operand = g.UseImmediate(shift); | 609 shift_operand = g.UseImmediate(shift); |
609 } else { | 610 } else { |
610 shift_operand = g.UseFixed(shift, ecx); | 611 shift_operand = g.UseFixed(shift, ecx); |
611 } | 612 } |
612 InstructionOperand inputs[] = {g.UseFixed(node->InputAt(0), eax), | 613 InstructionOperand inputs[] = {g.UseFixed(node->InputAt(0), eax), |
613 g.UseFixed(node->InputAt(1), edx), | 614 g.UseFixed(node->InputAt(1), edx), |
614 shift_operand}; | 615 shift_operand}; |
615 | 616 |
616 InstructionOperand outputs[] = { | 617 InstructionOperand outputs[] = { |
617 g.DefineAsFixed(node, eax), | 618 g.DefineAsFixed(node, eax), |
618 g.DefineAsFixed(NodeProperties::FindProjection(node, 1), edx)}; | 619 g.DefineAsFixed(NodeProperties::FindProjection(node, 1), edx)}; |
619 | 620 |
620 Emit(kX87ShlPair, 2, outputs, 3, inputs); | 621 selector->Emit(opcode, 2, outputs, 3, inputs); |
| 622 } |
| 623 |
| 624 void InstructionSelector::VisitWord32PairShl(Node* node) { |
| 625 VisitWord32PairShift(this, kX87ShlPair, node); |
621 } | 626 } |
622 | 627 |
623 void InstructionSelector::VisitWord32PairShr(Node* node) { | 628 void InstructionSelector::VisitWord32PairShr(Node* node) { |
624 X87OperandGenerator g(this); | 629 VisitWord32PairShift(this, kX87ShrPair, node); |
625 | |
626 Node* shift = node->InputAt(2); | |
627 InstructionOperand shift_operand; | |
628 if (g.CanBeImmediate(shift)) { | |
629 shift_operand = g.UseImmediate(shift); | |
630 } else { | |
631 shift_operand = g.UseFixed(shift, ecx); | |
632 } | |
633 InstructionOperand inputs[] = {g.UseFixed(node->InputAt(0), eax), | |
634 g.UseFixed(node->InputAt(1), edx), | |
635 shift_operand}; | |
636 | |
637 InstructionOperand outputs[] = { | |
638 g.DefineAsFixed(node, eax), | |
639 g.DefineAsFixed(NodeProperties::FindProjection(node, 1), edx)}; | |
640 | |
641 Emit(kX87ShrPair, 2, outputs, 3, inputs); | |
642 } | 630 } |
643 | 631 |
644 void InstructionSelector::VisitWord32PairSar(Node* node) { | 632 void InstructionSelector::VisitWord32PairSar(Node* node) { |
645 X87OperandGenerator g(this); | 633 VisitWord32PairShift(this, kX87SarPair, node); |
646 | |
647 Node* shift = node->InputAt(2); | |
648 InstructionOperand shift_operand; | |
649 if (g.CanBeImmediate(shift)) { | |
650 shift_operand = g.UseImmediate(shift); | |
651 } else { | |
652 shift_operand = g.UseFixed(shift, ecx); | |
653 } | |
654 InstructionOperand inputs[] = {g.UseFixed(node->InputAt(0), eax), | |
655 g.UseFixed(node->InputAt(1), edx), | |
656 shift_operand}; | |
657 | |
658 InstructionOperand outputs[] = { | |
659 g.DefineAsFixed(node, eax), | |
660 g.DefineAsFixed(NodeProperties::FindProjection(node, 1), edx)}; | |
661 | |
662 Emit(kX87SarPair, 2, outputs, 3, inputs); | |
663 } | 634 } |
664 | 635 |
665 void InstructionSelector::VisitWord32Ror(Node* node) { | 636 void InstructionSelector::VisitWord32Ror(Node* node) { |
666 VisitShift(this, node, kX87Ror); | 637 VisitShift(this, node, kX87Ror); |
667 } | 638 } |
668 | 639 |
669 | 640 |
670 void InstructionSelector::VisitWord32Clz(Node* node) { | 641 void InstructionSelector::VisitWord32Clz(Node* node) { |
671 X87OperandGenerator g(this); | 642 X87OperandGenerator g(this); |
672 Emit(kX87Lzcnt, g.DefineAsRegister(node), g.Use(node->InputAt(0))); | 643 Emit(kX87Lzcnt, g.DefineAsRegister(node), g.Use(node->InputAt(0))); |
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1586 MachineOperatorBuilder::kFloat32RoundTruncate | | 1557 MachineOperatorBuilder::kFloat32RoundTruncate | |
1587 MachineOperatorBuilder::kFloat64RoundTruncate | | 1558 MachineOperatorBuilder::kFloat64RoundTruncate | |
1588 MachineOperatorBuilder::kFloat32RoundTiesEven | | 1559 MachineOperatorBuilder::kFloat32RoundTiesEven | |
1589 MachineOperatorBuilder::kFloat64RoundTiesEven; | 1560 MachineOperatorBuilder::kFloat64RoundTiesEven; |
1590 return flags; | 1561 return flags; |
1591 } | 1562 } |
1592 | 1563 |
1593 } // namespace compiler | 1564 } // namespace compiler |
1594 } // namespace internal | 1565 } // namespace internal |
1595 } // namespace v8 | 1566 } // namespace v8 |
OLD | NEW |