| OLD | NEW |
| 1 //===- subzero/src/IceInstX8632.h - x86-32 machine instructions -*- C++ -*-===// | 1 //===- subzero/src/IceInstX8632.h - x86-32 machine instructions -*- C++ -*-===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // This file declares the InstX8632 and OperandX8632 classes and | 10 // This file declares the InstX8632 and OperandX8632 classes and |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // OperandX8632Mem and VariableSplit. | 31 // OperandX8632Mem and VariableSplit. |
| 32 class OperandX8632 : public Operand { | 32 class OperandX8632 : public Operand { |
| 33 OperandX8632() = delete; | 33 OperandX8632() = delete; |
| 34 OperandX8632(const OperandX8632 &) = delete; | 34 OperandX8632(const OperandX8632 &) = delete; |
| 35 OperandX8632 &operator=(const OperandX8632 &) = delete; | 35 OperandX8632 &operator=(const OperandX8632 &) = delete; |
| 36 | 36 |
| 37 public: | 37 public: |
| 38 enum OperandKindX8632 { k__Start = Operand::kTarget, kMem, kSplit }; | 38 enum OperandKindX8632 { k__Start = Operand::kTarget, kMem, kSplit }; |
| 39 using Operand::dump; | 39 using Operand::dump; |
| 40 void dump(const Cfg *, Ostream &Str) const override { | 40 void dump(const Cfg *, Ostream &Str) const override { |
| 41 if (ALLOW_DUMP) | 41 if (BuildDefs::dump()) |
| 42 Str << "<OperandX8632>"; | 42 Str << "<OperandX8632>"; |
| 43 } | 43 } |
| 44 | 44 |
| 45 protected: | 45 protected: |
| 46 OperandX8632(OperandKindX8632 Kind, Type Ty) | 46 OperandX8632(OperandKindX8632 Kind, Type Ty) |
| 47 : Operand(static_cast<OperandKind>(Kind), Ty) {} | 47 : Operand(static_cast<OperandKind>(Kind), Ty) {} |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 // OperandX8632Mem represents the m32 addressing mode, with optional | 50 // OperandX8632Mem represents the m32 addressing mode, with optional |
| 51 // base and index registers, a constant offset, and a fixed shift | 51 // base and index registers, a constant offset, and a fixed shift |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 InstX8632InplaceopGPR() = delete; | 571 InstX8632InplaceopGPR() = delete; |
| 572 InstX8632InplaceopGPR(const InstX8632InplaceopGPR &) = delete; | 572 InstX8632InplaceopGPR(const InstX8632InplaceopGPR &) = delete; |
| 573 InstX8632InplaceopGPR &operator=(const InstX8632InplaceopGPR &) = delete; | 573 InstX8632InplaceopGPR &operator=(const InstX8632InplaceopGPR &) = delete; |
| 574 | 574 |
| 575 public: | 575 public: |
| 576 static InstX8632InplaceopGPR *create(Cfg *Func, Operand *SrcDest) { | 576 static InstX8632InplaceopGPR *create(Cfg *Func, Operand *SrcDest) { |
| 577 return new (Func->allocate<InstX8632InplaceopGPR>()) | 577 return new (Func->allocate<InstX8632InplaceopGPR>()) |
| 578 InstX8632InplaceopGPR(Func, SrcDest); | 578 InstX8632InplaceopGPR(Func, SrcDest); |
| 579 } | 579 } |
| 580 void emit(const Cfg *Func) const override { | 580 void emit(const Cfg *Func) const override { |
| 581 if (!ALLOW_DUMP) | 581 if (!BuildDefs::dump()) |
| 582 return; | 582 return; |
| 583 Ostream &Str = Func->getContext()->getStrEmit(); | 583 Ostream &Str = Func->getContext()->getStrEmit(); |
| 584 assert(getSrcSize() == 1); | 584 assert(getSrcSize() == 1); |
| 585 Str << "\t" << Opcode << "\t"; | 585 Str << "\t" << Opcode << "\t"; |
| 586 getSrc(0)->emit(Func); | 586 getSrc(0)->emit(Func); |
| 587 } | 587 } |
| 588 void emitIAS(const Cfg *Func) const override { | 588 void emitIAS(const Cfg *Func) const override { |
| 589 assert(getSrcSize() == 1); | 589 assert(getSrcSize() == 1); |
| 590 const Variable *Var = getDest(); | 590 const Variable *Var = getDest(); |
| 591 Type Ty = Var->getType(); | 591 Type Ty = Var->getType(); |
| 592 emitIASOpTyGPR(Func, Ty, Var, Emitter); | 592 emitIASOpTyGPR(Func, Ty, Var, Emitter); |
| 593 } | 593 } |
| 594 void dump(const Cfg *Func) const override { | 594 void dump(const Cfg *Func) const override { |
| 595 if (!ALLOW_DUMP) | 595 if (!BuildDefs::dump()) |
| 596 return; | 596 return; |
| 597 Ostream &Str = Func->getContext()->getStrDump(); | 597 Ostream &Str = Func->getContext()->getStrDump(); |
| 598 dumpDest(Func); | 598 dumpDest(Func); |
| 599 Str << " = " << Opcode << "." << getDest()->getType() << " "; | 599 Str << " = " << Opcode << "." << getDest()->getType() << " "; |
| 600 dumpSources(Func); | 600 dumpSources(Func); |
| 601 } | 601 } |
| 602 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | 602 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
| 603 | 603 |
| 604 private: | 604 private: |
| 605 InstX8632InplaceopGPR(Cfg *Func, Operand *SrcDest) | 605 InstX8632InplaceopGPR(Cfg *Func, Operand *SrcDest) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 624 InstX8632UnaryopGPR() = delete; | 624 InstX8632UnaryopGPR() = delete; |
| 625 InstX8632UnaryopGPR(const InstX8632UnaryopGPR &) = delete; | 625 InstX8632UnaryopGPR(const InstX8632UnaryopGPR &) = delete; |
| 626 InstX8632UnaryopGPR &operator=(const InstX8632UnaryopGPR &) = delete; | 626 InstX8632UnaryopGPR &operator=(const InstX8632UnaryopGPR &) = delete; |
| 627 | 627 |
| 628 public: | 628 public: |
| 629 static InstX8632UnaryopGPR *create(Cfg *Func, Variable *Dest, Operand *Src) { | 629 static InstX8632UnaryopGPR *create(Cfg *Func, Variable *Dest, Operand *Src) { |
| 630 return new (Func->allocate<InstX8632UnaryopGPR>()) | 630 return new (Func->allocate<InstX8632UnaryopGPR>()) |
| 631 InstX8632UnaryopGPR(Func, Dest, Src); | 631 InstX8632UnaryopGPR(Func, Dest, Src); |
| 632 } | 632 } |
| 633 void emit(const Cfg *Func) const override { | 633 void emit(const Cfg *Func) const override { |
| 634 if (!ALLOW_DUMP) | 634 if (!BuildDefs::dump()) |
| 635 return; | 635 return; |
| 636 Ostream &Str = Func->getContext()->getStrEmit(); | 636 Ostream &Str = Func->getContext()->getStrEmit(); |
| 637 assert(getSrcSize() == 1); | 637 assert(getSrcSize() == 1); |
| 638 Type SrcTy = getSrc(0)->getType(); | 638 Type SrcTy = getSrc(0)->getType(); |
| 639 Type DestTy = getDest()->getType(); | 639 Type DestTy = getDest()->getType(); |
| 640 Str << "\t" << Opcode << getWidthString(SrcTy); | 640 Str << "\t" << Opcode << getWidthString(SrcTy); |
| 641 // Movsx and movzx need both the source and dest type width letter | 641 // Movsx and movzx need both the source and dest type width letter |
| 642 // to define the operation. The other unary operations have the | 642 // to define the operation. The other unary operations have the |
| 643 // same source and dest type and as a result need only one letter. | 643 // same source and dest type and as a result need only one letter. |
| 644 if (SrcTy != DestTy) | 644 if (SrcTy != DestTy) |
| 645 Str << getWidthString(DestTy); | 645 Str << getWidthString(DestTy); |
| 646 Str << "\t"; | 646 Str << "\t"; |
| 647 getSrc(0)->emit(Func); | 647 getSrc(0)->emit(Func); |
| 648 Str << ", "; | 648 Str << ", "; |
| 649 getDest()->emit(Func); | 649 getDest()->emit(Func); |
| 650 } | 650 } |
| 651 void emitIAS(const Cfg *Func) const override { | 651 void emitIAS(const Cfg *Func) const override { |
| 652 assert(getSrcSize() == 1); | 652 assert(getSrcSize() == 1); |
| 653 const Variable *Var = getDest(); | 653 const Variable *Var = getDest(); |
| 654 Type Ty = Var->getType(); | 654 Type Ty = Var->getType(); |
| 655 const Operand *Src = getSrc(0); | 655 const Operand *Src = getSrc(0); |
| 656 emitIASRegOpTyGPR(Func, Ty, Var, Src, Emitter); | 656 emitIASRegOpTyGPR(Func, Ty, Var, Src, Emitter); |
| 657 } | 657 } |
| 658 void dump(const Cfg *Func) const override { | 658 void dump(const Cfg *Func) const override { |
| 659 if (!ALLOW_DUMP) | 659 if (!BuildDefs::dump()) |
| 660 return; | 660 return; |
| 661 Ostream &Str = Func->getContext()->getStrDump(); | 661 Ostream &Str = Func->getContext()->getStrDump(); |
| 662 dumpDest(Func); | 662 dumpDest(Func); |
| 663 Str << " = " << Opcode << "." << getSrc(0)->getType() << " "; | 663 Str << " = " << Opcode << "." << getSrc(0)->getType() << " "; |
| 664 dumpSources(Func); | 664 dumpSources(Func); |
| 665 } | 665 } |
| 666 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | 666 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
| 667 | 667 |
| 668 private: | 668 private: |
| 669 InstX8632UnaryopGPR(Cfg *Func, Variable *Dest, Operand *Src) | 669 InstX8632UnaryopGPR(Cfg *Func, Variable *Dest, Operand *Src) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 684 InstX8632UnaryopXmm() = delete; | 684 InstX8632UnaryopXmm() = delete; |
| 685 InstX8632UnaryopXmm(const InstX8632UnaryopXmm &) = delete; | 685 InstX8632UnaryopXmm(const InstX8632UnaryopXmm &) = delete; |
| 686 InstX8632UnaryopXmm &operator=(const InstX8632UnaryopXmm &) = delete; | 686 InstX8632UnaryopXmm &operator=(const InstX8632UnaryopXmm &) = delete; |
| 687 | 687 |
| 688 public: | 688 public: |
| 689 static InstX8632UnaryopXmm *create(Cfg *Func, Variable *Dest, Operand *Src) { | 689 static InstX8632UnaryopXmm *create(Cfg *Func, Variable *Dest, Operand *Src) { |
| 690 return new (Func->allocate<InstX8632UnaryopXmm>()) | 690 return new (Func->allocate<InstX8632UnaryopXmm>()) |
| 691 InstX8632UnaryopXmm(Func, Dest, Src); | 691 InstX8632UnaryopXmm(Func, Dest, Src); |
| 692 } | 692 } |
| 693 void emit(const Cfg *Func) const override { | 693 void emit(const Cfg *Func) const override { |
| 694 if (!ALLOW_DUMP) | 694 if (!BuildDefs::dump()) |
| 695 return; | 695 return; |
| 696 Ostream &Str = Func->getContext()->getStrEmit(); | 696 Ostream &Str = Func->getContext()->getStrEmit(); |
| 697 assert(getSrcSize() == 1); | 697 assert(getSrcSize() == 1); |
| 698 Str << "\t" << Opcode << "\t"; | 698 Str << "\t" << Opcode << "\t"; |
| 699 getSrc(0)->emit(Func); | 699 getSrc(0)->emit(Func); |
| 700 Str << ", "; | 700 Str << ", "; |
| 701 getDest()->emit(Func); | 701 getDest()->emit(Func); |
| 702 } | 702 } |
| 703 void emitIAS(const Cfg *Func) const override { | 703 void emitIAS(const Cfg *Func) const override { |
| 704 Type Ty = getDest()->getType(); | 704 Type Ty = getDest()->getType(); |
| 705 assert(getSrcSize() == 1); | 705 assert(getSrcSize() == 1); |
| 706 emitIASRegOpTyXMM(Func, Ty, getDest(), getSrc(0), Emitter); | 706 emitIASRegOpTyXMM(Func, Ty, getDest(), getSrc(0), Emitter); |
| 707 } | 707 } |
| 708 void dump(const Cfg *Func) const override { | 708 void dump(const Cfg *Func) const override { |
| 709 if (!ALLOW_DUMP) | 709 if (!BuildDefs::dump()) |
| 710 return; | 710 return; |
| 711 Ostream &Str = Func->getContext()->getStrDump(); | 711 Ostream &Str = Func->getContext()->getStrDump(); |
| 712 dumpDest(Func); | 712 dumpDest(Func); |
| 713 Str << " = " << Opcode << "." << getDest()->getType() << " "; | 713 Str << " = " << Opcode << "." << getDest()->getType() << " "; |
| 714 dumpSources(Func); | 714 dumpSources(Func); |
| 715 } | 715 } |
| 716 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | 716 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
| 717 | 717 |
| 718 private: | 718 private: |
| 719 InstX8632UnaryopXmm(Cfg *Func, Variable *Dest, Operand *Src) | 719 InstX8632UnaryopXmm(Cfg *Func, Variable *Dest, Operand *Src) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 732 InstX8632BinopGPRShift &operator=(const InstX8632BinopGPRShift &) = delete; | 732 InstX8632BinopGPRShift &operator=(const InstX8632BinopGPRShift &) = delete; |
| 733 | 733 |
| 734 public: | 734 public: |
| 735 // Create a binary-op GPR shift instruction. | 735 // Create a binary-op GPR shift instruction. |
| 736 static InstX8632BinopGPRShift *create(Cfg *Func, Variable *Dest, | 736 static InstX8632BinopGPRShift *create(Cfg *Func, Variable *Dest, |
| 737 Operand *Source) { | 737 Operand *Source) { |
| 738 return new (Func->allocate<InstX8632BinopGPRShift>()) | 738 return new (Func->allocate<InstX8632BinopGPRShift>()) |
| 739 InstX8632BinopGPRShift(Func, Dest, Source); | 739 InstX8632BinopGPRShift(Func, Dest, Source); |
| 740 } | 740 } |
| 741 void emit(const Cfg *Func) const override { | 741 void emit(const Cfg *Func) const override { |
| 742 if (!ALLOW_DUMP) | 742 if (!BuildDefs::dump()) |
| 743 return; | 743 return; |
| 744 const bool ShiftHack = true; | 744 const bool ShiftHack = true; |
| 745 emitTwoAddress(Opcode, this, Func, ShiftHack); | 745 emitTwoAddress(Opcode, this, Func, ShiftHack); |
| 746 } | 746 } |
| 747 void emitIAS(const Cfg *Func) const override { | 747 void emitIAS(const Cfg *Func) const override { |
| 748 Type Ty = getDest()->getType(); | 748 Type Ty = getDest()->getType(); |
| 749 assert(getSrcSize() == 2); | 749 assert(getSrcSize() == 2); |
| 750 emitIASGPRShift(Func, Ty, getDest(), getSrc(1), Emitter); | 750 emitIASGPRShift(Func, Ty, getDest(), getSrc(1), Emitter); |
| 751 } | 751 } |
| 752 void dump(const Cfg *Func) const override { | 752 void dump(const Cfg *Func) const override { |
| 753 if (!ALLOW_DUMP) | 753 if (!BuildDefs::dump()) |
| 754 return; | 754 return; |
| 755 Ostream &Str = Func->getContext()->getStrDump(); | 755 Ostream &Str = Func->getContext()->getStrDump(); |
| 756 dumpDest(Func); | 756 dumpDest(Func); |
| 757 Str << " = " << Opcode << "." << getDest()->getType() << " "; | 757 Str << " = " << Opcode << "." << getDest()->getType() << " "; |
| 758 dumpSources(Func); | 758 dumpSources(Func); |
| 759 } | 759 } |
| 760 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | 760 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
| 761 | 761 |
| 762 private: | 762 private: |
| 763 InstX8632BinopGPRShift(Cfg *Func, Variable *Dest, Operand *Source) | 763 InstX8632BinopGPRShift(Cfg *Func, Variable *Dest, Operand *Source) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 776 InstX8632BinopGPR(const InstX8632BinopGPR &) = delete; | 776 InstX8632BinopGPR(const InstX8632BinopGPR &) = delete; |
| 777 InstX8632BinopGPR &operator=(const InstX8632BinopGPR &) = delete; | 777 InstX8632BinopGPR &operator=(const InstX8632BinopGPR &) = delete; |
| 778 | 778 |
| 779 public: | 779 public: |
| 780 // Create an ordinary binary-op instruction like add or sub. | 780 // Create an ordinary binary-op instruction like add or sub. |
| 781 static InstX8632BinopGPR *create(Cfg *Func, Variable *Dest, Operand *Source) { | 781 static InstX8632BinopGPR *create(Cfg *Func, Variable *Dest, Operand *Source) { |
| 782 return new (Func->allocate<InstX8632BinopGPR>()) | 782 return new (Func->allocate<InstX8632BinopGPR>()) |
| 783 InstX8632BinopGPR(Func, Dest, Source); | 783 InstX8632BinopGPR(Func, Dest, Source); |
| 784 } | 784 } |
| 785 void emit(const Cfg *Func) const override { | 785 void emit(const Cfg *Func) const override { |
| 786 if (!ALLOW_DUMP) | 786 if (!BuildDefs::dump()) |
| 787 return; | 787 return; |
| 788 const bool ShiftHack = false; | 788 const bool ShiftHack = false; |
| 789 emitTwoAddress(Opcode, this, Func, ShiftHack); | 789 emitTwoAddress(Opcode, this, Func, ShiftHack); |
| 790 } | 790 } |
| 791 void emitIAS(const Cfg *Func) const override { | 791 void emitIAS(const Cfg *Func) const override { |
| 792 Type Ty = getDest()->getType(); | 792 Type Ty = getDest()->getType(); |
| 793 assert(getSrcSize() == 2); | 793 assert(getSrcSize() == 2); |
| 794 emitIASRegOpTyGPR(Func, Ty, getDest(), getSrc(1), Emitter); | 794 emitIASRegOpTyGPR(Func, Ty, getDest(), getSrc(1), Emitter); |
| 795 } | 795 } |
| 796 void dump(const Cfg *Func) const override { | 796 void dump(const Cfg *Func) const override { |
| 797 if (!ALLOW_DUMP) | 797 if (!BuildDefs::dump()) |
| 798 return; | 798 return; |
| 799 Ostream &Str = Func->getContext()->getStrDump(); | 799 Ostream &Str = Func->getContext()->getStrDump(); |
| 800 dumpDest(Func); | 800 dumpDest(Func); |
| 801 Str << " = " << Opcode << "." << getDest()->getType() << " "; | 801 Str << " = " << Opcode << "." << getDest()->getType() << " "; |
| 802 dumpSources(Func); | 802 dumpSources(Func); |
| 803 } | 803 } |
| 804 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | 804 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
| 805 | 805 |
| 806 private: | 806 private: |
| 807 InstX8632BinopGPR(Cfg *Func, Variable *Dest, Operand *Source) | 807 InstX8632BinopGPR(Cfg *Func, Variable *Dest, Operand *Source) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 821 InstX8632BinopRMW &operator=(const InstX8632BinopRMW &) = delete; | 821 InstX8632BinopRMW &operator=(const InstX8632BinopRMW &) = delete; |
| 822 | 822 |
| 823 public: | 823 public: |
| 824 // Create an ordinary binary-op instruction like add or sub. | 824 // Create an ordinary binary-op instruction like add or sub. |
| 825 static InstX8632BinopRMW *create(Cfg *Func, OperandX8632Mem *DestSrc0, | 825 static InstX8632BinopRMW *create(Cfg *Func, OperandX8632Mem *DestSrc0, |
| 826 Operand *Src1) { | 826 Operand *Src1) { |
| 827 return new (Func->allocate<InstX8632BinopRMW>()) | 827 return new (Func->allocate<InstX8632BinopRMW>()) |
| 828 InstX8632BinopRMW(Func, DestSrc0, Src1); | 828 InstX8632BinopRMW(Func, DestSrc0, Src1); |
| 829 } | 829 } |
| 830 void emit(const Cfg *Func) const override { | 830 void emit(const Cfg *Func) const override { |
| 831 if (!ALLOW_DUMP) | 831 if (!BuildDefs::dump()) |
| 832 return; | 832 return; |
| 833 const bool ShiftHack = false; | 833 const bool ShiftHack = false; |
| 834 emitTwoAddress(Opcode, this, Func, ShiftHack); | 834 emitTwoAddress(Opcode, this, Func, ShiftHack); |
| 835 } | 835 } |
| 836 void emitIAS(const Cfg *Func) const override { | 836 void emitIAS(const Cfg *Func) const override { |
| 837 Type Ty = getSrc(0)->getType(); | 837 Type Ty = getSrc(0)->getType(); |
| 838 assert(getSrcSize() == 2); | 838 assert(getSrcSize() == 2); |
| 839 emitIASAsAddrOpTyGPR(Func, Ty, getSrc(0), getSrc(1), Emitter); | 839 emitIASAsAddrOpTyGPR(Func, Ty, getSrc(0), getSrc(1), Emitter); |
| 840 } | 840 } |
| 841 void dump(const Cfg *Func) const override { | 841 void dump(const Cfg *Func) const override { |
| 842 if (!ALLOW_DUMP) | 842 if (!BuildDefs::dump()) |
| 843 return; | 843 return; |
| 844 Ostream &Str = Func->getContext()->getStrDump(); | 844 Ostream &Str = Func->getContext()->getStrDump(); |
| 845 Str << Opcode << "." << getSrc(0)->getType() << " "; | 845 Str << Opcode << "." << getSrc(0)->getType() << " "; |
| 846 dumpSources(Func); | 846 dumpSources(Func); |
| 847 } | 847 } |
| 848 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | 848 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
| 849 | 849 |
| 850 private: | 850 private: |
| 851 InstX8632BinopRMW(Cfg *Func, OperandX8632Mem *DestSrc0, Operand *Src1) | 851 InstX8632BinopRMW(Cfg *Func, OperandX8632Mem *DestSrc0, Operand *Src1) |
| 852 : InstX8632(Func, K, 2, nullptr) { | 852 : InstX8632(Func, K, 2, nullptr) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 863 InstX8632BinopXmm(const InstX8632BinopXmm &) = delete; | 863 InstX8632BinopXmm(const InstX8632BinopXmm &) = delete; |
| 864 InstX8632BinopXmm &operator=(const InstX8632BinopXmm &) = delete; | 864 InstX8632BinopXmm &operator=(const InstX8632BinopXmm &) = delete; |
| 865 | 865 |
| 866 public: | 866 public: |
| 867 // Create an XMM binary-op instruction like addss or addps. | 867 // Create an XMM binary-op instruction like addss or addps. |
| 868 static InstX8632BinopXmm *create(Cfg *Func, Variable *Dest, Operand *Source) { | 868 static InstX8632BinopXmm *create(Cfg *Func, Variable *Dest, Operand *Source) { |
| 869 return new (Func->allocate<InstX8632BinopXmm>()) | 869 return new (Func->allocate<InstX8632BinopXmm>()) |
| 870 InstX8632BinopXmm(Func, Dest, Source); | 870 InstX8632BinopXmm(Func, Dest, Source); |
| 871 } | 871 } |
| 872 void emit(const Cfg *Func) const override { | 872 void emit(const Cfg *Func) const override { |
| 873 if (!ALLOW_DUMP) | 873 if (!BuildDefs::dump()) |
| 874 return; | 874 return; |
| 875 validateVectorAddrMode(); | 875 validateVectorAddrMode(); |
| 876 const bool ShiftHack = false; | 876 const bool ShiftHack = false; |
| 877 emitTwoAddress(Opcode, this, Func, ShiftHack); | 877 emitTwoAddress(Opcode, this, Func, ShiftHack); |
| 878 } | 878 } |
| 879 void emitIAS(const Cfg *Func) const override { | 879 void emitIAS(const Cfg *Func) const override { |
| 880 validateVectorAddrMode(); | 880 validateVectorAddrMode(); |
| 881 Type Ty = getDest()->getType(); | 881 Type Ty = getDest()->getType(); |
| 882 if (NeedsElementType) | 882 if (NeedsElementType) |
| 883 Ty = typeElementType(Ty); | 883 Ty = typeElementType(Ty); |
| 884 assert(getSrcSize() == 2); | 884 assert(getSrcSize() == 2); |
| 885 emitIASRegOpTyXMM(Func, Ty, getDest(), getSrc(1), Emitter); | 885 emitIASRegOpTyXMM(Func, Ty, getDest(), getSrc(1), Emitter); |
| 886 } | 886 } |
| 887 void dump(const Cfg *Func) const override { | 887 void dump(const Cfg *Func) const override { |
| 888 if (!ALLOW_DUMP) | 888 if (!BuildDefs::dump()) |
| 889 return; | 889 return; |
| 890 Ostream &Str = Func->getContext()->getStrDump(); | 890 Ostream &Str = Func->getContext()->getStrDump(); |
| 891 dumpDest(Func); | 891 dumpDest(Func); |
| 892 Str << " = " << Opcode << "." << getDest()->getType() << " "; | 892 Str << " = " << Opcode << "." << getDest()->getType() << " "; |
| 893 dumpSources(Func); | 893 dumpSources(Func); |
| 894 } | 894 } |
| 895 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | 895 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
| 896 | 896 |
| 897 private: | 897 private: |
| 898 InstX8632BinopXmm(Cfg *Func, Variable *Dest, Operand *Source) | 898 InstX8632BinopXmm(Cfg *Func, Variable *Dest, Operand *Source) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 916 InstX8632BinopXmmShift &operator=(const InstX8632BinopXmmShift &) = delete; | 916 InstX8632BinopXmmShift &operator=(const InstX8632BinopXmmShift &) = delete; |
| 917 | 917 |
| 918 public: | 918 public: |
| 919 // Create an XMM binary-op shift operation. | 919 // Create an XMM binary-op shift operation. |
| 920 static InstX8632BinopXmmShift *create(Cfg *Func, Variable *Dest, | 920 static InstX8632BinopXmmShift *create(Cfg *Func, Variable *Dest, |
| 921 Operand *Source) { | 921 Operand *Source) { |
| 922 return new (Func->allocate<InstX8632BinopXmmShift>()) | 922 return new (Func->allocate<InstX8632BinopXmmShift>()) |
| 923 InstX8632BinopXmmShift(Func, Dest, Source); | 923 InstX8632BinopXmmShift(Func, Dest, Source); |
| 924 } | 924 } |
| 925 void emit(const Cfg *Func) const override { | 925 void emit(const Cfg *Func) const override { |
| 926 if (!ALLOW_DUMP) | 926 if (!BuildDefs::dump()) |
| 927 return; | 927 return; |
| 928 validateVectorAddrMode(); | 928 validateVectorAddrMode(); |
| 929 const bool ShiftHack = false; | 929 const bool ShiftHack = false; |
| 930 emitTwoAddress(Opcode, this, Func, ShiftHack); | 930 emitTwoAddress(Opcode, this, Func, ShiftHack); |
| 931 } | 931 } |
| 932 void emitIAS(const Cfg *Func) const override { | 932 void emitIAS(const Cfg *Func) const override { |
| 933 validateVectorAddrMode(); | 933 validateVectorAddrMode(); |
| 934 Type Ty = getDest()->getType(); | 934 Type Ty = getDest()->getType(); |
| 935 assert(AllowAllTypes || isVectorType(Ty)); | 935 assert(AllowAllTypes || isVectorType(Ty)); |
| 936 Type ElementTy = typeElementType(Ty); | 936 Type ElementTy = typeElementType(Ty); |
| 937 assert(getSrcSize() == 2); | 937 assert(getSrcSize() == 2); |
| 938 emitIASXmmShift(Func, ElementTy, getDest(), getSrc(1), Emitter); | 938 emitIASXmmShift(Func, ElementTy, getDest(), getSrc(1), Emitter); |
| 939 } | 939 } |
| 940 void dump(const Cfg *Func) const override { | 940 void dump(const Cfg *Func) const override { |
| 941 if (!ALLOW_DUMP) | 941 if (!BuildDefs::dump()) |
| 942 return; | 942 return; |
| 943 Ostream &Str = Func->getContext()->getStrDump(); | 943 Ostream &Str = Func->getContext()->getStrDump(); |
| 944 dumpDest(Func); | 944 dumpDest(Func); |
| 945 Str << " = " << Opcode << "." << getDest()->getType() << " "; | 945 Str << " = " << Opcode << "." << getDest()->getType() << " "; |
| 946 dumpSources(Func); | 946 dumpSources(Func); |
| 947 } | 947 } |
| 948 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | 948 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
| 949 | 949 |
| 950 private: | 950 private: |
| 951 InstX8632BinopXmmShift(Cfg *Func, Variable *Dest, Operand *Source) | 951 InstX8632BinopXmmShift(Cfg *Func, Variable *Dest, Operand *Source) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 964 InstX8632Ternop &operator=(const InstX8632Ternop &) = delete; | 964 InstX8632Ternop &operator=(const InstX8632Ternop &) = delete; |
| 965 | 965 |
| 966 public: | 966 public: |
| 967 // Create a ternary-op instruction like div or idiv. | 967 // Create a ternary-op instruction like div or idiv. |
| 968 static InstX8632Ternop *create(Cfg *Func, Variable *Dest, Operand *Source1, | 968 static InstX8632Ternop *create(Cfg *Func, Variable *Dest, Operand *Source1, |
| 969 Operand *Source2) { | 969 Operand *Source2) { |
| 970 return new (Func->allocate<InstX8632Ternop>()) | 970 return new (Func->allocate<InstX8632Ternop>()) |
| 971 InstX8632Ternop(Func, Dest, Source1, Source2); | 971 InstX8632Ternop(Func, Dest, Source1, Source2); |
| 972 } | 972 } |
| 973 void emit(const Cfg *Func) const override { | 973 void emit(const Cfg *Func) const override { |
| 974 if (!ALLOW_DUMP) | 974 if (!BuildDefs::dump()) |
| 975 return; | 975 return; |
| 976 Ostream &Str = Func->getContext()->getStrEmit(); | 976 Ostream &Str = Func->getContext()->getStrEmit(); |
| 977 assert(getSrcSize() == 3); | 977 assert(getSrcSize() == 3); |
| 978 Str << "\t" << Opcode << "\t"; | 978 Str << "\t" << Opcode << "\t"; |
| 979 getSrc(2)->emit(Func); | 979 getSrc(2)->emit(Func); |
| 980 Str << ", "; | 980 Str << ", "; |
| 981 getSrc(1)->emit(Func); | 981 getSrc(1)->emit(Func); |
| 982 Str << ", "; | 982 Str << ", "; |
| 983 getDest()->emit(Func); | 983 getDest()->emit(Func); |
| 984 } | 984 } |
| 985 void emitIAS(const Cfg *Func) const override; | 985 void emitIAS(const Cfg *Func) const override; |
| 986 void dump(const Cfg *Func) const override { | 986 void dump(const Cfg *Func) const override { |
| 987 if (!ALLOW_DUMP) | 987 if (!BuildDefs::dump()) |
| 988 return; | 988 return; |
| 989 Ostream &Str = Func->getContext()->getStrDump(); | 989 Ostream &Str = Func->getContext()->getStrDump(); |
| 990 dumpDest(Func); | 990 dumpDest(Func); |
| 991 Str << " = " << Opcode << "." << getDest()->getType() << " "; | 991 Str << " = " << Opcode << "." << getDest()->getType() << " "; |
| 992 dumpSources(Func); | 992 dumpSources(Func); |
| 993 } | 993 } |
| 994 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | 994 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
| 995 | 995 |
| 996 private: | 996 private: |
| 997 InstX8632Ternop(Cfg *Func, Variable *Dest, Operand *Source1, Operand *Source2) | 997 InstX8632Ternop(Cfg *Func, Variable *Dest, Operand *Source1, Operand *Source2) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1011 InstX8632ThreeAddressop(const InstX8632ThreeAddressop &) = delete; | 1011 InstX8632ThreeAddressop(const InstX8632ThreeAddressop &) = delete; |
| 1012 InstX8632ThreeAddressop &operator=(const InstX8632ThreeAddressop &) = delete; | 1012 InstX8632ThreeAddressop &operator=(const InstX8632ThreeAddressop &) = delete; |
| 1013 | 1013 |
| 1014 public: | 1014 public: |
| 1015 static InstX8632ThreeAddressop *create(Cfg *Func, Variable *Dest, | 1015 static InstX8632ThreeAddressop *create(Cfg *Func, Variable *Dest, |
| 1016 Operand *Source0, Operand *Source1) { | 1016 Operand *Source0, Operand *Source1) { |
| 1017 return new (Func->allocate<InstX8632ThreeAddressop>()) | 1017 return new (Func->allocate<InstX8632ThreeAddressop>()) |
| 1018 InstX8632ThreeAddressop(Func, Dest, Source0, Source1); | 1018 InstX8632ThreeAddressop(Func, Dest, Source0, Source1); |
| 1019 } | 1019 } |
| 1020 void emit(const Cfg *Func) const override { | 1020 void emit(const Cfg *Func) const override { |
| 1021 if (!ALLOW_DUMP) | 1021 if (!BuildDefs::dump()) |
| 1022 return; | 1022 return; |
| 1023 Ostream &Str = Func->getContext()->getStrEmit(); | 1023 Ostream &Str = Func->getContext()->getStrEmit(); |
| 1024 assert(getSrcSize() == 2); | 1024 assert(getSrcSize() == 2); |
| 1025 Str << "\t" << Opcode << "\t"; | 1025 Str << "\t" << Opcode << "\t"; |
| 1026 getSrc(1)->emit(Func); | 1026 getSrc(1)->emit(Func); |
| 1027 Str << ", "; | 1027 Str << ", "; |
| 1028 getSrc(0)->emit(Func); | 1028 getSrc(0)->emit(Func); |
| 1029 Str << ", "; | 1029 Str << ", "; |
| 1030 getDest()->emit(Func); | 1030 getDest()->emit(Func); |
| 1031 } | 1031 } |
| 1032 void emitIAS(const Cfg *Func) const override; | 1032 void emitIAS(const Cfg *Func) const override; |
| 1033 void dump(const Cfg *Func) const override { | 1033 void dump(const Cfg *Func) const override { |
| 1034 if (!ALLOW_DUMP) | 1034 if (!BuildDefs::dump()) |
| 1035 return; | 1035 return; |
| 1036 Ostream &Str = Func->getContext()->getStrDump(); | 1036 Ostream &Str = Func->getContext()->getStrDump(); |
| 1037 dumpDest(Func); | 1037 dumpDest(Func); |
| 1038 Str << " = " << Opcode << "." << getDest()->getType() << " "; | 1038 Str << " = " << Opcode << "." << getDest()->getType() << " "; |
| 1039 dumpSources(Func); | 1039 dumpSources(Func); |
| 1040 } | 1040 } |
| 1041 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | 1041 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
| 1042 | 1042 |
| 1043 private: | 1043 private: |
| 1044 InstX8632ThreeAddressop(Cfg *Func, Variable *Dest, Operand *Source0, | 1044 InstX8632ThreeAddressop(Cfg *Func, Variable *Dest, Operand *Source0, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1063 return new (Func->allocate<InstX8632Movlike>()) | 1063 return new (Func->allocate<InstX8632Movlike>()) |
| 1064 InstX8632Movlike(Func, Dest, Source); | 1064 InstX8632Movlike(Func, Dest, Source); |
| 1065 } | 1065 } |
| 1066 bool isRedundantAssign() const override { | 1066 bool isRedundantAssign() const override { |
| 1067 return checkForRedundantAssign(getDest(), getSrc(0)); | 1067 return checkForRedundantAssign(getDest(), getSrc(0)); |
| 1068 } | 1068 } |
| 1069 bool isSimpleAssign() const override { return true; } | 1069 bool isSimpleAssign() const override { return true; } |
| 1070 void emit(const Cfg *Func) const override; | 1070 void emit(const Cfg *Func) const override; |
| 1071 void emitIAS(const Cfg *Func) const override; | 1071 void emitIAS(const Cfg *Func) const override; |
| 1072 void dump(const Cfg *Func) const override { | 1072 void dump(const Cfg *Func) const override { |
| 1073 if (!ALLOW_DUMP) | 1073 if (!BuildDefs::dump()) |
| 1074 return; | 1074 return; |
| 1075 Ostream &Str = Func->getContext()->getStrDump(); | 1075 Ostream &Str = Func->getContext()->getStrDump(); |
| 1076 Str << Opcode << "." << getDest()->getType() << " "; | 1076 Str << Opcode << "." << getDest()->getType() << " "; |
| 1077 dumpDest(Func); | 1077 dumpDest(Func); |
| 1078 Str << ", "; | 1078 Str << ", "; |
| 1079 dumpSources(Func); | 1079 dumpSources(Func); |
| 1080 } | 1080 } |
| 1081 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | 1081 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
| 1082 | 1082 |
| 1083 private: | 1083 private: |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1777 template <> void InstX8632Pinsr::emitIAS(const Cfg *Func) const; | 1777 template <> void InstX8632Pinsr::emitIAS(const Cfg *Func) const; |
| 1778 template <> void InstX8632Movsx::emitIAS(const Cfg *Func) const; | 1778 template <> void InstX8632Movsx::emitIAS(const Cfg *Func) const; |
| 1779 template <> void InstX8632Movzx::emitIAS(const Cfg *Func) const; | 1779 template <> void InstX8632Movzx::emitIAS(const Cfg *Func) const; |
| 1780 template <> void InstX8632Pmull::emitIAS(const Cfg *Func) const; | 1780 template <> void InstX8632Pmull::emitIAS(const Cfg *Func) const; |
| 1781 template <> void InstX8632Pshufd::emitIAS(const Cfg *Func) const; | 1781 template <> void InstX8632Pshufd::emitIAS(const Cfg *Func) const; |
| 1782 template <> void InstX8632Shufps::emitIAS(const Cfg *Func) const; | 1782 template <> void InstX8632Shufps::emitIAS(const Cfg *Func) const; |
| 1783 | 1783 |
| 1784 } // end of namespace Ice | 1784 } // end of namespace Ice |
| 1785 | 1785 |
| 1786 #endif // SUBZERO_SRC_ICEINSTX8632_H | 1786 #endif // SUBZERO_SRC_ICEINSTX8632_H |
| OLD | NEW |