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

Side by Side Diff: src/IceInstARM32.cpp

Issue 1596613002: Clean up handling of ARM IR instruction "mov". (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Reformat. Created 4 years, 11 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 | « src/IceInstARM32.h ('k') | tests_lit/assembler/arm32/vmov-cast.ll » ('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/IceInstARM32.cpp - ARM32 instruction implementation ----===// 1 //===- subzero/src/IceInstARM32.cpp - ARM32 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 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 Str << getPredicate() << WidthString; 1109 Str << getPredicate() << WidthString;
1110 } else { 1110 } else {
1111 Str << WidthString << getPredicate(); 1111 Str << WidthString << getPredicate();
1112 } 1112 }
1113 Str << "\t"; 1113 Str << "\t";
1114 Dest->emit(Func); 1114 Dest->emit(Func);
1115 Str << ", "; 1115 Str << ", ";
1116 Src0->emit(Func); 1116 Src0->emit(Func);
1117 } 1117 }
1118 1118
1119 void InstARM32Mov::emitIASCoreVFPMove(const Cfg *Func) const {
1120 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>();
1121 Operand *Src0 = getSrc(0);
1122 if (!llvm::isa<Variable>(Src0))
1123 // TODO(kschimpf) Handle moving contants into registers.
Jim Stichnoth 2016/01/19 21:14:57 constants
Karl 2016/01/21 16:05:47 Done.
1124 return Asm->setNeedsTextFixup();
1125
1126 // Move register to register.
1127 Variable *Dest = getDest();
1128 switch (Dest->getType()) {
1129 default:
1130 // TODO(kschimpf): Fill this out more.
1131 return Asm->setNeedsTextFixup();
1132 case IceType_f32:
1133 switch (Src0->getType()) {
1134 default:
1135 // TODO(kschimpf): Fill this out more?
1136 return Asm->setNeedsTextFixup();
1137 case IceType_i32:
1138 return Asm->vmovsr(Dest, Src0, getPredicate());
1139 }
1140 }
1141 }
1142
1119 void InstARM32Mov::emitIASSingleDestSingleSource(const Cfg *Func) const { 1143 void InstARM32Mov::emitIASSingleDestSingleSource(const Cfg *Func) const {
1120 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); 1144 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>();
1121 Variable *Dest = getDest(); 1145 Variable *Dest = getDest();
1122 Operand *Src0 = getSrc(0); 1146 Operand *Src0 = getSrc(0);
1123 1147
1124 if (!Dest->hasReg()) { 1148 if (!Dest->hasReg()) {
1125 llvm::report_fatal_error("mov can't store."); 1149 llvm::report_fatal_error("mov can't store.");
1126 } 1150 }
1127 1151
1128 if (isMemoryAccess(Src0)) { 1152 if (isMemoryAccess(Src0)) {
1129 llvm::report_fatal_error("mov can't load."); 1153 llvm::report_fatal_error("mov can't load.");
1130 } 1154 }
1131 1155
1156 if (isMoveBetweenCoreAndVFPRegisters(Dest, Src0))
1157 return emitIASCoreVFPMove(Func);
1158
1132 const Type DestTy = Dest->getType(); 1159 const Type DestTy = Dest->getType();
1133 const bool DestIsVector = isVectorType(DestTy); 1160 if (isScalarFloatingType(DestTy))
1134 const bool DestIsScalarFP = isScalarFloatingType(DestTy);
1135 const bool CoreVFPMove = isMoveBetweenCoreAndVFPRegisters(Dest, Src0);
1136 if (DestIsVector || DestIsScalarFP || CoreVFPMove)
1137 return Asm->setNeedsTextFixup(); 1161 return Asm->setNeedsTextFixup();
1162
1163 if (isVectorType(DestTy))
1164 return Asm->setNeedsTextFixup();
1165
1138 return Asm->mov(Dest, Src0, getPredicate()); 1166 return Asm->mov(Dest, Src0, getPredicate());
1139 } 1167 }
1140 1168
1141 void InstARM32Mov::emit(const Cfg *Func) const { 1169 void InstARM32Mov::emit(const Cfg *Func) const {
1142 if (!BuildDefs::dump()) 1170 if (!BuildDefs::dump())
1143 return; 1171 return;
1144 assert(!(isMultiDest() && isMultiSource()) && "Invalid vmov type."); 1172 assert(!(isMultiDest() && isMultiSource()) && "Invalid vmov type.");
1145 if (isMultiDest()) { 1173 if (isMultiDest()) {
1146 emitMultiDestSingleSource(Func); 1174 emitMultiDestSingleSource(Func);
1147 return; 1175 return;
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
2216 2244
2217 template class InstARM32FourAddrGPR<InstARM32::Mla>; 2245 template class InstARM32FourAddrGPR<InstARM32::Mla>;
2218 template class InstARM32FourAddrGPR<InstARM32::Mls>; 2246 template class InstARM32FourAddrGPR<InstARM32::Mls>;
2219 2247
2220 template class InstARM32CmpLike<InstARM32::Cmn>; 2248 template class InstARM32CmpLike<InstARM32::Cmn>;
2221 template class InstARM32CmpLike<InstARM32::Cmp>; 2249 template class InstARM32CmpLike<InstARM32::Cmp>;
2222 template class InstARM32CmpLike<InstARM32::Tst>; 2250 template class InstARM32CmpLike<InstARM32::Tst>;
2223 2251
2224 } // end of namespace ARM32 2252 } // end of namespace ARM32
2225 } // end of namespace Ice 2253 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceInstARM32.h ('k') | tests_lit/assembler/arm32/vmov-cast.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698