Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: src/IceInstMIPS32.cpp

Issue 2316933002: [SubZero] Implement GP to/from FP moves for MIPS (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Rebase to master Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/IceRegistersMIPS32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 auto *SrcV = llvm::dyn_cast<Variable>(Src); 726 auto *SrcV = llvm::dyn_cast<Variable>(Src);
727 727
728 assert(!llvm::isa<Constant>(Src)); 728 assert(!llvm::isa<Constant>(Src));
729 729
730 const char *ActualOpcode = nullptr; 730 const char *ActualOpcode = nullptr;
731 const bool DestIsReg = Dest->hasReg(); 731 const bool DestIsReg = Dest->hasReg();
732 const bool SrcIsReg = (SrcV && SrcV->hasReg()); 732 const bool SrcIsReg = (SrcV && SrcV->hasReg());
733 733
734 // reg to reg 734 // reg to reg
735 if (DestIsReg && SrcIsReg) { 735 if (DestIsReg && SrcIsReg) {
736 switch (Dest->getType()) { 736 const Type DstType = Dest->getType();
737 case IceType_f32: 737 const Type SrcType = Src->getType();
738 ActualOpcode = "mov.s"; 738
739 break; 739 // move GP to/from FP
740 case IceType_f64: 740 if (DstType != SrcType) {
741 ActualOpcode = "mov.d"; 741 if (isScalarFloatingType(DstType)) {
742 break; 742 Str << "\t"
743 case IceType_i1: 743 "mtc1"
744 case IceType_i8: 744 "\t";
745 case IceType_i16: 745 getSrc(0)->emit(Func);
746 case IceType_i32: 746 Str << ", ";
747 Str << "\t" 747 getDest()->emit(Func);
748 << "move" 748 return;
749 << "\t"; 749 }
750 getDest()->emit(Func); 750 ActualOpcode = "mfc1";
751 Str << ", "; 751 } else {
752 getSrc(0)->emit(Func); 752 switch (Dest->getType()) {
753 return; 753 case IceType_f32:
754 default: 754 ActualOpcode = "mov.s";
755 UnimplementedError(getFlags()); 755 break;
756 return; 756 case IceType_f64:
757 ActualOpcode = "mov.d";
758 break;
759 case IceType_i1:
760 case IceType_i8:
761 case IceType_i16:
762 case IceType_i32:
763 ActualOpcode = "move";
764 break;
765 default:
766 UnimplementedError(getFlags());
767 return;
768 }
757 } 769 }
758 770
759 assert(ActualOpcode); 771 assert(ActualOpcode);
760 Str << "\t" << ActualOpcode << "\t"; 772 Str << "\t" << ActualOpcode << "\t";
761 getDest()->emit(Func); 773 getDest()->emit(Func);
762 Str << ", "; 774 Str << ", ";
763 getSrc(0)->emit(Func); 775 getSrc(0)->emit(Func);
764 return; 776 return;
765 } 777 }
766 778
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 template <> void InstMIPS32Lw::emitIAS(const Cfg *Func) const { 865 template <> void InstMIPS32Lw::emitIAS(const Cfg *Func) const {
854 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); 866 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>();
855 auto *Mem = llvm::dyn_cast<OperandMIPS32Mem>(getSrc(0)); 867 auto *Mem = llvm::dyn_cast<OperandMIPS32Mem>(getSrc(0));
856 ConstantInteger32 *Offset = llvm::cast<ConstantInteger32>(Mem->getOffset()); 868 ConstantInteger32 *Offset = llvm::cast<ConstantInteger32>(Mem->getOffset());
857 uint32_t Imm = static_cast<uint32_t>(Offset->getValue()); 869 uint32_t Imm = static_cast<uint32_t>(Offset->getValue());
858 Asm->lw(getDest(), Mem->getBase(), Imm); 870 Asm->lw(getDest(), Mem->getBase(), Imm);
859 } 871 }
860 872
861 } // end of namespace MIPS32 873 } // end of namespace MIPS32
862 } // end of namespace Ice 874 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | src/IceRegistersMIPS32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698