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

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: Addressed review comments 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') | src/IceTargetLoweringMIPS32.cpp » ('J')
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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 auto *SrcV = llvm::dyn_cast<Variable>(Src); 706 auto *SrcV = llvm::dyn_cast<Variable>(Src);
707 707
708 assert(!llvm::isa<Constant>(Src)); 708 assert(!llvm::isa<Constant>(Src));
709 709
710 const char *ActualOpcode = nullptr; 710 const char *ActualOpcode = nullptr;
711 const bool DestIsReg = Dest->hasReg(); 711 const bool DestIsReg = Dest->hasReg();
712 const bool SrcIsReg = (SrcV && SrcV->hasReg()); 712 const bool SrcIsReg = (SrcV && SrcV->hasReg());
713 713
714 // reg to reg 714 // reg to reg
715 if (DestIsReg && SrcIsReg) { 715 if (DestIsReg && SrcIsReg) {
716 switch (Dest->getType()) { 716 const Type DstType = Dest->getType();
717 case IceType_f32: 717 const Type SrcType = Src->getType();
718 ActualOpcode = "mov.s"; 718
719 break; 719 // move GP to/from FP
720 case IceType_f64: 720 if (DstType != SrcType) {
721 ActualOpcode = "mov.d"; 721 if (isScalarFloatingType(DstType)) {
722 break; 722 Str << "\t"
723 case IceType_i1: 723 "mtc1"
724 case IceType_i8: 724 "\t";
725 case IceType_i16: 725 getSrc(0)->emit(Func);
726 case IceType_i32: 726 Str << ", ";
727 Str << "\t" 727 getDest()->emit(Func);
728 << "move" 728 return;
729 << "\t"; 729 }
730 getDest()->emit(Func); 730 ActualOpcode = "mfc1";
731 Str << ", "; 731 } else {
732 getSrc(0)->emit(Func); 732 switch (Dest->getType()) {
733 return; 733 case IceType_f32:
734 default: 734 ActualOpcode = "mov.s";
735 UnimplementedError(getFlags()); 735 break;
736 return; 736 case IceType_f64:
737 ActualOpcode = "mov.d";
738 break;
739 case IceType_i1:
740 case IceType_i8:
741 case IceType_i16:
742 case IceType_i32:
743 ActualOpcode = "move";
744 break;
745 default:
746 UnimplementedError(getFlags());
747 return;
748 }
737 } 749 }
738 750
739 assert(ActualOpcode); 751 assert(ActualOpcode);
740 Str << "\t" << ActualOpcode << "\t"; 752 Str << "\t" << ActualOpcode << "\t";
741 getDest()->emit(Func); 753 getDest()->emit(Func);
742 Str << ", "; 754 Str << ", ";
743 getSrc(0)->emit(Func); 755 getSrc(0)->emit(Func);
744 return; 756 return;
745 } 757 }
746 758
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 template <> void InstMIPS32Lw::emitIAS(const Cfg *Func) const { 845 template <> void InstMIPS32Lw::emitIAS(const Cfg *Func) const {
834 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>(); 846 auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>();
835 auto *Mem = llvm::dyn_cast<OperandMIPS32Mem>(getSrc(0)); 847 auto *Mem = llvm::dyn_cast<OperandMIPS32Mem>(getSrc(0));
836 ConstantInteger32 *Offset = llvm::cast<ConstantInteger32>(Mem->getOffset()); 848 ConstantInteger32 *Offset = llvm::cast<ConstantInteger32>(Mem->getOffset());
837 uint32_t Imm = static_cast<uint32_t>(Offset->getValue()); 849 uint32_t Imm = static_cast<uint32_t>(Offset->getValue());
838 Asm->lw(getDest(), Mem->getBase(), Imm); 850 Asm->lw(getDest(), Mem->getBase(), Imm);
839 } 851 }
840 852
841 } // end of namespace MIPS32 853 } // end of namespace MIPS32
842 } // end of namespace Ice 854 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | src/IceRegistersMIPS32.h » ('j') | src/IceTargetLoweringMIPS32.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698