OLD | NEW |
1 //===- subzero/src/IceInstMips32.cpp - Mips32 instruction implementation --===// | 1 //===- subzero/src/IceInstMips32.cpp - Mips32 instruction implementation --===// |
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 /// \file | 10 /// \file |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 if (auto *CR = llvm::dyn_cast<ConstantRelocatable>(Src0)) { | 159 if (auto *CR = llvm::dyn_cast<ConstantRelocatable>(Src0)) { |
160 emitRelocOp(Str, Reloc); | 160 emitRelocOp(Str, Reloc); |
161 Str << "("; | 161 Str << "("; |
162 CR->emitWithoutPrefix(Func->getTarget()); | 162 CR->emitWithoutPrefix(Func->getTarget()); |
163 Str << ")"; | 163 Str << ")"; |
164 } else { | 164 } else { |
165 Src0->emit(Func); | 165 Src0->emit(Func); |
166 } | 166 } |
167 } | 167 } |
168 | 168 |
169 template <> void InstMIPS32Mflo::emit(const Cfg *Func) const { | |
170 if (!BuildDefs::dump()) | |
171 return; | |
172 emitUnaryopGPRFLoHi(Opcode, this, Func); | |
173 } | |
174 | |
175 template <> void InstMIPS32Mfhi::emit(const Cfg *Func) const { | |
176 if (!BuildDefs::dump()) | |
177 return; | |
178 emitUnaryopGPRFLoHi(Opcode, this, Func); | |
179 } | |
180 | |
181 template <> void InstMIPS32Mtlo::emit(const Cfg *Func) const { | |
182 if (!BuildDefs::dump()) | |
183 return; | |
184 emitUnaryopGPRTLoHi(Opcode, this, Func); | |
185 } | |
186 | |
187 template <> void InstMIPS32Mthi::emit(const Cfg *Func) const { | |
188 if (!BuildDefs::dump()) | |
189 return; | |
190 emitUnaryopGPRTLoHi(Opcode, this, Func); | |
191 } | |
192 | |
193 template <> void InstMIPS32Mult::emit(const Cfg *Func) const { | |
194 if (!BuildDefs::dump()) | |
195 return; | |
196 emitThreeAddrLoHi(Opcode, this, Func); | |
197 } | |
198 | |
199 template <> void InstMIPS32Multu::emit(const Cfg *Func) const { | |
200 if (!BuildDefs::dump()) | |
201 return; | |
202 emitThreeAddrLoHi(Opcode, this, Func); | |
203 } | |
204 | |
205 InstMIPS32Br::InstMIPS32Br(Cfg *Func, const CfgNode *TargetTrue, | 169 InstMIPS32Br::InstMIPS32Br(Cfg *Func, const CfgNode *TargetTrue, |
206 const CfgNode *TargetFalse, | 170 const CfgNode *TargetFalse, |
207 const InstMIPS32Label *Label, CondMIPS32::Cond Cond) | 171 const InstMIPS32Label *Label, CondMIPS32::Cond Cond) |
208 : InstMIPS32(Func, InstMIPS32::Br, 0, nullptr), TargetTrue(TargetTrue), | 172 : InstMIPS32(Func, InstMIPS32::Br, 0, nullptr), TargetTrue(TargetTrue), |
209 TargetFalse(TargetFalse), Label(Label), Predicate(Cond) {} | 173 TargetFalse(TargetFalse), Label(Label), Predicate(Cond) {} |
210 | 174 |
211 InstMIPS32Br::InstMIPS32Br(Cfg *Func, const CfgNode *TargetTrue, | 175 InstMIPS32Br::InstMIPS32Br(Cfg *Func, const CfgNode *TargetTrue, |
212 const CfgNode *TargetFalse, Operand *Src0, | 176 const CfgNode *TargetFalse, Operand *Src0, |
213 const InstMIPS32Label *Label, CondMIPS32::Cond Cond) | 177 const InstMIPS32Label *Label, CondMIPS32::Cond Cond) |
214 : InstMIPS32(Func, InstMIPS32::Br, 1, nullptr), TargetTrue(TargetTrue), | 178 : InstMIPS32(Func, InstMIPS32::Br, 1, nullptr), TargetTrue(TargetTrue), |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 | 605 |
642 Variable *Dest = getDest(); | 606 Variable *Dest = getDest(); |
643 Operand *Src = getSrc(0); | 607 Operand *Src = getSrc(0); |
644 auto *SrcV = llvm::dyn_cast<Variable>(Src); | 608 auto *SrcV = llvm::dyn_cast<Variable>(Src); |
645 assert(!llvm::isa<Constant>(Src)); | 609 assert(!llvm::isa<Constant>(Src)); |
646 const bool DestIsReg = Dest->hasReg(); | 610 const bool DestIsReg = Dest->hasReg(); |
647 const bool SrcIsReg = (SrcV && SrcV->hasReg()); | 611 const bool SrcIsReg = (SrcV && SrcV->hasReg()); |
648 | 612 |
649 // reg to reg | 613 // reg to reg |
650 if (DestIsReg && SrcIsReg) { | 614 if (DestIsReg && SrcIsReg) { |
651 switch (Dest->getType()) { | 615 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
652 default: | 616 Asm->move(getDest(), getSrc(0)); |
653 break; | 617 return; |
654 case IceType_i1: | |
655 case IceType_i8: | |
656 case IceType_i16: | |
657 case IceType_i32: | |
658 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | |
659 Asm->move(getDest(), getSrc(0)); | |
660 return; | |
661 } | |
662 } | 618 } |
663 llvm_unreachable("Not yet implemented"); | 619 llvm_unreachable("Not yet implemented"); |
664 } | 620 } |
665 | 621 |
666 void InstMIPS32Mov::dump(const Cfg *Func) const { | 622 void InstMIPS32Mov::dump(const Cfg *Func) const { |
667 if (!BuildDefs::dump()) | 623 if (!BuildDefs::dump()) |
668 return; | 624 return; |
669 assert(getSrcSize() == 1 || getSrcSize() == 2); | 625 assert(getSrcSize() == 1 || getSrcSize() == 2); |
670 Ostream &Str = Func->getContext()->getStrDump(); | 626 Ostream &Str = Func->getContext()->getStrDump(); |
671 Variable *Dest = getDest(); | 627 Variable *Dest = getDest(); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 Str << "\t" << ActualOpcode << "\t"; | 735 Str << "\t" << ActualOpcode << "\t"; |
780 getDest()->emit(Func); | 736 getDest()->emit(Func); |
781 Str << ", "; | 737 Str << ", "; |
782 getSrc(0)->emit(Func); | 738 getSrc(0)->emit(Func); |
783 return; | 739 return; |
784 } | 740 } |
785 | 741 |
786 llvm::report_fatal_error("Invalid mov instruction. Dest or Src is memory."); | 742 llvm::report_fatal_error("Invalid mov instruction. Dest or Src is memory."); |
787 } | 743 } |
788 | 744 |
| 745 template <> void InstMIPS32Abs_d::emitIAS(const Cfg *Func) const { |
| 746 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 747 Asm->abs_d(getDest(), getSrc(0)); |
| 748 } |
| 749 |
| 750 template <> void InstMIPS32Abs_s::emitIAS(const Cfg *Func) const { |
| 751 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 752 Asm->abs_s(getDest(), getSrc(0)); |
| 753 } |
| 754 |
| 755 template <> void InstMIPS32Add_d::emitIAS(const Cfg *Func) const { |
| 756 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 757 Asm->add_d(getDest(), getSrc(0), getSrc(1)); |
| 758 } |
| 759 |
| 760 template <> void InstMIPS32Add_s::emitIAS(const Cfg *Func) const { |
| 761 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 762 Asm->add_s(getDest(), getSrc(0), getSrc(1)); |
| 763 } |
| 764 |
789 template <> void InstMIPS32Addiu::emitIAS(const Cfg *Func) const { | 765 template <> void InstMIPS32Addiu::emitIAS(const Cfg *Func) const { |
790 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 766 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
791 Asm->addiu(getDest(), getSrc(0), Imm); | 767 Asm->addiu(getDest(), getSrc(0), Imm); |
792 } | 768 } |
793 | 769 |
794 template <> void InstMIPS32Slti::emitIAS(const Cfg *Func) const { | 770 template <> void InstMIPS32Addu::emitIAS(const Cfg *Func) const { |
795 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 771 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
796 Asm->slti(getDest(), getSrc(0), Imm); | 772 Asm->addu(getDest(), getSrc(0), getSrc(1)); |
797 } | |
798 | |
799 template <> void InstMIPS32Sltiu::emitIAS(const Cfg *Func) const { | |
800 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | |
801 Asm->sltiu(getDest(), getSrc(0), Imm); | |
802 } | 773 } |
803 | 774 |
804 template <> void InstMIPS32And::emitIAS(const Cfg *Func) const { | 775 template <> void InstMIPS32And::emitIAS(const Cfg *Func) const { |
805 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 776 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
806 Asm->and_(getDest(), getSrc(0), getSrc(1)); | 777 Asm->and_(getDest(), getSrc(0), getSrc(1)); |
807 } | 778 } |
808 | 779 |
809 template <> void InstMIPS32Andi::emitIAS(const Cfg *Func) const { | 780 template <> void InstMIPS32Andi::emitIAS(const Cfg *Func) const { |
810 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 781 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
811 Asm->andi(getDest(), getSrc(0), Imm); | 782 Asm->andi(getDest(), getSrc(0), Imm); |
812 } | 783 } |
813 | 784 |
| 785 template <> void InstMIPS32Cvt_d_l::emitIAS(const Cfg *Func) const { |
| 786 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 787 Asm->cvt_d_l(getDest(), getSrc(0)); |
| 788 } |
| 789 |
| 790 template <> void InstMIPS32Cvt_d_s::emitIAS(const Cfg *Func) const { |
| 791 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 792 Asm->cvt_d_s(getDest(), getSrc(0)); |
| 793 } |
| 794 |
| 795 template <> void InstMIPS32Cvt_d_w::emitIAS(const Cfg *Func) const { |
| 796 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 797 Asm->cvt_d_w(getDest(), getSrc(0)); |
| 798 } |
| 799 |
| 800 template <> void InstMIPS32Cvt_s_d::emitIAS(const Cfg *Func) const { |
| 801 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 802 Asm->cvt_s_d(getDest(), getSrc(0)); |
| 803 } |
| 804 |
| 805 template <> void InstMIPS32Cvt_s_l::emitIAS(const Cfg *Func) const { |
| 806 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 807 Asm->cvt_s_l(getDest(), getSrc(0)); |
| 808 } |
| 809 |
| 810 template <> void InstMIPS32Cvt_s_w::emitIAS(const Cfg *Func) const { |
| 811 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 812 Asm->cvt_s_w(getDest(), getSrc(0)); |
| 813 } |
| 814 |
| 815 template <> void InstMIPS32Div_d::emitIAS(const Cfg *Func) const { |
| 816 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 817 Asm->div_d(getDest(), getSrc(0), getSrc(1)); |
| 818 } |
| 819 |
| 820 template <> void InstMIPS32Div_s::emitIAS(const Cfg *Func) const { |
| 821 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 822 Asm->div_s(getDest(), getSrc(0), getSrc(1)); |
| 823 } |
| 824 |
| 825 template <> void InstMIPS32Lw::emitIAS(const Cfg *Func) const { |
| 826 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 827 auto *Mem = llvm::dyn_cast<OperandMIPS32Mem>(getSrc(0)); |
| 828 ConstantInteger32 *Offset = llvm::cast<ConstantInteger32>(Mem->getOffset()); |
| 829 uint32_t Imm = static_cast<uint32_t>(Offset->getValue()); |
| 830 Asm->lw(getDest(), Mem->getBase(), Imm); |
| 831 } |
| 832 |
| 833 template <> void InstMIPS32Mfc1::emitIAS(const Cfg *Func) const { |
| 834 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 835 Asm->mfc1(getDest(), getSrc(0)); |
| 836 } |
| 837 |
| 838 template <> void InstMIPS32Mflo::emit(const Cfg *Func) const { |
| 839 if (!BuildDefs::dump()) |
| 840 return; |
| 841 emitUnaryopGPRFLoHi(Opcode, this, Func); |
| 842 } |
| 843 |
| 844 template <> void InstMIPS32Mfhi::emit(const Cfg *Func) const { |
| 845 if (!BuildDefs::dump()) |
| 846 return; |
| 847 emitUnaryopGPRFLoHi(Opcode, this, Func); |
| 848 } |
| 849 |
| 850 template <> void InstMIPS32Mov_d::emitIAS(const Cfg *Func) const { |
| 851 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 852 Asm->mov_d(getDest(), getSrc(0)); |
| 853 } |
| 854 |
| 855 template <> void InstMIPS32Mov_s::emitIAS(const Cfg *Func) const { |
| 856 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 857 Asm->mov_s(getDest(), getSrc(0)); |
| 858 } |
| 859 |
| 860 template <> void InstMIPS32Movn_d::emitIAS(const Cfg *Func) const { |
| 861 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 862 Asm->movn_d(getDest(), getSrc(0), getSrc(1)); |
| 863 } |
| 864 |
| 865 template <> void InstMIPS32Movn_s::emitIAS(const Cfg *Func) const { |
| 866 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 867 Asm->movn_s(getDest(), getSrc(0), getSrc(1)); |
| 868 } |
| 869 |
| 870 template <> void InstMIPS32Movz_d::emitIAS(const Cfg *Func) const { |
| 871 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 872 Asm->movz_d(getDest(), getSrc(0), getSrc(1)); |
| 873 } |
| 874 |
| 875 template <> void InstMIPS32Movz_s::emitIAS(const Cfg *Func) const { |
| 876 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 877 Asm->movz_s(getDest(), getSrc(0), getSrc(1)); |
| 878 } |
| 879 |
| 880 template <> void InstMIPS32Mtc1::emitIAS(const Cfg *Func) const { |
| 881 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 882 Asm->mtc1(getDest(), getSrc(0)); |
| 883 } |
| 884 |
| 885 template <> void InstMIPS32Mtlo::emit(const Cfg *Func) const { |
| 886 if (!BuildDefs::dump()) |
| 887 return; |
| 888 emitUnaryopGPRTLoHi(Opcode, this, Func); |
| 889 } |
| 890 |
| 891 template <> void InstMIPS32Mthi::emit(const Cfg *Func) const { |
| 892 if (!BuildDefs::dump()) |
| 893 return; |
| 894 emitUnaryopGPRTLoHi(Opcode, this, Func); |
| 895 } |
| 896 |
| 897 template <> void InstMIPS32Mul_d::emitIAS(const Cfg *Func) const { |
| 898 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 899 Asm->mul_d(getDest(), getSrc(0), getSrc(1)); |
| 900 } |
| 901 |
| 902 template <> void InstMIPS32Mul_s::emitIAS(const Cfg *Func) const { |
| 903 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 904 Asm->mul_s(getDest(), getSrc(0), getSrc(1)); |
| 905 } |
| 906 |
| 907 template <> void InstMIPS32Mult::emit(const Cfg *Func) const { |
| 908 if (!BuildDefs::dump()) |
| 909 return; |
| 910 emitThreeAddrLoHi(Opcode, this, Func); |
| 911 } |
| 912 |
| 913 template <> void InstMIPS32Multu::emit(const Cfg *Func) const { |
| 914 if (!BuildDefs::dump()) |
| 915 return; |
| 916 emitThreeAddrLoHi(Opcode, this, Func); |
| 917 } |
| 918 |
814 template <> void InstMIPS32Or::emitIAS(const Cfg *Func) const { | 919 template <> void InstMIPS32Or::emitIAS(const Cfg *Func) const { |
815 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 920 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
816 Asm->or_(getDest(), getSrc(0), getSrc(1)); | 921 Asm->or_(getDest(), getSrc(0), getSrc(1)); |
817 } | 922 } |
818 | 923 |
819 template <> void InstMIPS32Ori::emitIAS(const Cfg *Func) const { | 924 template <> void InstMIPS32Ori::emitIAS(const Cfg *Func) const { |
820 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 925 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
821 Asm->ori(getDest(), getSrc(0), Imm); | 926 Asm->ori(getDest(), getSrc(0), Imm); |
822 } | 927 } |
823 | 928 |
824 template <> void InstMIPS32Xor::emitIAS(const Cfg *Func) const { | |
825 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | |
826 Asm->xor_(getDest(), getSrc(0), getSrc(1)); | |
827 } | |
828 | |
829 template <> void InstMIPS32Xori::emitIAS(const Cfg *Func) const { | |
830 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | |
831 Asm->xori(getDest(), getSrc(0), Imm); | |
832 } | |
833 | |
834 template <> void InstMIPS32Sll::emitIAS(const Cfg *Func) const { | 929 template <> void InstMIPS32Sll::emitIAS(const Cfg *Func) const { |
835 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 930 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
836 Asm->sll(getDest(), getSrc(0), Imm); | 931 Asm->sll(getDest(), getSrc(0), Imm); |
837 } | 932 } |
838 | 933 |
839 template <> void InstMIPS32Srl::emitIAS(const Cfg *Func) const { | 934 template <> void InstMIPS32Slt::emitIAS(const Cfg *Func) const { |
840 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 935 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
841 Asm->srl(getDest(), getSrc(0), Imm); | 936 Asm->slt(getDest(), getSrc(0), getSrc(1)); |
| 937 } |
| 938 |
| 939 template <> void InstMIPS32Slti::emitIAS(const Cfg *Func) const { |
| 940 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 941 Asm->slti(getDest(), getSrc(0), Imm); |
| 942 } |
| 943 |
| 944 template <> void InstMIPS32Sltiu::emitIAS(const Cfg *Func) const { |
| 945 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 946 Asm->sltiu(getDest(), getSrc(0), Imm); |
| 947 } |
| 948 |
| 949 template <> void InstMIPS32Sltu::emitIAS(const Cfg *Func) const { |
| 950 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 951 Asm->sltu(getDest(), getSrc(0), getSrc(1)); |
| 952 } |
| 953 |
| 954 template <> void InstMIPS32Sqrt_d::emitIAS(const Cfg *Func) const { |
| 955 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 956 Asm->sqrt_d(getDest(), getSrc(0)); |
| 957 } |
| 958 |
| 959 template <> void InstMIPS32Sqrt_s::emitIAS(const Cfg *Func) const { |
| 960 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 961 Asm->sqrt_s(getDest(), getSrc(0)); |
842 } | 962 } |
843 | 963 |
844 template <> void InstMIPS32Sra::emitIAS(const Cfg *Func) const { | 964 template <> void InstMIPS32Sra::emitIAS(const Cfg *Func) const { |
845 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 965 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
846 Asm->sra(getDest(), getSrc(0), Imm); | 966 Asm->sra(getDest(), getSrc(0), Imm); |
847 } | 967 } |
848 | 968 |
849 template <> void InstMIPS32Addu::emitIAS(const Cfg *Func) const { | 969 template <> void InstMIPS32Srl::emitIAS(const Cfg *Func) const { |
850 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 970 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
851 Asm->addu(getDest(), getSrc(0), getSrc(1)); | 971 Asm->srl(getDest(), getSrc(0), Imm); |
852 } | 972 } |
853 | 973 |
854 template <> void InstMIPS32Slt::emitIAS(const Cfg *Func) const { | 974 template <> void InstMIPS32Sub_d::emitIAS(const Cfg *Func) const { |
855 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 975 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
856 Asm->slt(getDest(), getSrc(0), getSrc(1)); | 976 Asm->sub_d(getDest(), getSrc(0), getSrc(1)); |
857 } | 977 } |
858 | 978 |
859 template <> void InstMIPS32Sltu::emitIAS(const Cfg *Func) const { | 979 template <> void InstMIPS32Sub_s::emitIAS(const Cfg *Func) const { |
860 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 980 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
861 Asm->sltu(getDest(), getSrc(0), getSrc(1)); | 981 Asm->sub_s(getDest(), getSrc(0), getSrc(1)); |
862 } | 982 } |
863 | 983 |
864 template <> void InstMIPS32Sw::emitIAS(const Cfg *Func) const { | 984 template <> void InstMIPS32Sw::emitIAS(const Cfg *Func) const { |
865 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 985 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
866 auto *Mem = llvm::dyn_cast<OperandMIPS32Mem>(getSrc(1)); | 986 auto *Mem = llvm::dyn_cast<OperandMIPS32Mem>(getSrc(1)); |
867 ConstantInteger32 *Offset = llvm::cast<ConstantInteger32>(Mem->getOffset()); | 987 ConstantInteger32 *Offset = llvm::cast<ConstantInteger32>(Mem->getOffset()); |
868 uint32_t Imm = static_cast<uint32_t>(Offset->getValue()); | 988 uint32_t Imm = static_cast<uint32_t>(Offset->getValue()); |
869 Asm->sw(getSrc(0), Mem->getBase(), Imm); | 989 Asm->sw(getSrc(0), Mem->getBase(), Imm); |
870 } | 990 } |
871 | 991 |
872 template <> void InstMIPS32Lw::emitIAS(const Cfg *Func) const { | 992 template <> void InstMIPS32Trunc_l_d::emitIAS(const Cfg *Func) const { |
873 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 993 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
874 auto *Mem = llvm::dyn_cast<OperandMIPS32Mem>(getSrc(0)); | 994 Asm->trunc_l_d(getDest(), getSrc(0)); |
875 ConstantInteger32 *Offset = llvm::cast<ConstantInteger32>(Mem->getOffset()); | 995 } |
876 uint32_t Imm = static_cast<uint32_t>(Offset->getValue()); | 996 |
877 Asm->lw(getDest(), Mem->getBase(), Imm); | 997 template <> void InstMIPS32Trunc_l_s::emitIAS(const Cfg *Func) const { |
| 998 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 999 Asm->trunc_l_s(getDest(), getSrc(0)); |
| 1000 } |
| 1001 |
| 1002 template <> void InstMIPS32Trunc_w_d::emitIAS(const Cfg *Func) const { |
| 1003 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 1004 Asm->trunc_w_d(getDest(), getSrc(0)); |
| 1005 } |
| 1006 |
| 1007 template <> void InstMIPS32Trunc_w_s::emitIAS(const Cfg *Func) const { |
| 1008 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 1009 Asm->trunc_w_s(getDest(), getSrc(0)); |
| 1010 } |
| 1011 |
| 1012 template <> void InstMIPS32Xor::emitIAS(const Cfg *Func) const { |
| 1013 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 1014 Asm->xor_(getDest(), getSrc(0), getSrc(1)); |
| 1015 } |
| 1016 |
| 1017 template <> void InstMIPS32Xori::emitIAS(const Cfg *Func) const { |
| 1018 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 1019 Asm->xori(getDest(), getSrc(0), Imm); |
878 } | 1020 } |
879 | 1021 |
880 } // end of namespace MIPS32 | 1022 } // end of namespace MIPS32 |
881 } // end of namespace Ice | 1023 } // end of namespace Ice |
OLD | NEW |