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

Side by Side Diff: src/IceInstARM32.cpp

Issue 1540653003: Add VADD instruction to the ARM integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Clean up ARM register functions. 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') | src/IceRegistersARM32.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/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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 Inst->getSrc(1)->emit(Func); 219 Inst->getSrc(1)->emit(Func);
220 Str << ", "; 220 Str << ", ";
221 Inst->getSrc(2)->emit(Func); 221 Inst->getSrc(2)->emit(Func);
222 } 222 }
223 223
224 template <InstARM32::InstKindARM32 K> 224 template <InstARM32::InstKindARM32 K>
225 void InstARM32FourAddrGPR<K>::emitIAS(const Cfg *Func) const { 225 void InstARM32FourAddrGPR<K>::emitIAS(const Cfg *Func) const {
226 emitUsingTextFixup(Func); 226 emitUsingTextFixup(Func);
227 } 227 }
228 228
229 template <InstARM32::InstKindARM32 K>
230 void InstARM32ThreeAddrFP<K>::emitIAS(const Cfg *Func) const {
231 emitUsingTextFixup(Func);
232 }
233
229 template <> void InstARM32Mla::emitIAS(const Cfg *Func) const { 234 template <> void InstARM32Mla::emitIAS(const Cfg *Func) const {
230 assert(getSrcSize() == 3); 235 assert(getSrcSize() == 3);
231 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); 236 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>();
232 Asm->mla(getDest(), getSrc(0), getSrc(1), getSrc(2), getPredicate()); 237 Asm->mla(getDest(), getSrc(0), getSrc(1), getSrc(2), getPredicate());
233 if (Asm->needsTextFixup()) 238 if (Asm->needsTextFixup())
234 emitUsingTextFixup(Func); 239 emitUsingTextFixup(Func);
235 } 240 }
236 241
237 template <> void InstARM32Mls::emitIAS(const Cfg *Func) const { 242 template <> void InstARM32Mls::emitIAS(const Cfg *Func) const {
238 assert(getSrcSize() == 3); 243 assert(getSrcSize() == 3);
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 } 590 }
586 591
587 template <> void InstARM32Udiv::emitIAS(const Cfg *Func) const { 592 template <> void InstARM32Udiv::emitIAS(const Cfg *Func) const {
588 assert(!SetFlags); 593 assert(!SetFlags);
589 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); 594 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>();
590 Asm->udiv(getDest(), getSrc(0), getSrc(1), getPredicate()); 595 Asm->udiv(getDest(), getSrc(0), getSrc(1), getPredicate());
591 if (Asm->needsTextFixup()) 596 if (Asm->needsTextFixup())
592 emitUsingTextFixup(Func); 597 emitUsingTextFixup(Func);
593 } 598 }
594 599
600 template <> void InstARM32Vadd::emitIAS(const Cfg *Func) const {
601 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>();
602 const Variable *Dest = getDest();
603 switch (Dest->getType()) {
604 default:
605 // TODO(kschimpf) Figure if more cases are needed.
606 Asm->setNeedsTextFixup();
607 break;
608 case IceType_f32:
609 Asm->vadds(getDest(), getSrc(0), getSrc(1), CondARM32::AL);
610 break;
611 case IceType_f64:
612 Asm->vaddd(getDest(), getSrc(0), getSrc(1), CondARM32::AL);
613 break;
614 }
615 if (Asm->needsTextFixup())
616 emitUsingTextFixup(Func);
617 }
618
595 InstARM32Call::InstARM32Call(Cfg *Func, Variable *Dest, Operand *CallTarget) 619 InstARM32Call::InstARM32Call(Cfg *Func, Variable *Dest, Operand *CallTarget)
596 : InstARM32(Func, InstARM32::Call, 1, Dest) { 620 : InstARM32(Func, InstARM32::Call, 1, Dest) {
597 HasSideEffects = true; 621 HasSideEffects = true;
598 addSource(CallTarget); 622 addSource(CallTarget);
599 } 623 }
600 624
601 InstARM32Label::InstARM32Label(Cfg *Func, TargetARM32 *Target) 625 InstARM32Label::InstARM32Label(Cfg *Func, TargetARM32 *Target)
602 : InstARM32(Func, InstARM32::Label, 0, nullptr), 626 : InstARM32(Func, InstARM32::Label, 0, nullptr),
603 Number(Target->makeNextLabelNumber()) {} 627 Number(Target->makeNextLabelNumber()) {}
604 628
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 1421
1398 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); 1422 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>();
1399 const auto *Reg = llvm::cast<Variable>(Dests[0]); 1423 const auto *Reg = llvm::cast<Variable>(Dests[0]);
1400 if (isScalarIntegerType(Reg->getType())) { 1424 if (isScalarIntegerType(Reg->getType())) {
1401 // Pop GPR registers. 1425 // Pop GPR registers.
1402 SizeT IntegerCount = 0; 1426 SizeT IntegerCount = 0;
1403 ARM32::IValueT GPRegisters = 0; 1427 ARM32::IValueT GPRegisters = 0;
1404 const Variable *LastDest = nullptr; 1428 const Variable *LastDest = nullptr;
1405 for (const Variable *Var : Dests) { 1429 for (const Variable *Var : Dests) {
1406 assert(Var->hasReg() && "pop only applies to registers"); 1430 assert(Var->hasReg() && "pop only applies to registers");
1407 int32_t Reg = RegARM32::getEncodedGPR(Var->getRegNum()); 1431 int32_t Reg = RegARM32::getEncodedGPReg(Var->getRegNum());
1408 LastDest = Var; 1432 LastDest = Var;
1409 GPRegisters |= (1 << Reg); 1433 GPRegisters |= (1 << Reg);
1410 ++IntegerCount; 1434 ++IntegerCount;
1411 } 1435 }
1412 switch (IntegerCount) { 1436 switch (IntegerCount) {
1413 case 0: 1437 case 0:
1414 return; 1438 return;
1415 case 1: 1439 case 1:
1416 // Note: Can only apply pop register if single register is not sp. 1440 // Note: Can only apply pop register if single register is not sp.
1417 assert((RegARM32::Encoded_Reg_sp != LastDest->getRegNum()) && 1441 assert((RegARM32::Encoded_Reg_sp != LastDest->getRegNum()) &&
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1529 1553
1530 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); 1554 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>();
1531 const auto *Reg = llvm::cast<Variable>(getSrc(0)); 1555 const auto *Reg = llvm::cast<Variable>(getSrc(0));
1532 if (isScalarIntegerType(Reg->getType())) { 1556 if (isScalarIntegerType(Reg->getType())) {
1533 // Push GPR registers. 1557 // Push GPR registers.
1534 SizeT IntegerCount = 0; 1558 SizeT IntegerCount = 0;
1535 ARM32::IValueT GPRegisters = 0; 1559 ARM32::IValueT GPRegisters = 0;
1536 const Variable *LastSrc = nullptr; 1560 const Variable *LastSrc = nullptr;
1537 for (SizeT Index = 0; Index < getSrcSize(); ++Index) { 1561 for (SizeT Index = 0; Index < getSrcSize(); ++Index) {
1538 const auto *Var = llvm::cast<Variable>(getSrc(Index)); 1562 const auto *Var = llvm::cast<Variable>(getSrc(Index));
1539 int32_t Reg = RegARM32::getEncodedGPR(Var->getRegNum()); 1563 int32_t Reg = RegARM32::getEncodedGPReg(Var->getRegNum());
1540 assert(Reg != RegARM32::Encoded_Not_GPR); 1564 assert(Reg != RegARM32::Encoded_Not_GPR);
1541 LastSrc = Var; 1565 LastSrc = Var;
1542 GPRegisters |= (1 << Reg); 1566 GPRegisters |= (1 << Reg);
1543 ++IntegerCount; 1567 ++IntegerCount;
1544 } 1568 }
1545 switch (IntegerCount) { 1569 switch (IntegerCount) {
1546 case 0: 1570 case 0:
1547 return; 1571 return;
1548 case 1: { 1572 case 1: {
1549 // Note: Can only apply push register if single register is not sp. 1573 // Note: Can only apply push register if single register is not sp.
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
2147 2171
2148 template class InstARM32FourAddrGPR<InstARM32::Mla>; 2172 template class InstARM32FourAddrGPR<InstARM32::Mla>;
2149 template class InstARM32FourAddrGPR<InstARM32::Mls>; 2173 template class InstARM32FourAddrGPR<InstARM32::Mls>;
2150 2174
2151 template class InstARM32CmpLike<InstARM32::Cmn>; 2175 template class InstARM32CmpLike<InstARM32::Cmn>;
2152 template class InstARM32CmpLike<InstARM32::Cmp>; 2176 template class InstARM32CmpLike<InstARM32::Cmp>;
2153 template class InstARM32CmpLike<InstARM32::Tst>; 2177 template class InstARM32CmpLike<InstARM32::Tst>;
2154 2178
2155 } // end of namespace ARM32 2179 } // end of namespace ARM32
2156 } // end of namespace Ice 2180 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceInstARM32.h ('k') | src/IceRegistersARM32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698