Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1117 Str << getPredicate() << WidthString; | 1117 Str << getPredicate() << WidthString; |
| 1118 } else { | 1118 } else { |
| 1119 Str << WidthString << getPredicate(); | 1119 Str << WidthString << getPredicate(); |
| 1120 } | 1120 } |
| 1121 Str << "\t"; | 1121 Str << "\t"; |
| 1122 Dest->emit(Func); | 1122 Dest->emit(Func); |
| 1123 Str << ", "; | 1123 Str << ", "; |
| 1124 Src0->emit(Func); | 1124 Src0->emit(Func); |
| 1125 } | 1125 } |
| 1126 | 1126 |
| 1127 void InstARM32Mov::emitIASScalarVFPMove(const Cfg *Func) const { | |
| 1128 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); | |
| 1129 Operand *Src0 = getSrc(0); | |
| 1130 Variable *Dest = getDest(); | |
| 1131 switch (Dest->getType()) { | |
| 1132 default: | |
| 1133 assert(false); | |
|
Jim Stichnoth
2016/01/26 13:44:41
assert(false && "some message");
Karl
2016/01/26 16:42:05
Done.
| |
| 1134 return; | |
| 1135 case IceType_f32: | |
| 1136 if (const auto *FpImm = llvm::dyn_cast<OperandARM32FlexFpImm>(Src0)) { | |
| 1137 Asm->vmovs(Dest, FpImm, getPredicate()); | |
| 1138 return; | |
| 1139 } | |
| 1140 break; | |
| 1141 case IceType_f64: | |
| 1142 if (const auto *FpImm = llvm::dyn_cast<OperandARM32FlexFpImm>(Src0)) { | |
| 1143 Asm->vmovd(Dest, FpImm, getPredicate()); | |
| 1144 return; | |
| 1145 } | |
| 1146 break; | |
| 1147 } | |
| 1148 // TODO(kschimpf) Handle register to register move. | |
| 1149 Asm->setNeedsTextFixup(); | |
| 1150 return; | |
| 1151 } | |
| 1152 | |
| 1127 void InstARM32Mov::emitIASCoreVFPMove(const Cfg *Func) const { | 1153 void InstARM32Mov::emitIASCoreVFPMove(const Cfg *Func) const { |
| 1128 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); | 1154 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); |
| 1129 Operand *Src0 = getSrc(0); | 1155 Operand *Src0 = getSrc(0); |
| 1130 if (!llvm::isa<Variable>(Src0)) | 1156 if (!llvm::isa<Variable>(Src0)) |
| 1131 // TODO(kschimpf) Handle moving constants into registers. | 1157 // TODO(kschimpf) Handle moving constants into registers. |
| 1132 return Asm->setNeedsTextFixup(); | 1158 return Asm->setNeedsTextFixup(); |
| 1133 | 1159 |
| 1134 // Move register to register. | 1160 // Move register to register. |
| 1135 Variable *Dest = getDest(); | 1161 Variable *Dest = getDest(); |
| 1136 switch (Dest->getType()) { | 1162 switch (Dest->getType()) { |
| 1137 default: | 1163 default: |
| 1138 // TODO(kschimpf): Fill this out more. | 1164 // TODO(kschimpf): Fill this out more. |
| 1139 return Asm->setNeedsTextFixup(); | 1165 return Asm->setNeedsTextFixup(); |
| 1140 case IceType_f32: | 1166 case IceType_f32: |
| 1141 switch (Src0->getType()) { | 1167 switch (Src0->getType()) { |
| 1142 default: | 1168 default: |
| 1143 // TODO(kschimpf): Fill this out more? | 1169 // TODO(kschimpf): Fill this out more? |
| 1144 return Asm->setNeedsTextFixup(); | 1170 return Asm->setNeedsTextFixup(); |
| 1145 case IceType_i32: | 1171 case IceType_i32: |
| 1146 return Asm->vmovsr(Dest, Src0, getPredicate()); | 1172 return Asm->vmovsr(Dest, Src0, getPredicate()); |
| 1147 } | 1173 } |
| 1148 } | 1174 } |
| 1149 } | 1175 } |
| 1150 | 1176 |
| 1151 void InstARM32Mov::emitIASSingleDestSingleSource(const Cfg *Func) const { | 1177 void InstARM32Mov::emitIASSingleDestSingleSource(const Cfg *Func) const { |
| 1152 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); | |
| 1153 Variable *Dest = getDest(); | 1178 Variable *Dest = getDest(); |
| 1154 Operand *Src0 = getSrc(0); | 1179 Operand *Src0 = getSrc(0); |
| 1155 | 1180 |
| 1156 if (!Dest->hasReg()) { | 1181 if (!Dest->hasReg()) { |
| 1157 llvm::report_fatal_error("mov can't store."); | 1182 llvm::report_fatal_error("mov can't store."); |
| 1158 } | 1183 } |
| 1159 | 1184 |
| 1160 if (isMemoryAccess(Src0)) { | 1185 if (isMemoryAccess(Src0)) { |
| 1161 llvm::report_fatal_error("mov can't load."); | 1186 llvm::report_fatal_error("mov can't load."); |
| 1162 } | 1187 } |
| 1163 | 1188 |
| 1164 if (isMoveBetweenCoreAndVFPRegisters(Dest, Src0)) | 1189 if (isMoveBetweenCoreAndVFPRegisters(Dest, Src0)) |
| 1165 return emitIASCoreVFPMove(Func); | 1190 return emitIASCoreVFPMove(Func); |
| 1166 | 1191 |
| 1167 const Type DestTy = Dest->getType(); | 1192 const Type DestTy = Dest->getType(); |
| 1168 if (isScalarFloatingType(DestTy)) | 1193 if (isScalarFloatingType(DestTy)) |
| 1169 return Asm->setNeedsTextFixup(); | 1194 return emitIASScalarVFPMove(Func); |
| 1170 | 1195 |
| 1196 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); | |
| 1171 if (isVectorType(DestTy)) | 1197 if (isVectorType(DestTy)) |
| 1172 return Asm->setNeedsTextFixup(); | 1198 return Asm->setNeedsTextFixup(); |
| 1173 | 1199 |
| 1174 return Asm->mov(Dest, Src0, getPredicate()); | 1200 return Asm->mov(Dest, Src0, getPredicate()); |
| 1175 } | 1201 } |
| 1176 | 1202 |
| 1177 void InstARM32Mov::emit(const Cfg *Func) const { | 1203 void InstARM32Mov::emit(const Cfg *Func) const { |
| 1178 if (!BuildDefs::dump()) | 1204 if (!BuildDefs::dump()) |
| 1179 return; | 1205 return; |
| 1180 assert(!(isMultiDest() && isMultiSource()) && "Invalid vmov type."); | 1206 assert(!(isMultiDest() && isMultiSource()) && "Invalid vmov type."); |
| (...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2303 | 2329 |
| 2304 template class InstARM32FourAddrGPR<InstARM32::Mla>; | 2330 template class InstARM32FourAddrGPR<InstARM32::Mla>; |
| 2305 template class InstARM32FourAddrGPR<InstARM32::Mls>; | 2331 template class InstARM32FourAddrGPR<InstARM32::Mls>; |
| 2306 | 2332 |
| 2307 template class InstARM32CmpLike<InstARM32::Cmn>; | 2333 template class InstARM32CmpLike<InstARM32::Cmn>; |
| 2308 template class InstARM32CmpLike<InstARM32::Cmp>; | 2334 template class InstARM32CmpLike<InstARM32::Cmp>; |
| 2309 template class InstARM32CmpLike<InstARM32::Tst>; | 2335 template class InstARM32CmpLike<InstARM32::Tst>; |
| 2310 | 2336 |
| 2311 } // end of namespace ARM32 | 2337 } // end of namespace ARM32 |
| 2312 } // end of namespace Ice | 2338 } // end of namespace Ice |
| OLD | NEW |