OLD | NEW |
1 //===- subzero/src/IceInstX86BaseImpl.h - Generic X86 instructions -*- C++ -*=// | 1 //===- subzero/src/IceInstX86BaseImpl.h - Generic X86 instructions -*- C++ -*=// |
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 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1323 (void)Src0Var; | 1323 (void)Src0Var; |
1324 assert(Src0Var && | 1324 assert(Src0Var && |
1325 Src0Var->getRegNum() == | 1325 Src0Var->getRegNum() == |
1326 InstX86Base<Machine>::Traits::RegisterSet::Reg_eax); | 1326 InstX86Base<Machine>::Traits::RegisterSet::Reg_eax); |
1327 static const typename InstX86Base< | 1327 static const typename InstX86Base< |
1328 Machine>::Traits::Assembler::GPREmitterOneOp Emitter = { | 1328 Machine>::Traits::Assembler::GPREmitterOneOp Emitter = { |
1329 &InstX86Base<Machine>::Traits::Assembler::imul, | 1329 &InstX86Base<Machine>::Traits::Assembler::imul, |
1330 &InstX86Base<Machine>::Traits::Assembler::imul}; | 1330 &InstX86Base<Machine>::Traits::Assembler::imul}; |
1331 emitIASOpTyGPR<Machine>(Func, Ty, this->getSrc(1), Emitter); | 1331 emitIASOpTyGPR<Machine>(Func, Ty, this->getSrc(1), Emitter); |
1332 } else { | 1332 } else { |
1333 // We only use imul as a two-address instruction even though there is a 3 | 1333 // The two-address version is used when multiplying by a non-constant |
1334 // operand version when one of the operands is a constant. | 1334 // or doing an 8-bit multiply. |
1335 assert(Var == this->getSrc(0)); | 1335 assert(Var == this->getSrc(0)); |
1336 static const typename InstX86Base< | 1336 static const typename InstX86Base< |
1337 Machine>::Traits::Assembler::GPREmitterRegOp Emitter = { | 1337 Machine>::Traits::Assembler::GPREmitterRegOp Emitter = { |
1338 &InstX86Base<Machine>::Traits::Assembler::imul, | 1338 &InstX86Base<Machine>::Traits::Assembler::imul, |
1339 &InstX86Base<Machine>::Traits::Assembler::imul, | 1339 &InstX86Base<Machine>::Traits::Assembler::imul, |
1340 &InstX86Base<Machine>::Traits::Assembler::imul}; | 1340 &InstX86Base<Machine>::Traits::Assembler::imul}; |
1341 emitIASRegOpTyGPR<Machine>(Func, Ty, Var, Src, Emitter); | 1341 emitIASRegOpTyGPR<Machine>(Func, Ty, Var, Src, Emitter); |
1342 } | 1342 } |
1343 } | 1343 } |
1344 | 1344 |
1345 template <class Machine> | 1345 template <class Machine> |
| 1346 void InstX86ImulImm<Machine>::emit(const Cfg *Func) const { |
| 1347 if (!BuildDefs::dump()) |
| 1348 return; |
| 1349 Ostream &Str = Func->getContext()->getStrEmit(); |
| 1350 assert(this->getSrcSize() == 2); |
| 1351 Variable *Dest = this->getDest(); |
| 1352 assert(Dest->getType() == IceType_i16 || Dest->getType() == IceType_i32); |
| 1353 assert(llvm::isa<Constant>(this->getSrc(1))); |
| 1354 Str << "\timul" << this->getWidthString(Dest->getType()) << "\t"; |
| 1355 this->getSrc(1)->emit(Func); |
| 1356 Str << ", "; |
| 1357 this->getSrc(0)->emit(Func); |
| 1358 Str << ", "; |
| 1359 Dest->emit(Func); |
| 1360 } |
| 1361 |
| 1362 template <class Machine> |
| 1363 void InstX86ImulImm<Machine>::emitIAS(const Cfg *Func) const { |
| 1364 assert(this->getSrcSize() == 2); |
| 1365 const Variable *Dest = this->getDest(); |
| 1366 Type Ty = Dest->getType(); |
| 1367 assert(llvm::isa<Constant>(this->getSrc(1))); |
| 1368 static const typename InstX86Base<Machine>::Traits::Assembler:: |
| 1369 template ThreeOpImmEmitter< |
| 1370 typename InstX86Base<Machine>::Traits::RegisterSet::GPRRegister, |
| 1371 typename InstX86Base<Machine>::Traits::RegisterSet::GPRRegister> |
| 1372 Emitter = {&InstX86Base<Machine>::Traits::Assembler::imul, |
| 1373 &InstX86Base<Machine>::Traits::Assembler::imul}; |
| 1374 emitIASThreeOpImmOps< |
| 1375 Machine, typename InstX86Base<Machine>::Traits::RegisterSet::GPRRegister, |
| 1376 typename InstX86Base<Machine>::Traits::RegisterSet::GPRRegister, |
| 1377 InstX86Base<Machine>::Traits::RegisterSet::getEncodedGPR, |
| 1378 InstX86Base<Machine>::Traits::RegisterSet::getEncodedGPR>( |
| 1379 Func, Ty, Dest, this->getSrc(0), this->getSrc(1), Emitter); |
| 1380 } |
| 1381 |
| 1382 template <class Machine> |
1346 void InstX86Insertps<Machine>::emitIAS(const Cfg *Func) const { | 1383 void InstX86Insertps<Machine>::emitIAS(const Cfg *Func) const { |
1347 assert(this->getSrcSize() == 3); | 1384 assert(this->getSrcSize() == 3); |
1348 assert(static_cast<typename InstX86Base<Machine>::Traits::TargetLowering *>( | 1385 assert(static_cast<typename InstX86Base<Machine>::Traits::TargetLowering *>( |
1349 Func->getTarget()) | 1386 Func->getTarget()) |
1350 ->getInstructionSet() >= InstX86Base<Machine>::Traits::SSE4_1); | 1387 ->getInstructionSet() >= InstX86Base<Machine>::Traits::SSE4_1); |
1351 const Variable *Dest = this->getDest(); | 1388 const Variable *Dest = this->getDest(); |
1352 assert(Dest == this->getSrc(0)); | 1389 assert(Dest == this->getSrc(0)); |
1353 Type Ty = Dest->getType(); | 1390 Type Ty = Dest->getType(); |
1354 static const typename InstX86Base<Machine>::Traits::Assembler:: | 1391 static const typename InstX86Base<Machine>::Traits::Assembler:: |
1355 template ThreeOpImmEmitter< | 1392 template ThreeOpImmEmitter< |
(...skipping 1917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3273 return; | 3310 return; |
3274 Ostream &Str = Func->getContext()->getStrDump(); | 3311 Ostream &Str = Func->getContext()->getStrDump(); |
3275 Str << "IACA_END"; | 3312 Str << "IACA_END"; |
3276 } | 3313 } |
3277 | 3314 |
3278 } // end of namespace X86Internal | 3315 } // end of namespace X86Internal |
3279 | 3316 |
3280 } // end of namespace Ice | 3317 } // end of namespace Ice |
3281 | 3318 |
3282 #endif // SUBZERO_SRC_ICEINSTX86BASEIMPL_H | 3319 #endif // SUBZERO_SRC_ICEINSTX86BASEIMPL_H |
OLD | NEW |