| OLD | NEW |
| 1 //===- subzero/src/IceInstX8632.cpp - X86-32 instruction implementation ---===// | 1 //===- subzero/src/IceInstX8632.cpp - X86-32 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 // This file implements the InstX8632 and OperandX8632 classes, | 10 // This file implements the InstX8632 and OperandX8632 classes, |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 | 90 |
| 91 InstX8632Mul::InstX8632Mul(Cfg *Func, Variable *Dest, Variable *Source1, | 91 InstX8632Mul::InstX8632Mul(Cfg *Func, Variable *Dest, Variable *Source1, |
| 92 Operand *Source2) | 92 Operand *Source2) |
| 93 : InstX8632(Func, InstX8632::Mul, 2, Dest) { | 93 : InstX8632(Func, InstX8632::Mul, 2, Dest) { |
| 94 addSource(Source1); | 94 addSource(Source1); |
| 95 addSource(Source2); | 95 addSource(Source2); |
| 96 } | 96 } |
| 97 | 97 |
| 98 InstX8632Neg::InstX8632Neg(Cfg *Func, Operand *SrcDest) | |
| 99 : InstX8632(Func, InstX8632::Neg, 1, llvm::dyn_cast<Variable>(SrcDest)) { | |
| 100 addSource(SrcDest); | |
| 101 } | |
| 102 | |
| 103 InstX8632Shld::InstX8632Shld(Cfg *Func, Variable *Dest, Variable *Source1, | 98 InstX8632Shld::InstX8632Shld(Cfg *Func, Variable *Dest, Variable *Source1, |
| 104 Variable *Source2) | 99 Variable *Source2) |
| 105 : InstX8632(Func, InstX8632::Shld, 3, Dest) { | 100 : InstX8632(Func, InstX8632::Shld, 3, Dest) { |
| 106 addSource(Dest); | 101 addSource(Dest); |
| 107 addSource(Source1); | 102 addSource(Source1); |
| 108 addSource(Source2); | 103 addSource(Source2); |
| 109 } | 104 } |
| 110 | 105 |
| 111 InstX8632Shrd::InstX8632Shrd(Cfg *Func, Variable *Dest, Variable *Source1, | 106 InstX8632Shrd::InstX8632Shrd(Cfg *Func, Variable *Dest, Variable *Source1, |
| 112 Variable *Source2) | 107 Variable *Source2) |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 Str << "cl"; | 428 Str << "cl"; |
| 434 EmittedSrc1 = true; | 429 EmittedSrc1 = true; |
| 435 } | 430 } |
| 436 } | 431 } |
| 437 if (!EmittedSrc1) | 432 if (!EmittedSrc1) |
| 438 Inst->getSrc(1)->emit(Func); | 433 Inst->getSrc(1)->emit(Func); |
| 439 Str << "\n"; | 434 Str << "\n"; |
| 440 } | 435 } |
| 441 | 436 |
| 442 | 437 |
| 438 // In-place ops |
| 439 template <> const char *InstX8632Bswap::Opcode = "bswap"; |
| 440 template <> const char *InstX8632Neg::Opcode = "neg"; |
| 443 // Unary ops | 441 // Unary ops |
| 444 template <> const char *InstX8632Bsf::Opcode = "bsf"; | 442 template <> const char *InstX8632Bsf::Opcode = "bsf"; |
| 445 template <> const char *InstX8632Bsr::Opcode = "bsr"; | 443 template <> const char *InstX8632Bsr::Opcode = "bsr"; |
| 446 template <> const char *InstX8632Lea::Opcode = "lea"; | 444 template <> const char *InstX8632Lea::Opcode = "lea"; |
| 447 template <> const char *InstX8632Movd::Opcode = "movd"; | 445 template <> const char *InstX8632Movd::Opcode = "movd"; |
| 448 template <> const char *InstX8632Movss::Opcode = "movss"; | 446 template <> const char *InstX8632Movss::Opcode = "movss"; |
| 449 template <> const char *InstX8632Sqrtss::Opcode = "sqrtss"; | 447 template <> const char *InstX8632Sqrtss::Opcode = "sqrtss"; |
| 450 // Binary ops | 448 // Binary ops |
| 451 template <> const char *InstX8632Add::Opcode = "add"; | 449 template <> const char *InstX8632Add::Opcode = "add"; |
| 452 template <> const char *InstX8632Addps::Opcode = "addps"; | 450 template <> const char *InstX8632Addps::Opcode = "addps"; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 466 template <> const char *InstX8632Pxor::Opcode = "pxor"; | 464 template <> const char *InstX8632Pxor::Opcode = "pxor"; |
| 467 template <> const char *InstX8632Imul::Opcode = "imul"; | 465 template <> const char *InstX8632Imul::Opcode = "imul"; |
| 468 template <> const char *InstX8632Mulps::Opcode = "mulps"; | 466 template <> const char *InstX8632Mulps::Opcode = "mulps"; |
| 469 template <> const char *InstX8632Mulss::Opcode = "mulss"; | 467 template <> const char *InstX8632Mulss::Opcode = "mulss"; |
| 470 template <> const char *InstX8632Pmullw::Opcode = "pmullw"; | 468 template <> const char *InstX8632Pmullw::Opcode = "pmullw"; |
| 471 template <> const char *InstX8632Pmuludq::Opcode = "pmuludq"; | 469 template <> const char *InstX8632Pmuludq::Opcode = "pmuludq"; |
| 472 template <> const char *InstX8632Div::Opcode = "div"; | 470 template <> const char *InstX8632Div::Opcode = "div"; |
| 473 template <> const char *InstX8632Divps::Opcode = "divps"; | 471 template <> const char *InstX8632Divps::Opcode = "divps"; |
| 474 template <> const char *InstX8632Idiv::Opcode = "idiv"; | 472 template <> const char *InstX8632Idiv::Opcode = "idiv"; |
| 475 template <> const char *InstX8632Divss::Opcode = "divss"; | 473 template <> const char *InstX8632Divss::Opcode = "divss"; |
| 474 template <> const char *InstX8632Rol::Opcode = "rol"; |
| 476 template <> const char *InstX8632Shl::Opcode = "shl"; | 475 template <> const char *InstX8632Shl::Opcode = "shl"; |
| 477 template <> const char *InstX8632Psll::Opcode = "psll"; | 476 template <> const char *InstX8632Psll::Opcode = "psll"; |
| 478 template <> const char *InstX8632Shr::Opcode = "shr"; | 477 template <> const char *InstX8632Shr::Opcode = "shr"; |
| 479 template <> const char *InstX8632Sar::Opcode = "sar"; | 478 template <> const char *InstX8632Sar::Opcode = "sar"; |
| 480 template <> const char *InstX8632Psra::Opcode = "psra"; | 479 template <> const char *InstX8632Psra::Opcode = "psra"; |
| 481 template <> const char *InstX8632Pcmpeq::Opcode = "pcmpeq"; | 480 template <> const char *InstX8632Pcmpeq::Opcode = "pcmpeq"; |
| 482 template <> const char *InstX8632Pcmpgt::Opcode = "pcmpgt"; | 481 template <> const char *InstX8632Pcmpgt::Opcode = "pcmpgt"; |
| 483 // Ternary ops | 482 // Ternary ops |
| 484 template <> const char *InstX8632Shufps::Opcode = "shufps"; | 483 template <> const char *InstX8632Shufps::Opcode = "shufps"; |
| 485 template <> const char *InstX8632Pinsrw::Opcode = "pinsrw"; | 484 template <> const char *InstX8632Pinsrw::Opcode = "pinsrw"; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 Str << "\n"; | 603 Str << "\n"; |
| 605 } | 604 } |
| 606 | 605 |
| 607 void InstX8632Mul::dump(const Cfg *Func) const { | 606 void InstX8632Mul::dump(const Cfg *Func) const { |
| 608 Ostream &Str = Func->getContext()->getStrDump(); | 607 Ostream &Str = Func->getContext()->getStrDump(); |
| 609 dumpDest(Func); | 608 dumpDest(Func); |
| 610 Str << " = mul." << getDest()->getType() << " "; | 609 Str << " = mul." << getDest()->getType() << " "; |
| 611 dumpSources(Func); | 610 dumpSources(Func); |
| 612 } | 611 } |
| 613 | 612 |
| 614 void InstX8632Neg::emit(const Cfg *Func) const { | |
| 615 Ostream &Str = Func->getContext()->getStrEmit(); | |
| 616 assert(getSrcSize() == 1); | |
| 617 Str << "\tneg\t"; | |
| 618 getSrc(0)->emit(Func); | |
| 619 Str << "\n"; | |
| 620 } | |
| 621 | |
| 622 void InstX8632Neg::dump(const Cfg *Func) const { | |
| 623 Ostream &Str = Func->getContext()->getStrDump(); | |
| 624 dumpDest(Func); | |
| 625 Str << " = neg." << getDest()->getType() << " "; | |
| 626 dumpSources(Func); | |
| 627 } | |
| 628 | |
| 629 void InstX8632Shld::emit(const Cfg *Func) const { | 613 void InstX8632Shld::emit(const Cfg *Func) const { |
| 630 Ostream &Str = Func->getContext()->getStrEmit(); | 614 Ostream &Str = Func->getContext()->getStrEmit(); |
| 631 assert(getSrcSize() == 3); | 615 assert(getSrcSize() == 3); |
| 632 assert(getDest() == getSrc(0)); | 616 assert(getDest() == getSrc(0)); |
| 633 Str << "\tshld\t"; | 617 Str << "\tshld\t"; |
| 634 getDest()->emit(Func); | 618 getDest()->emit(Func); |
| 635 Str << ", "; | 619 Str << ", "; |
| 636 getSrc(1)->emit(Func); | 620 getSrc(1)->emit(Func); |
| 637 Str << ", "; | 621 Str << ", "; |
| 638 if (Variable *ShiftReg = llvm::dyn_cast<Variable>(getSrc(2))) { | 622 if (Variable *ShiftReg = llvm::dyn_cast<Variable>(getSrc(2))) { |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1382 default: | 1366 default: |
| 1383 Str << "???"; | 1367 Str << "???"; |
| 1384 break; | 1368 break; |
| 1385 } | 1369 } |
| 1386 Str << "("; | 1370 Str << "("; |
| 1387 Var->dump(Func); | 1371 Var->dump(Func); |
| 1388 Str << ")"; | 1372 Str << ")"; |
| 1389 } | 1373 } |
| 1390 | 1374 |
| 1391 } // end of namespace Ice | 1375 } // end of namespace Ice |
| OLD | NEW |