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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 template <> const char *InstMIPS32Sra::Opcode = "sra"; | 133 template <> const char *InstMIPS32Sra::Opcode = "sra"; |
134 template <> const char *InstMIPS32Srav::Opcode = "srav"; | 134 template <> const char *InstMIPS32Srav::Opcode = "srav"; |
135 template <> const char *InstMIPS32Srl::Opcode = "srl"; | 135 template <> const char *InstMIPS32Srl::Opcode = "srl"; |
136 template <> const char *InstMIPS32Srlv::Opcode = "srlv"; | 136 template <> const char *InstMIPS32Srlv::Opcode = "srlv"; |
137 template <> const char *InstMIPS32Sub::Opcode = "sub"; | 137 template <> const char *InstMIPS32Sub::Opcode = "sub"; |
138 template <> const char *InstMIPS32Sub_d::Opcode = "sub.d"; | 138 template <> const char *InstMIPS32Sub_d::Opcode = "sub.d"; |
139 template <> const char *InstMIPS32Sub_s::Opcode = "sub.s"; | 139 template <> const char *InstMIPS32Sub_s::Opcode = "sub.s"; |
140 template <> const char *InstMIPS32Subu::Opcode = "subu"; | 140 template <> const char *InstMIPS32Subu::Opcode = "subu"; |
141 template <> const char *InstMIPS32Sw::Opcode = "sw"; | 141 template <> const char *InstMIPS32Sw::Opcode = "sw"; |
142 template <> const char *InstMIPS32Swc1::Opcode = "swc1"; | 142 template <> const char *InstMIPS32Swc1::Opcode = "swc1"; |
| 143 template <> const char *InstMIPS32Teq::Opcode = "teq"; |
143 template <> const char *InstMIPS32Trunc_l_d::Opcode = "trunc.l.d"; | 144 template <> const char *InstMIPS32Trunc_l_d::Opcode = "trunc.l.d"; |
144 template <> const char *InstMIPS32Trunc_l_s::Opcode = "trunc.l.s"; | 145 template <> const char *InstMIPS32Trunc_l_s::Opcode = "trunc.l.s"; |
145 template <> const char *InstMIPS32Trunc_w_d::Opcode = "trunc.w.d"; | 146 template <> const char *InstMIPS32Trunc_w_d::Opcode = "trunc.w.d"; |
146 template <> const char *InstMIPS32Trunc_w_s::Opcode = "trunc.w.s"; | 147 template <> const char *InstMIPS32Trunc_w_s::Opcode = "trunc.w.s"; |
147 template <> const char *InstMIPS32Xor::Opcode = "xor"; | 148 template <> const char *InstMIPS32Xor::Opcode = "xor"; |
148 template <> const char *InstMIPS32Xori::Opcode = "xori"; | 149 template <> const char *InstMIPS32Xori::Opcode = "xori"; |
149 | 150 |
150 template <> void InstMIPS32Lui::emit(const Cfg *Func) const { | 151 template <> void InstMIPS32Lui::emit(const Cfg *Func) const { |
151 if (!BuildDefs::dump()) | 152 if (!BuildDefs::dump()) |
152 return; | 153 return; |
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 } | 983 } |
983 | 984 |
984 template <> void InstMIPS32Sw::emitIAS(const Cfg *Func) const { | 985 template <> void InstMIPS32Sw::emitIAS(const Cfg *Func) const { |
985 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 986 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
986 auto *Mem = llvm::dyn_cast<OperandMIPS32Mem>(getSrc(1)); | 987 auto *Mem = llvm::dyn_cast<OperandMIPS32Mem>(getSrc(1)); |
987 ConstantInteger32 *Offset = llvm::cast<ConstantInteger32>(Mem->getOffset()); | 988 ConstantInteger32 *Offset = llvm::cast<ConstantInteger32>(Mem->getOffset()); |
988 uint32_t Imm = static_cast<uint32_t>(Offset->getValue()); | 989 uint32_t Imm = static_cast<uint32_t>(Offset->getValue()); |
989 Asm->sw(getSrc(0), Mem->getBase(), Imm); | 990 Asm->sw(getSrc(0), Mem->getBase(), Imm); |
990 } | 991 } |
991 | 992 |
| 993 template <> void InstMIPS32Teq::emitIAS(const Cfg *Func) const { |
| 994 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 995 Asm->teq(getSrc(0), getSrc(1), getTrapCode()); |
| 996 } |
| 997 |
992 template <> void InstMIPS32Trunc_l_d::emitIAS(const Cfg *Func) const { | 998 template <> void InstMIPS32Trunc_l_d::emitIAS(const Cfg *Func) const { |
993 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 999 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
994 Asm->trunc_l_d(getDest(), getSrc(0)); | 1000 Asm->trunc_l_d(getDest(), getSrc(0)); |
995 } | 1001 } |
996 | 1002 |
997 template <> void InstMIPS32Trunc_l_s::emitIAS(const Cfg *Func) const { | 1003 template <> void InstMIPS32Trunc_l_s::emitIAS(const Cfg *Func) const { |
998 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 1004 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
999 Asm->trunc_l_s(getDest(), getSrc(0)); | 1005 Asm->trunc_l_s(getDest(), getSrc(0)); |
1000 } | 1006 } |
1001 | 1007 |
(...skipping 12 matching lines...) Expand all Loading... |
1014 Asm->xor_(getDest(), getSrc(0), getSrc(1)); | 1020 Asm->xor_(getDest(), getSrc(0), getSrc(1)); |
1015 } | 1021 } |
1016 | 1022 |
1017 template <> void InstMIPS32Xori::emitIAS(const Cfg *Func) const { | 1023 template <> void InstMIPS32Xori::emitIAS(const Cfg *Func) const { |
1018 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 1024 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
1019 Asm->xori(getDest(), getSrc(0), Imm); | 1025 Asm->xori(getDest(), getSrc(0), Imm); |
1020 } | 1026 } |
1021 | 1027 |
1022 } // end of namespace MIPS32 | 1028 } // end of namespace MIPS32 |
1023 } // end of namespace Ice | 1029 } // end of namespace Ice |
OLD | NEW |