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

Side by Side Diff: src/IceInstARM32.cpp

Issue 1343783003: Subzero. Implements the scalar bitcast operations for ARM32. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Removes superfluous TODOs. Created 5 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
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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 template <> const char *InstARM32Rev::Opcode = "rev"; 396 template <> const char *InstARM32Rev::Opcode = "rev";
397 template <> const char *InstARM32Sxt::Opcode = "sxt"; // still requires b/h 397 template <> const char *InstARM32Sxt::Opcode = "sxt"; // still requires b/h
398 template <> const char *InstARM32Uxt::Opcode = "uxt"; // still requires b/h 398 template <> const char *InstARM32Uxt::Opcode = "uxt"; // still requires b/h
399 // FP 399 // FP
400 template <> const char *InstARM32Vsqrt::Opcode = "vsqrt"; 400 template <> const char *InstARM32Vsqrt::Opcode = "vsqrt";
401 // Mov-like ops 401 // Mov-like ops
402 template <> const char *InstARM32Ldr::Opcode = "ldr"; 402 template <> const char *InstARM32Ldr::Opcode = "ldr";
403 template <> const char *InstARM32Mov::Opcode = "mov"; 403 template <> const char *InstARM32Mov::Opcode = "mov";
404 // FP 404 // FP
405 template <> const char *InstARM32Vldr::Opcode = "vldr"; 405 template <> const char *InstARM32Vldr::Opcode = "vldr";
406 template <> const char *InstARM32Vmov::Opcode = "vmov";
407 // Three-addr ops 406 // Three-addr ops
408 template <> const char *InstARM32Adc::Opcode = "adc"; 407 template <> const char *InstARM32Adc::Opcode = "adc";
409 template <> const char *InstARM32Add::Opcode = "add"; 408 template <> const char *InstARM32Add::Opcode = "add";
410 template <> const char *InstARM32And::Opcode = "and"; 409 template <> const char *InstARM32And::Opcode = "and";
411 template <> const char *InstARM32Asr::Opcode = "asr"; 410 template <> const char *InstARM32Asr::Opcode = "asr";
412 template <> const char *InstARM32Bic::Opcode = "bic"; 411 template <> const char *InstARM32Bic::Opcode = "bic";
413 template <> const char *InstARM32Eor::Opcode = "eor"; 412 template <> const char *InstARM32Eor::Opcode = "eor";
414 template <> const char *InstARM32Lsl::Opcode = "lsl"; 413 template <> const char *InstARM32Lsl::Opcode = "lsl";
415 template <> const char *InstARM32Lsr::Opcode = "lsr"; 414 template <> const char *InstARM32Lsr::Opcode = "lsr";
416 template <> const char *InstARM32Mul::Opcode = "mul"; 415 template <> const char *InstARM32Mul::Opcode = "mul";
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 Str << ", "; 490 Str << ", ";
492 getSrc(0)->emit(Func); 491 getSrc(0)->emit(Func);
493 } 492 }
494 493
495 template <> void InstARM32Vldr::emitIAS(const Cfg *Func) const { 494 template <> void InstARM32Vldr::emitIAS(const Cfg *Func) const {
496 assert(getSrcSize() == 1); 495 assert(getSrcSize() == 1);
497 (void)Func; 496 (void)Func;
498 llvm_unreachable("Not yet implemented"); 497 llvm_unreachable("Not yet implemented");
499 } 498 }
500 499
501 template <> void InstARM32Vmov::emit(const Cfg *Func) const { 500 void InstARM32Vmov::emitMultiDestSingleSource(const Cfg *Func) const {
502 if (!BuildDefs::dump())
503 return;
504 assert(CondARM32::AL == getPredicate());
505 Ostream &Str = Func->getContext()->getStrEmit(); 501 Ostream &Str = Func->getContext()->getStrEmit();
506 assert(getSrcSize() == 1); 502 Variable *Dest0 = getDest();
503 Operand *Src0 = getSrc(0);
504
505 assert(Dest0->hasReg());
506 assert(Dest1->hasReg());
507 assert(llvm::dyn_cast<OperandARM32Mem>(Src0) == nullptr);
Jim Stichnoth 2015/09/14 23:15:42 nit: use !isa instead of dyn_cast
John 2015/09/16 21:07:52 Done.
508
509 Str << "\t"
510 << "vmov"
511 << "\t";
512 Dest0->emit(Func);
513 Str << ", ";
514 Dest1->emit(Func);
515 Str << ", ";
516 Src0->emit(Func);
517 }
518
519 void InstARM32Vmov::emitSingleDestMultiSource(const Cfg *Func) const {
520 Ostream &Str = Func->getContext()->getStrEmit();
521 Variable *Dest0 = getDest();
522 Operand *Src0 = getSrc(0);
523 Operand *Src1 = getSrc(1);
524
525 assert(Dest0->hasReg());
526 assert(llvm::dyn_cast<OperandARM32Mem>(Src0) == nullptr);
527 assert(llvm::dyn_cast<OperandARM32Mem>(Src1) == nullptr);
528
529 Str << "\t"
530 << "vmov"
531 << "\t";
532 Dest0->emit(Func);
533 Str << ", ";
534 Src0->emit(Func);
535 Str << ", ";
536 Src1->emit(Func);
537 }
538
539 void InstARM32Vmov::emitSingleDestSingleSource(const Cfg *Func) const {
540 Ostream &Str = Func->getContext()->getStrEmit();
Jim Stichnoth 2015/09/14 23:15:42 Use "if (!BuildDefs::dump()) return;" to ensure th
John 2015/09/16 21:07:52 I would hope that, in minimal build, the linker ge
507 Variable *Dest = getDest(); 541 Variable *Dest = getDest();
508 if (Dest->hasReg()) { 542 if (Dest->hasReg()) {
509 IceString ActualOpcode = Opcode; 543 IceString ActualOpcode = "vmov";
510 Operand *Src0 = getSrc(0); 544 Operand *Src0 = getSrc(0);
511 if (const auto *Src0V = llvm::dyn_cast<Variable>(Src0)) { 545 if (const auto *Src0V = llvm::dyn_cast<Variable>(Src0)) {
512 if (!Src0V->hasReg()) { 546 if (!Src0V->hasReg()) {
513 ActualOpcode = IceString("vldr"); 547 ActualOpcode = IceString("vldr");
514 } 548 }
515 } else { 549 } else {
516 if (llvm::isa<OperandARM32Mem>(Src0)) 550 if (llvm::isa<OperandARM32Mem>(Src0))
517 ActualOpcode = IceString("vldr"); 551 ActualOpcode = IceString("vldr");
518 } 552 }
519 Str << "\t" << ActualOpcode << "\t"; 553 Str << "\t" << ActualOpcode << "\t";
520 getDest()->emit(Func); 554 getDest()->emit(Func);
521 Str << ", "; 555 Str << ", ";
522 getSrc(0)->emit(Func); 556 getSrc(0)->emit(Func);
523 } else { 557 } else {
524 Variable *Src0 = llvm::cast<Variable>(getSrc(0)); 558 Variable *Src0 = llvm::cast<Variable>(getSrc(0));
525 assert(Src0->hasReg()); 559 assert(Src0->hasReg());
526 Str << "\t" 560 Str << "\t"
527 "vstr" 561 "vstr"
528 "\t"; 562 "\t";
529 Src0->emit(Func); 563 Src0->emit(Func);
530 Str << ", "; 564 Str << ", ";
531 Dest->emit(Func); 565 Dest->emit(Func);
532 } 566 }
533 } 567 }
534 568
535 template <> void InstARM32Vmov::emitIAS(const Cfg *Func) const { 569 void InstARM32Vmov::emit(const Cfg *Func) const {
570 if (!BuildDefs::dump())
571 return;
572 assert(CondARM32::AL == getPredicate());
573 assert(isMultiDest() + isMultiSource() <= 1 && "Invalid vmov type.");
574 if (isMultiDest()) {
575 emitMultiDestSingleSource(Func);
576 return;
577 }
578
579 if (isMultiSource()) {
580 emitSingleDestMultiSource(Func);
581 return;
582 }
583
584 emitSingleDestSingleSource(Func);
585 }
586
587 void InstARM32Vmov::emitIAS(const Cfg *Func) const {
536 assert(getSrcSize() == 1); 588 assert(getSrcSize() == 1);
537 (void)Func; 589 (void)Func;
538 llvm_unreachable("Not yet implemented"); 590 llvm_unreachable("Not yet implemented");
539 } 591 }
540 592
593 void InstARM32Vmov::dump(const Cfg *Func) const {
594 if (!BuildDefs::dump())
595 return;
596 Ostream &Str = Func->getContext()->getStrDump();
597 dumpOpcodePred(Str, "vmov", getDest()->getType());
598 Str << " ";
599 dumpDest(Func);
600 Str << ", ";
601 dumpSources(Func);
602 }
603
541 void InstARM32Br::emit(const Cfg *Func) const { 604 void InstARM32Br::emit(const Cfg *Func) const {
542 if (!BuildDefs::dump()) 605 if (!BuildDefs::dump())
543 return; 606 return;
544 Ostream &Str = Func->getContext()->getStrEmit(); 607 Ostream &Str = Func->getContext()->getStrEmit();
545 Str << "\t" 608 Str << "\t"
546 << "b" << getPredicate() << "\t"; 609 << "b" << getPredicate() << "\t";
547 if (Label) { 610 if (Label) {
548 Str << Label->getName(Func); 611 Str << Label->getName(Func);
549 } else { 612 } else {
550 if (isUnconditionalBranch()) { 613 if (isUnconditionalBranch()) {
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 if (getShiftOp() != kNoShift) { 1145 if (getShiftOp() != kNoShift) {
1083 Str << ", " << InstARM32ShiftAttributes[getShiftOp()].EmitString << " "; 1146 Str << ", " << InstARM32ShiftAttributes[getShiftOp()].EmitString << " ";
1084 if (Func) 1147 if (Func)
1085 getShiftAmt()->dump(Func); 1148 getShiftAmt()->dump(Func);
1086 else 1149 else
1087 getShiftAmt()->dump(Str); 1150 getShiftAmt()->dump(Str);
1088 } 1151 }
1089 } 1152 }
1090 1153
1091 } // end of namespace Ice 1154 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceInstARM32.h ('k') | src/IceTargetLoweringARM32.h » ('j') | src/IceTargetLoweringARM32.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698