OLD | NEW |
1 //===- subzero/src/IceInstX8632.h - Low-level x86 instructions --*- C++ -*-===// | 1 //===- subzero/src/IceInstX8632.h - Low-level x86 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 Imul, | 193 Imul, |
194 Insertps, | 194 Insertps, |
195 Label, | 195 Label, |
196 Lea, | 196 Lea, |
197 Load, | 197 Load, |
198 Mfence, | 198 Mfence, |
199 Mov, | 199 Mov, |
200 Movd, | 200 Movd, |
201 Movp, | 201 Movp, |
202 Movq, | 202 Movq, |
203 Movss, | 203 MovssRegs, |
204 Movsx, | 204 Movsx, |
205 Movzx, | 205 Movzx, |
206 Mul, | 206 Mul, |
207 Mulps, | 207 Mulps, |
208 Mulss, | 208 Mulss, |
209 Neg, | 209 Neg, |
210 Nop, | 210 Nop, |
211 Or, | 211 Or, |
212 Padd, | 212 Padd, |
213 Pand, | 213 Pand, |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 : InstX8632(Func, K, 1, Dest) { | 514 : InstX8632(Func, K, 1, Dest) { |
515 addSource(Src); | 515 addSource(Src); |
516 } | 516 } |
517 InstX8632UnaryopGPR(const InstX8632UnaryopGPR &) = delete; | 517 InstX8632UnaryopGPR(const InstX8632UnaryopGPR &) = delete; |
518 InstX8632UnaryopGPR &operator=(const InstX8632UnaryopGPR &) = delete; | 518 InstX8632UnaryopGPR &operator=(const InstX8632UnaryopGPR &) = delete; |
519 ~InstX8632UnaryopGPR() override {} | 519 ~InstX8632UnaryopGPR() override {} |
520 static const char *Opcode; | 520 static const char *Opcode; |
521 static const x86::AssemblerX86::GPREmitterRegOp Emitter; | 521 static const x86::AssemblerX86::GPREmitterRegOp Emitter; |
522 }; | 522 }; |
523 | 523 |
524 void emitIASVarOperandTyXMM(const Cfg *Func, Type Ty, const Variable *Var, | 524 void emitIASRegOpTyXMM(const Cfg *Func, Type Ty, const Variable *Var, |
525 const Operand *Src, | 525 const Operand *Src, |
526 const x86::AssemblerX86::XmmEmitterTwoOps &Emitter); | 526 const x86::AssemblerX86::XmmEmitterRegOp &Emitter); |
527 | 527 |
528 template <InstX8632::InstKindX8632 K> | 528 template <InstX8632::InstKindX8632 K> |
529 class InstX8632UnaryopXmm : public InstX8632 { | 529 class InstX8632UnaryopXmm : public InstX8632 { |
530 public: | 530 public: |
531 static InstX8632UnaryopXmm *create(Cfg *Func, Variable *Dest, Operand *Src) { | 531 static InstX8632UnaryopXmm *create(Cfg *Func, Variable *Dest, Operand *Src) { |
532 return new (Func->allocate<InstX8632UnaryopXmm>()) | 532 return new (Func->allocate<InstX8632UnaryopXmm>()) |
533 InstX8632UnaryopXmm(Func, Dest, Src); | 533 InstX8632UnaryopXmm(Func, Dest, Src); |
534 } | 534 } |
535 void emit(const Cfg *Func) const override { | 535 void emit(const Cfg *Func) const override { |
536 Ostream &Str = Func->getContext()->getStrEmit(); | 536 Ostream &Str = Func->getContext()->getStrEmit(); |
537 assert(getSrcSize() == 1); | 537 assert(getSrcSize() == 1); |
538 Str << "\t" << Opcode << "\t"; | 538 Str << "\t" << Opcode << "\t"; |
539 getDest()->emit(Func); | 539 getDest()->emit(Func); |
540 Str << ", "; | 540 Str << ", "; |
541 getSrc(0)->emit(Func); | 541 getSrc(0)->emit(Func); |
542 Str << "\n"; | 542 Str << "\n"; |
543 } | 543 } |
544 void emitIAS(const Cfg *Func) const override { | 544 void emitIAS(const Cfg *Func) const override { |
545 Type Ty = getDest()->getType(); | 545 Type Ty = getDest()->getType(); |
546 assert(getSrcSize() == 1); | 546 assert(getSrcSize() == 1); |
547 emitIASVarOperandTyXMM(Func, Ty, getDest(), getSrc(0), Emitter); | 547 emitIASRegOpTyXMM(Func, Ty, getDest(), getSrc(0), Emitter); |
548 } | 548 } |
549 void dump(const Cfg *Func) const override { | 549 void dump(const Cfg *Func) const override { |
550 Ostream &Str = Func->getContext()->getStrDump(); | 550 Ostream &Str = Func->getContext()->getStrDump(); |
551 dumpDest(Func); | 551 dumpDest(Func); |
552 Str << " = " << Opcode << "." << getDest()->getType() << " "; | 552 Str << " = " << Opcode << "." << getDest()->getType() << " "; |
553 dumpSources(Func); | 553 dumpSources(Func); |
554 } | 554 } |
555 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | 555 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
556 | 556 |
557 private: | 557 private: |
558 InstX8632UnaryopXmm(Cfg *Func, Variable *Dest, Operand *Src) | 558 InstX8632UnaryopXmm(Cfg *Func, Variable *Dest, Operand *Src) |
559 : InstX8632(Func, K, 1, Dest) { | 559 : InstX8632(Func, K, 1, Dest) { |
560 addSource(Src); | 560 addSource(Src); |
561 } | 561 } |
562 InstX8632UnaryopXmm(const InstX8632UnaryopXmm &) = delete; | 562 InstX8632UnaryopXmm(const InstX8632UnaryopXmm &) = delete; |
563 InstX8632UnaryopXmm &operator=(const InstX8632UnaryopXmm &) = delete; | 563 InstX8632UnaryopXmm &operator=(const InstX8632UnaryopXmm &) = delete; |
564 ~InstX8632UnaryopXmm() override {} | 564 ~InstX8632UnaryopXmm() override {} |
565 static const char *Opcode; | 565 static const char *Opcode; |
566 static const x86::AssemblerX86::XmmEmitterTwoOps Emitter; | 566 static const x86::AssemblerX86::XmmEmitterRegOp Emitter; |
567 }; | 567 }; |
568 | 568 |
569 // See the definition of emitTwoAddress() for a description of | 569 // See the definition of emitTwoAddress() for a description of |
570 // ShiftHack. | 570 // ShiftHack. |
571 void emitTwoAddress(const char *Opcode, const Inst *Inst, const Cfg *Func, | 571 void emitTwoAddress(const char *Opcode, const Inst *Inst, const Cfg *Func, |
572 bool ShiftHack = false); | 572 bool ShiftHack = false); |
573 | 573 |
574 template <InstX8632::InstKindX8632 K> class InstX8632Binop : public InstX8632 { | |
575 public: | |
576 // Create a binary-op instruction (not yet migrated to integrated assembler) | |
577 static InstX8632Binop *create(Cfg *Func, Variable *Dest, Operand *Source) { | |
578 return new (Func->allocate<InstX8632Binop>()) | |
579 InstX8632Binop(Func, Dest, Source); | |
580 } | |
581 void emit(const Cfg *Func) const override { | |
582 const bool ShiftHack = false; | |
583 emitTwoAddress(Opcode, this, Func, ShiftHack); | |
584 } | |
585 void dump(const Cfg *Func) const override { | |
586 Ostream &Str = Func->getContext()->getStrDump(); | |
587 dumpDest(Func); | |
588 Str << " = " << Opcode << "." << getDest()->getType() << " "; | |
589 dumpSources(Func); | |
590 } | |
591 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | |
592 | |
593 private: | |
594 InstX8632Binop(Cfg *Func, Variable *Dest, Operand *Source) | |
595 : InstX8632(Func, K, 2, Dest) { | |
596 addSource(Dest); | |
597 addSource(Source); | |
598 } | |
599 InstX8632Binop(const InstX8632Binop &) = delete; | |
600 InstX8632Binop &operator=(const InstX8632Binop &) = delete; | |
601 ~InstX8632Binop() override {} | |
602 static const char *Opcode; | |
603 }; | |
604 | |
605 void emitIASGPRShift(const Cfg *Func, Type Ty, const Variable *Var, | 574 void emitIASGPRShift(const Cfg *Func, Type Ty, const Variable *Var, |
606 const Operand *Src, | 575 const Operand *Src, |
607 const x86::AssemblerX86::GPREmitterShiftOp &Emitter); | 576 const x86::AssemblerX86::GPREmitterShiftOp &Emitter); |
608 | 577 |
609 template <InstX8632::InstKindX8632 K> | 578 template <InstX8632::InstKindX8632 K> |
610 class InstX8632BinopGPRShift : public InstX8632 { | 579 class InstX8632BinopGPRShift : public InstX8632 { |
611 public: | 580 public: |
612 // Create a binary-op GPR shift instruction. | 581 // Create a binary-op GPR shift instruction. |
613 static InstX8632BinopGPRShift *create(Cfg *Func, Variable *Dest, | 582 static InstX8632BinopGPRShift *create(Cfg *Func, Variable *Dest, |
614 Operand *Source) { | 583 Operand *Source) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 } | 662 } |
694 void emit(const Cfg *Func) const override { | 663 void emit(const Cfg *Func) const override { |
695 const bool ShiftHack = false; | 664 const bool ShiftHack = false; |
696 emitTwoAddress(Opcode, this, Func, ShiftHack); | 665 emitTwoAddress(Opcode, this, Func, ShiftHack); |
697 } | 666 } |
698 void emitIAS(const Cfg *Func) const override { | 667 void emitIAS(const Cfg *Func) const override { |
699 Type Ty = getDest()->getType(); | 668 Type Ty = getDest()->getType(); |
700 if (NeedsElementType) | 669 if (NeedsElementType) |
701 Ty = typeElementType(Ty); | 670 Ty = typeElementType(Ty); |
702 assert(getSrcSize() == 2); | 671 assert(getSrcSize() == 2); |
703 emitIASVarOperandTyXMM(Func, Ty, getDest(), getSrc(1), Emitter); | 672 emitIASRegOpTyXMM(Func, Ty, getDest(), getSrc(1), Emitter); |
704 } | 673 } |
705 void dump(const Cfg *Func) const override { | 674 void dump(const Cfg *Func) const override { |
706 Ostream &Str = Func->getContext()->getStrDump(); | 675 Ostream &Str = Func->getContext()->getStrDump(); |
707 dumpDest(Func); | 676 dumpDest(Func); |
708 Str << " = " << Opcode << "." << getDest()->getType() << " "; | 677 Str << " = " << Opcode << "." << getDest()->getType() << " "; |
709 dumpSources(Func); | 678 dumpSources(Func); |
710 } | 679 } |
711 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | 680 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
712 | 681 |
713 private: | 682 private: |
714 InstX8632BinopXmm(Cfg *Func, Variable *Dest, Operand *Source) | 683 InstX8632BinopXmm(Cfg *Func, Variable *Dest, Operand *Source) |
715 : InstX8632(Func, K, 2, Dest) { | 684 : InstX8632(Func, K, 2, Dest) { |
716 addSource(Dest); | 685 addSource(Dest); |
717 addSource(Source); | 686 addSource(Source); |
718 } | 687 } |
719 InstX8632BinopXmm(const InstX8632BinopXmm &) = delete; | 688 InstX8632BinopXmm(const InstX8632BinopXmm &) = delete; |
720 InstX8632BinopXmm &operator=(const InstX8632BinopXmm &) = delete; | 689 InstX8632BinopXmm &operator=(const InstX8632BinopXmm &) = delete; |
721 ~InstX8632BinopXmm() override {} | 690 ~InstX8632BinopXmm() override {} |
722 static const char *Opcode; | 691 static const char *Opcode; |
723 static const x86::AssemblerX86::XmmEmitterTwoOps Emitter; | 692 static const x86::AssemblerX86::XmmEmitterRegOp Emitter; |
724 }; | 693 }; |
725 | 694 |
726 void emitIASXmmShift(const Cfg *Func, Type Ty, const Variable *Var, | 695 void emitIASXmmShift(const Cfg *Func, Type Ty, const Variable *Var, |
727 const Operand *Src, | 696 const Operand *Src, |
728 const x86::AssemblerX86::XmmEmitterShiftOp &Emitter); | 697 const x86::AssemblerX86::XmmEmitterShiftOp &Emitter); |
729 | 698 |
730 template <InstX8632::InstKindX8632 K> | 699 template <InstX8632::InstKindX8632 K> |
731 class InstX8632BinopXmmShift : public InstX8632 { | 700 class InstX8632BinopXmmShift : public InstX8632 { |
732 public: | 701 public: |
733 // Create an XMM binary-op shift operation. | 702 // Create an XMM binary-op shift operation. |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 public: | 828 public: |
860 static InstX8632Movlike *create(Cfg *Func, Variable *Dest, Operand *Source) { | 829 static InstX8632Movlike *create(Cfg *Func, Variable *Dest, Operand *Source) { |
861 return new (Func->allocate<InstX8632Movlike>()) | 830 return new (Func->allocate<InstX8632Movlike>()) |
862 InstX8632Movlike(Func, Dest, Source); | 831 InstX8632Movlike(Func, Dest, Source); |
863 } | 832 } |
864 bool isRedundantAssign() const override { | 833 bool isRedundantAssign() const override { |
865 return checkForRedundantAssign(getDest(), getSrc(0)); | 834 return checkForRedundantAssign(getDest(), getSrc(0)); |
866 } | 835 } |
867 bool isSimpleAssign() const override { return true; } | 836 bool isSimpleAssign() const override { return true; } |
868 void emit(const Cfg *Func) const override; | 837 void emit(const Cfg *Func) const override; |
| 838 void emitIAS(const Cfg *Func) const override { emit(Func); } |
869 void dump(const Cfg *Func) const override { | 839 void dump(const Cfg *Func) const override { |
870 Ostream &Str = Func->getContext()->getStrDump(); | 840 Ostream &Str = Func->getContext()->getStrDump(); |
871 Str << Opcode << "." << getDest()->getType() << " "; | 841 Str << Opcode << "." << getDest()->getType() << " "; |
872 dumpDest(Func); | 842 dumpDest(Func); |
873 Str << ", "; | 843 Str << ", "; |
874 dumpSources(Func); | 844 dumpSources(Func); |
875 } | 845 } |
876 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } | 846 static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
877 | 847 |
878 private: | 848 private: |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
928 typedef InstX8632BinopXmm<InstX8632::Divps, true> InstX8632Divps; | 898 typedef InstX8632BinopXmm<InstX8632::Divps, true> InstX8632Divps; |
929 typedef InstX8632BinopXmm<InstX8632::Divss, false> InstX8632Divss; | 899 typedef InstX8632BinopXmm<InstX8632::Divss, false> InstX8632Divss; |
930 typedef InstX8632BinopGPRShift<InstX8632::Rol> InstX8632Rol; | 900 typedef InstX8632BinopGPRShift<InstX8632::Rol> InstX8632Rol; |
931 typedef InstX8632BinopGPRShift<InstX8632::Shl> InstX8632Shl; | 901 typedef InstX8632BinopGPRShift<InstX8632::Shl> InstX8632Shl; |
932 typedef InstX8632BinopXmmShift<InstX8632::Psll> InstX8632Psll; | 902 typedef InstX8632BinopXmmShift<InstX8632::Psll> InstX8632Psll; |
933 typedef InstX8632BinopGPRShift<InstX8632::Shr> InstX8632Shr; | 903 typedef InstX8632BinopGPRShift<InstX8632::Shr> InstX8632Shr; |
934 typedef InstX8632BinopGPRShift<InstX8632::Sar> InstX8632Sar; | 904 typedef InstX8632BinopGPRShift<InstX8632::Sar> InstX8632Sar; |
935 typedef InstX8632BinopXmmShift<InstX8632::Psra> InstX8632Psra; | 905 typedef InstX8632BinopXmmShift<InstX8632::Psra> InstX8632Psra; |
936 typedef InstX8632BinopXmm<InstX8632::Pcmpeq, true> InstX8632Pcmpeq; | 906 typedef InstX8632BinopXmm<InstX8632::Pcmpeq, true> InstX8632Pcmpeq; |
937 typedef InstX8632BinopXmm<InstX8632::Pcmpgt, true> InstX8632Pcmpgt; | 907 typedef InstX8632BinopXmm<InstX8632::Pcmpgt, true> InstX8632Pcmpgt; |
938 // TODO: movss is only a binary operation when the source and dest | 908 // movss is only a binary operation when the source and dest |
939 // operands are both registers. In other cases, it behaves like a copy | 909 // operands are both registers (the high bits of dest are left untouched). |
940 // (mov-like) operation. Eventually, InstX8632Movss should assert that | 910 // In other cases, it behaves like a copy (mov-like) operation (and the |
941 // both its source and dest operands are registers, and the lowering | 911 // high bits of dest are cleared). |
942 // code should use _mov instead of _movss in cases where a copy | 912 // InstX8632Movss will assert that both its source and dest operands are |
943 // operation is intended. | 913 // registers, so the lowering code should use _mov instead of _movss |
944 typedef InstX8632Binop<InstX8632::Movss> InstX8632Movss; | 914 // in cases where a copy operation is intended. |
| 915 typedef InstX8632BinopXmm<InstX8632::MovssRegs, false> InstX8632MovssRegs; |
945 typedef InstX8632Ternop<InstX8632::Idiv> InstX8632Idiv; | 916 typedef InstX8632Ternop<InstX8632::Idiv> InstX8632Idiv; |
946 typedef InstX8632Ternop<InstX8632::Div> InstX8632Div; | 917 typedef InstX8632Ternop<InstX8632::Div> InstX8632Div; |
947 typedef InstX8632Ternop<InstX8632::Insertps> InstX8632Insertps; | 918 typedef InstX8632Ternop<InstX8632::Insertps> InstX8632Insertps; |
948 typedef InstX8632Ternop<InstX8632::Pinsr> InstX8632Pinsr; | 919 typedef InstX8632Ternop<InstX8632::Pinsr> InstX8632Pinsr; |
949 typedef InstX8632Ternop<InstX8632::Shufps> InstX8632Shufps; | 920 typedef InstX8632Ternop<InstX8632::Shufps> InstX8632Shufps; |
950 typedef InstX8632Ternop<InstX8632::Blendvps> InstX8632Blendvps; | 921 typedef InstX8632Ternop<InstX8632::Blendvps> InstX8632Blendvps; |
951 typedef InstX8632Ternop<InstX8632::Pblendvb> InstX8632Pblendvb; | 922 typedef InstX8632Ternop<InstX8632::Pblendvb> InstX8632Pblendvb; |
952 typedef InstX8632ThreeAddressop<InstX8632::Pextr> InstX8632Pextr; | 923 typedef InstX8632ThreeAddressop<InstX8632::Pextr> InstX8632Pextr; |
953 typedef InstX8632ThreeAddressop<InstX8632::Pshufd> InstX8632Pshufd; | 924 typedef InstX8632ThreeAddressop<InstX8632::Pshufd> InstX8632Pshufd; |
954 | 925 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 }; | 1127 }; |
1157 | 1128 |
1158 // cmp - Integer compare instruction. | 1129 // cmp - Integer compare instruction. |
1159 class InstX8632Icmp : public InstX8632 { | 1130 class InstX8632Icmp : public InstX8632 { |
1160 public: | 1131 public: |
1161 static InstX8632Icmp *create(Cfg *Func, Operand *Src1, Operand *Src2) { | 1132 static InstX8632Icmp *create(Cfg *Func, Operand *Src1, Operand *Src2) { |
1162 return new (Func->allocate<InstX8632Icmp>()) | 1133 return new (Func->allocate<InstX8632Icmp>()) |
1163 InstX8632Icmp(Func, Src1, Src2); | 1134 InstX8632Icmp(Func, Src1, Src2); |
1164 } | 1135 } |
1165 void emit(const Cfg *Func) const override; | 1136 void emit(const Cfg *Func) const override; |
| 1137 void emitIAS(const Cfg *Func) const override; |
1166 void dump(const Cfg *Func) const override; | 1138 void dump(const Cfg *Func) const override; |
1167 static bool classof(const Inst *Inst) { return isClassof(Inst, Icmp); } | 1139 static bool classof(const Inst *Inst) { return isClassof(Inst, Icmp); } |
1168 | 1140 |
1169 private: | 1141 private: |
1170 InstX8632Icmp(Cfg *Func, Operand *Src1, Operand *Src2); | 1142 InstX8632Icmp(Cfg *Func, Operand *Src1, Operand *Src2); |
1171 InstX8632Icmp(const InstX8632Icmp &) = delete; | 1143 InstX8632Icmp(const InstX8632Icmp &) = delete; |
1172 InstX8632Icmp &operator=(const InstX8632Icmp &) = delete; | 1144 InstX8632Icmp &operator=(const InstX8632Icmp &) = delete; |
1173 ~InstX8632Icmp() override {} | 1145 ~InstX8632Icmp() override {} |
1174 }; | 1146 }; |
1175 | 1147 |
(...skipping 16 matching lines...) Expand all Loading... |
1192 ~InstX8632Ucomiss() override {} | 1164 ~InstX8632Ucomiss() override {} |
1193 }; | 1165 }; |
1194 | 1166 |
1195 // UD2 instruction. | 1167 // UD2 instruction. |
1196 class InstX8632UD2 : public InstX8632 { | 1168 class InstX8632UD2 : public InstX8632 { |
1197 public: | 1169 public: |
1198 static InstX8632UD2 *create(Cfg *Func) { | 1170 static InstX8632UD2 *create(Cfg *Func) { |
1199 return new (Func->allocate<InstX8632UD2>()) InstX8632UD2(Func); | 1171 return new (Func->allocate<InstX8632UD2>()) InstX8632UD2(Func); |
1200 } | 1172 } |
1201 void emit(const Cfg *Func) const override; | 1173 void emit(const Cfg *Func) const override; |
| 1174 void emitIAS(const Cfg *Func) const override; |
1202 void dump(const Cfg *Func) const override; | 1175 void dump(const Cfg *Func) const override; |
1203 static bool classof(const Inst *Inst) { return isClassof(Inst, UD2); } | 1176 static bool classof(const Inst *Inst) { return isClassof(Inst, UD2); } |
1204 | 1177 |
1205 private: | 1178 private: |
1206 InstX8632UD2(Cfg *Func); | 1179 InstX8632UD2(Cfg *Func); |
1207 InstX8632UD2(const InstX8632UD2 &) = delete; | 1180 InstX8632UD2(const InstX8632UD2 &) = delete; |
1208 InstX8632UD2 &operator=(const InstX8632UD2 &) = delete; | 1181 InstX8632UD2 &operator=(const InstX8632UD2 &) = delete; |
1209 ~InstX8632UD2() override {} | 1182 ~InstX8632UD2() override {} |
1210 }; | 1183 }; |
1211 | 1184 |
1212 // Test instruction. | 1185 // Test instruction. |
1213 class InstX8632Test : public InstX8632 { | 1186 class InstX8632Test : public InstX8632 { |
1214 public: | 1187 public: |
1215 static InstX8632Test *create(Cfg *Func, Operand *Source1, Operand *Source2) { | 1188 static InstX8632Test *create(Cfg *Func, Operand *Source1, Operand *Source2) { |
1216 return new (Func->allocate<InstX8632Test>()) | 1189 return new (Func->allocate<InstX8632Test>()) |
1217 InstX8632Test(Func, Source1, Source2); | 1190 InstX8632Test(Func, Source1, Source2); |
1218 } | 1191 } |
1219 void emit(const Cfg *Func) const override; | 1192 void emit(const Cfg *Func) const override; |
| 1193 void emitIAS(const Cfg *Func) const override; |
1220 void dump(const Cfg *Func) const override; | 1194 void dump(const Cfg *Func) const override; |
1221 static bool classof(const Inst *Inst) { return isClassof(Inst, Test); } | 1195 static bool classof(const Inst *Inst) { return isClassof(Inst, Test); } |
1222 | 1196 |
1223 private: | 1197 private: |
1224 InstX8632Test(Cfg *Func, Operand *Source1, Operand *Source2); | 1198 InstX8632Test(Cfg *Func, Operand *Source1, Operand *Source2); |
1225 InstX8632Test(const InstX8632Test &) = delete; | 1199 InstX8632Test(const InstX8632Test &) = delete; |
1226 InstX8632Test &operator=(const InstX8632Test &) = delete; | 1200 InstX8632Test &operator=(const InstX8632Test &) = delete; |
1227 ~InstX8632Test() override {} | 1201 ~InstX8632Test() override {} |
1228 }; | 1202 }; |
1229 | 1203 |
(...skipping 28 matching lines...) Expand all Loading... |
1258 void dump(const Cfg *Func) const override; | 1232 void dump(const Cfg *Func) const override; |
1259 static bool classof(const Inst *Inst) { return isClassof(Inst, Store); } | 1233 static bool classof(const Inst *Inst) { return isClassof(Inst, Store); } |
1260 | 1234 |
1261 private: | 1235 private: |
1262 InstX8632Store(Cfg *Func, Operand *Value, OperandX8632 *Mem); | 1236 InstX8632Store(Cfg *Func, Operand *Value, OperandX8632 *Mem); |
1263 InstX8632Store(const InstX8632Store &) = delete; | 1237 InstX8632Store(const InstX8632Store &) = delete; |
1264 InstX8632Store &operator=(const InstX8632Store &) = delete; | 1238 InstX8632Store &operator=(const InstX8632Store &) = delete; |
1265 ~InstX8632Store() override {} | 1239 ~InstX8632Store() override {} |
1266 }; | 1240 }; |
1267 | 1241 |
| 1242 // This is essentially a vector "mov" instruction with an OperandX8632Mem |
| 1243 // operand instead of Variable as the destination. It's important |
| 1244 // for liveness that there is no Dest operand. The source must be an |
| 1245 // Xmm register, since Dest is mem. |
1268 class InstX8632StoreP : public InstX8632 { | 1246 class InstX8632StoreP : public InstX8632 { |
1269 public: | 1247 public: |
1270 static InstX8632StoreP *create(Cfg *Func, Operand *Value, OperandX8632 *Mem) { | 1248 static InstX8632StoreP *create(Cfg *Func, Variable *Value, |
| 1249 OperandX8632Mem *Mem) { |
1271 return new (Func->allocate<InstX8632StoreP>()) | 1250 return new (Func->allocate<InstX8632StoreP>()) |
1272 InstX8632StoreP(Func, Value, Mem); | 1251 InstX8632StoreP(Func, Value, Mem); |
1273 } | 1252 } |
1274 void emit(const Cfg *Func) const override; | 1253 void emit(const Cfg *Func) const override; |
| 1254 void emitIAS(const Cfg *Func) const override; |
1275 void dump(const Cfg *Func) const override; | 1255 void dump(const Cfg *Func) const override; |
1276 static bool classof(const Inst *Inst) { return isClassof(Inst, StoreP); } | 1256 static bool classof(const Inst *Inst) { return isClassof(Inst, StoreP); } |
1277 | 1257 |
1278 private: | 1258 private: |
1279 InstX8632StoreP(Cfg *Func, Operand *Value, OperandX8632 *Mem); | 1259 InstX8632StoreP(Cfg *Func, Variable *Value, OperandX8632Mem *Mem); |
1280 InstX8632StoreP(const InstX8632StoreP &) = delete; | 1260 InstX8632StoreP(const InstX8632StoreP &) = delete; |
1281 InstX8632StoreP &operator=(const InstX8632StoreP &) = delete; | 1261 InstX8632StoreP &operator=(const InstX8632StoreP &) = delete; |
1282 ~InstX8632StoreP() override {} | 1262 ~InstX8632StoreP() override {} |
1283 }; | 1263 }; |
1284 | 1264 |
1285 // This is essentially a "movq" instruction with an OperandX8632Mem | |
1286 // operand instead of Variable as the destination. It's important | |
1287 // for liveness that there is no Dest operand. | |
1288 class InstX8632StoreQ : public InstX8632 { | 1265 class InstX8632StoreQ : public InstX8632 { |
1289 public: | 1266 public: |
1290 static InstX8632StoreQ *create(Cfg *Func, Operand *Value, OperandX8632 *Mem) { | 1267 static InstX8632StoreQ *create(Cfg *Func, Variable *Value, |
| 1268 OperandX8632Mem *Mem) { |
1291 return new (Func->allocate<InstX8632StoreQ>()) | 1269 return new (Func->allocate<InstX8632StoreQ>()) |
1292 InstX8632StoreQ(Func, Value, Mem); | 1270 InstX8632StoreQ(Func, Value, Mem); |
1293 } | 1271 } |
1294 void emit(const Cfg *Func) const override; | 1272 void emit(const Cfg *Func) const override; |
| 1273 void emitIAS(const Cfg *Func) const override; |
1295 void dump(const Cfg *Func) const override; | 1274 void dump(const Cfg *Func) const override; |
1296 static bool classof(const Inst *Inst) { return isClassof(Inst, StoreQ); } | 1275 static bool classof(const Inst *Inst) { return isClassof(Inst, StoreQ); } |
1297 | 1276 |
1298 private: | 1277 private: |
1299 InstX8632StoreQ(Cfg *Func, Operand *Value, OperandX8632 *Mem); | 1278 InstX8632StoreQ(Cfg *Func, Variable *Value, OperandX8632Mem *Mem); |
1300 InstX8632StoreQ(const InstX8632StoreQ &) = delete; | 1279 InstX8632StoreQ(const InstX8632StoreQ &) = delete; |
1301 InstX8632StoreQ &operator=(const InstX8632StoreQ &) = delete; | 1280 InstX8632StoreQ &operator=(const InstX8632StoreQ &) = delete; |
1302 ~InstX8632StoreQ() override {} | 1281 ~InstX8632StoreQ() override {} |
1303 }; | 1282 }; |
1304 | 1283 |
1305 // Movsx - copy from a narrower integer type to a wider integer | 1284 // Movsx - copy from a narrower integer type to a wider integer |
1306 // type, with sign extension. | 1285 // type, with sign extension. |
1307 class InstX8632Movsx : public InstX8632 { | 1286 class InstX8632Movsx : public InstX8632 { |
1308 public: | 1287 public: |
1309 static InstX8632Movsx *create(Cfg *Func, Variable *Dest, Operand *Source) { | 1288 static InstX8632Movsx *create(Cfg *Func, Variable *Dest, Operand *Source) { |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1528 template <> void InstX8632Psra::emit(const Cfg *Func) const; | 1507 template <> void InstX8632Psra::emit(const Cfg *Func) const; |
1529 template <> void InstX8632Psub::emit(const Cfg *Func) const; | 1508 template <> void InstX8632Psub::emit(const Cfg *Func) const; |
1530 template <> void InstX8632Sqrtss::emit(const Cfg *Func) const; | 1509 template <> void InstX8632Sqrtss::emit(const Cfg *Func) const; |
1531 template <> void InstX8632Subss::emit(const Cfg *Func) const; | 1510 template <> void InstX8632Subss::emit(const Cfg *Func) const; |
1532 | 1511 |
1533 template <> void InstX8632Div::emitIAS(const Cfg *Func) const; | 1512 template <> void InstX8632Div::emitIAS(const Cfg *Func) const; |
1534 template <> void InstX8632Idiv::emitIAS(const Cfg *Func) const; | 1513 template <> void InstX8632Idiv::emitIAS(const Cfg *Func) const; |
1535 template <> void InstX8632Imul::emitIAS(const Cfg *Func) const; | 1514 template <> void InstX8632Imul::emitIAS(const Cfg *Func) const; |
1536 template <> void InstX8632Cbwdq::emitIAS(const Cfg *Func) const; | 1515 template <> void InstX8632Cbwdq::emitIAS(const Cfg *Func) const; |
1537 template <> void InstX8632Movd::emitIAS(const Cfg *Func) const; | 1516 template <> void InstX8632Movd::emitIAS(const Cfg *Func) const; |
| 1517 template <> void InstX8632Movp::emitIAS(const Cfg *Func) const; |
| 1518 template <> void InstX8632Movq::emitIAS(const Cfg *Func) const; |
| 1519 template <> void InstX8632MovssRegs::emitIAS(const Cfg *Func) const; |
1538 template <> void InstX8632Pmull::emitIAS(const Cfg *Func) const; | 1520 template <> void InstX8632Pmull::emitIAS(const Cfg *Func) const; |
1539 | 1521 |
1540 } // end of namespace Ice | 1522 } // end of namespace Ice |
1541 | 1523 |
1542 #endif // SUBZERO_SRC_ICEINSTX8632_H | 1524 #endif // SUBZERO_SRC_ICEINSTX8632_H |
OLD | NEW |