Chromium Code Reviews| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 template <> const char *InstMIPS32Ldc1::Opcode = "ldc1"; | 97 template <> const char *InstMIPS32Ldc1::Opcode = "ldc1"; |
| 98 template <> const char *InstMIPS32Lui::Opcode = "lui"; | 98 template <> const char *InstMIPS32Lui::Opcode = "lui"; |
| 99 template <> const char *InstMIPS32Lw::Opcode = "lw"; | 99 template <> const char *InstMIPS32Lw::Opcode = "lw"; |
| 100 template <> const char *InstMIPS32Lwc1::Opcode = "lwc1"; | 100 template <> const char *InstMIPS32Lwc1::Opcode = "lwc1"; |
| 101 template <> const char *InstMIPS32Mfc1::Opcode = "mfc1"; | 101 template <> const char *InstMIPS32Mfc1::Opcode = "mfc1"; |
| 102 template <> const char *InstMIPS32Mfhi::Opcode = "mfhi"; | 102 template <> const char *InstMIPS32Mfhi::Opcode = "mfhi"; |
| 103 template <> const char *InstMIPS32Mflo::Opcode = "mflo"; | 103 template <> const char *InstMIPS32Mflo::Opcode = "mflo"; |
| 104 template <> const char *InstMIPS32Mov_d::Opcode = "mov.d"; | 104 template <> const char *InstMIPS32Mov_d::Opcode = "mov.d"; |
| 105 template <> const char *InstMIPS32Mov_s::Opcode = "mov.s"; | 105 template <> const char *InstMIPS32Mov_s::Opcode = "mov.s"; |
| 106 template <> const char *InstMIPS32Movf::Opcode = "movf"; | 106 template <> const char *InstMIPS32Movf::Opcode = "movf"; |
| 107 template <> const char *InstMIPS32Movn::Opcode = "movn"; | |
| 108 template <> const char *InstMIPS32Movn_d::Opcode = "movn.d"; | |
| 109 template <> const char *InstMIPS32Movn_s::Opcode = "movn.s"; | |
| 107 template <> const char *InstMIPS32Movt::Opcode = "movt"; | 110 template <> const char *InstMIPS32Movt::Opcode = "movt"; |
| 111 template <> const char *InstMIPS32Movz::Opcode = "movz"; | |
| 112 template <> const char *InstMIPS32Movz_d::Opcode = "movz.d"; | |
| 113 template <> const char *InstMIPS32Movz_s::Opcode = "movz.s"; | |
| 108 template <> const char *InstMIPS32Mtc1::Opcode = "mtc1"; | 114 template <> const char *InstMIPS32Mtc1::Opcode = "mtc1"; |
| 109 template <> const char *InstMIPS32Mthi::Opcode = "mthi"; | 115 template <> const char *InstMIPS32Mthi::Opcode = "mthi"; |
| 110 template <> const char *InstMIPS32Mtlo::Opcode = "mtlo"; | 116 template <> const char *InstMIPS32Mtlo::Opcode = "mtlo"; |
| 111 template <> const char *InstMIPS32Mul::Opcode = "mul"; | 117 template <> const char *InstMIPS32Mul::Opcode = "mul"; |
| 112 template <> const char *InstMIPS32Mul_d::Opcode = "mul.d"; | 118 template <> const char *InstMIPS32Mul_d::Opcode = "mul.d"; |
| 113 template <> const char *InstMIPS32Mul_s::Opcode = "mul.s"; | 119 template <> const char *InstMIPS32Mul_s::Opcode = "mul.s"; |
| 114 template <> const char *InstMIPS32Mult::Opcode = "mult"; | 120 template <> const char *InstMIPS32Mult::Opcode = "mult"; |
| 115 template <> const char *InstMIPS32Multu::Opcode = "multu"; | 121 template <> const char *InstMIPS32Multu::Opcode = "multu"; |
| 116 template <> const char *InstMIPS32Or::Opcode = "or"; | 122 template <> const char *InstMIPS32Or::Opcode = "or"; |
| 117 template <> const char *InstMIPS32Ori::Opcode = "ori"; | 123 template <> const char *InstMIPS32Ori::Opcode = "ori"; |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 730 const char *ActualOpcode = nullptr; | 736 const char *ActualOpcode = nullptr; |
| 731 const bool DestIsReg = Dest->hasReg(); | 737 const bool DestIsReg = Dest->hasReg(); |
| 732 const bool SrcIsReg = (SrcV && SrcV->hasReg()); | 738 const bool SrcIsReg = (SrcV && SrcV->hasReg()); |
| 733 | 739 |
| 734 // reg to reg | 740 // reg to reg |
| 735 if (DestIsReg && SrcIsReg) { | 741 if (DestIsReg && SrcIsReg) { |
| 736 const Type DstType = Dest->getType(); | 742 const Type DstType = Dest->getType(); |
| 737 const Type SrcType = Src->getType(); | 743 const Type SrcType = Src->getType(); |
| 738 | 744 |
| 739 // move GP to/from FP | 745 // move GP to/from FP |
| 740 if (DstType != SrcType) { | 746 if ((isScalarIntegerType(DstType) && isScalarFloatingType(SrcType)) || |
| 747 (isScalarFloatingType(DstType) && isScalarIntegerType(SrcType))) { | |
|
obucinac
2016/09/14 12:39:02
e.g. IceType_i8 != IceType_i32, triggered emmiting
| |
| 741 if (isScalarFloatingType(DstType)) { | 748 if (isScalarFloatingType(DstType)) { |
| 742 Str << "\t" | 749 Str << "\t" |
| 743 "mtc1" | 750 "mtc1" |
| 744 "\t"; | 751 "\t"; |
| 745 getSrc(0)->emit(Func); | 752 getSrc(0)->emit(Func); |
| 746 Str << ", "; | 753 Str << ", "; |
| 747 getDest()->emit(Func); | 754 getDest()->emit(Func); |
| 748 return; | 755 return; |
| 749 } | 756 } |
| 750 ActualOpcode = "mfc1"; | 757 ActualOpcode = "mfc1"; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 865 template <> void InstMIPS32Lw::emitIAS(const Cfg *Func) const { | 872 template <> void InstMIPS32Lw::emitIAS(const Cfg *Func) const { |
| 866 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); | 873 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); |
| 867 auto *Mem = llvm::dyn_cast<OperandMIPS32Mem>(getSrc(0)); | 874 auto *Mem = llvm::dyn_cast<OperandMIPS32Mem>(getSrc(0)); |
| 868 ConstantInteger32 *Offset = llvm::cast<ConstantInteger32>(Mem->getOffset()); | 875 ConstantInteger32 *Offset = llvm::cast<ConstantInteger32>(Mem->getOffset()); |
| 869 uint32_t Imm = static_cast<uint32_t>(Offset->getValue()); | 876 uint32_t Imm = static_cast<uint32_t>(Offset->getValue()); |
| 870 Asm->lw(getDest(), Mem->getBase(), Imm); | 877 Asm->lw(getDest(), Mem->getBase(), Imm); |
| 871 } | 878 } |
| 872 | 879 |
| 873 } // end of namespace MIPS32 | 880 } // end of namespace MIPS32 |
| 874 } // end of namespace Ice | 881 } // end of namespace Ice |
| OLD | NEW |