Chromium Code Reviews| 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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 446 if (ShiftReg && ShiftReg->getRegNum() == TargetX8632::Reg_ecx) { | 446 if (ShiftReg && ShiftReg->getRegNum() == TargetX8632::Reg_ecx) { |
| 447 Str << "cl"; | 447 Str << "cl"; |
| 448 EmittedSrc1 = true; | 448 EmittedSrc1 = true; |
| 449 } | 449 } |
| 450 } | 450 } |
| 451 if (!EmittedSrc1) | 451 if (!EmittedSrc1) |
| 452 Inst->getSrc(1)->emit(Func); | 452 Inst->getSrc(1)->emit(Func); |
| 453 Str << "\n"; | 453 Str << "\n"; |
| 454 } | 454 } |
| 455 | 455 |
| 456 | |
| 457 // In-place ops | 456 // In-place ops |
| 458 template <> const char *InstX8632Bswap::Opcode = "bswap"; | 457 template <> const char *InstX8632Bswap::Opcode = "bswap"; |
| 459 template <> const char *InstX8632Neg::Opcode = "neg"; | 458 template <> const char *InstX8632Neg::Opcode = "neg"; |
| 460 // Unary ops | 459 // Unary ops |
| 461 template <> const char *InstX8632Bsf::Opcode = "bsf"; | 460 template <> const char *InstX8632Bsf::Opcode = "bsf"; |
| 462 template <> const char *InstX8632Bsr::Opcode = "bsr"; | 461 template <> const char *InstX8632Bsr::Opcode = "bsr"; |
| 463 template <> const char *InstX8632Lea::Opcode = "lea"; | 462 template <> const char *InstX8632Lea::Opcode = "lea"; |
| 464 template <> const char *InstX8632Movd::Opcode = "movd"; | 463 template <> const char *InstX8632Movd::Opcode = "movd"; |
| 465 template <> const char *InstX8632Sqrtss::Opcode = "sqrtss"; | 464 template <> const char *InstX8632Sqrtss::Opcode = "sqrtss"; |
| 466 // Binary ops | 465 // Binary ops |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 477 template <> const char *InstX8632And::Opcode = "and"; | 476 template <> const char *InstX8632And::Opcode = "and"; |
| 478 template <> const char *InstX8632Pand::Opcode = "pand"; | 477 template <> const char *InstX8632Pand::Opcode = "pand"; |
| 479 template <> const char *InstX8632Pandn::Opcode = "pandn"; | 478 template <> const char *InstX8632Pandn::Opcode = "pandn"; |
| 480 template <> const char *InstX8632Or::Opcode = "or"; | 479 template <> const char *InstX8632Or::Opcode = "or"; |
| 481 template <> const char *InstX8632Por::Opcode = "por"; | 480 template <> const char *InstX8632Por::Opcode = "por"; |
| 482 template <> const char *InstX8632Xor::Opcode = "xor"; | 481 template <> const char *InstX8632Xor::Opcode = "xor"; |
| 483 template <> const char *InstX8632Pxor::Opcode = "pxor"; | 482 template <> const char *InstX8632Pxor::Opcode = "pxor"; |
| 484 template <> const char *InstX8632Imul::Opcode = "imul"; | 483 template <> const char *InstX8632Imul::Opcode = "imul"; |
| 485 template <> const char *InstX8632Mulps::Opcode = "mulps"; | 484 template <> const char *InstX8632Mulps::Opcode = "mulps"; |
| 486 template <> const char *InstX8632Mulss::Opcode = "mulss"; | 485 template <> const char *InstX8632Mulss::Opcode = "mulss"; |
| 487 template <> const char *InstX8632Pmullw::Opcode = "pmullw"; | 486 template <> const char *InstX8632Pmull::Opcode = "pmull"; |
| 488 template <> const char *InstX8632Pmuludq::Opcode = "pmuludq"; | 487 template <> const char *InstX8632Pmuludq::Opcode = "pmuludq"; |
| 489 template <> const char *InstX8632Div::Opcode = "div"; | 488 template <> const char *InstX8632Div::Opcode = "div"; |
| 490 template <> const char *InstX8632Divps::Opcode = "divps"; | 489 template <> const char *InstX8632Divps::Opcode = "divps"; |
| 491 template <> const char *InstX8632Idiv::Opcode = "idiv"; | 490 template <> const char *InstX8632Idiv::Opcode = "idiv"; |
| 492 template <> const char *InstX8632Divss::Opcode = "divss"; | 491 template <> const char *InstX8632Divss::Opcode = "divss"; |
| 493 template <> const char *InstX8632Rol::Opcode = "rol"; | 492 template <> const char *InstX8632Rol::Opcode = "rol"; |
| 494 template <> const char *InstX8632Shl::Opcode = "shl"; | 493 template <> const char *InstX8632Shl::Opcode = "shl"; |
| 495 template <> const char *InstX8632Psll::Opcode = "psll"; | 494 template <> const char *InstX8632Psll::Opcode = "psll"; |
| 496 template <> const char *InstX8632Shr::Opcode = "shr"; | 495 template <> const char *InstX8632Shr::Opcode = "shr"; |
| 497 template <> const char *InstX8632Sar::Opcode = "sar"; | 496 template <> const char *InstX8632Sar::Opcode = "sar"; |
| 498 template <> const char *InstX8632Psra::Opcode = "psra"; | 497 template <> const char *InstX8632Psra::Opcode = "psra"; |
| 499 template <> const char *InstX8632Pcmpeq::Opcode = "pcmpeq"; | 498 template <> const char *InstX8632Pcmpeq::Opcode = "pcmpeq"; |
| 500 template <> const char *InstX8632Pcmpgt::Opcode = "pcmpgt"; | 499 template <> const char *InstX8632Pcmpgt::Opcode = "pcmpgt"; |
| 501 template <> const char *InstX8632Movss::Opcode = "movss"; | 500 template <> const char *InstX8632Movss::Opcode = "movss"; |
| 502 // Ternary ops | 501 // Ternary ops |
| 502 template <> const char *InstX8632Insertps::Opcode = "insertps"; | |
| 503 template <> const char *InstX8632Shufps::Opcode = "shufps"; | 503 template <> const char *InstX8632Shufps::Opcode = "shufps"; |
| 504 template <> const char *InstX8632Pinsrw::Opcode = "pinsrw"; | 504 template <> const char *InstX8632Pinsr::Opcode = "pinsr"; |
| 505 template <> const char *InstX8632Blendvps::Opcode = "blendvps"; | |
| 506 template <> const char *InstX8632Pblendvb::Opcode = "pblendvb"; | |
| 505 // Three address ops | 507 // Three address ops |
| 506 template <> const char *InstX8632Pextrw::Opcode = "pextrw"; | 508 template <> const char *InstX8632Pextr::Opcode = "pextr"; |
| 507 template <> const char *InstX8632Pshufd::Opcode = "pshufd"; | 509 template <> const char *InstX8632Pshufd::Opcode = "pshufd"; |
| 508 | 510 |
| 509 template <> void InstX8632Sqrtss::emit(const Cfg *Func) const { | 511 template <> void InstX8632Sqrtss::emit(const Cfg *Func) const { |
| 510 Ostream &Str = Func->getContext()->getStrEmit(); | 512 Ostream &Str = Func->getContext()->getStrEmit(); |
| 511 assert(getSrcSize() == 1); | 513 assert(getSrcSize() == 1); |
| 512 Type Ty = getSrc(0)->getType(); | 514 Type Ty = getSrc(0)->getType(); |
| 513 assert(Ty == IceType_f32 || Ty == IceType_f64); | 515 assert(Ty == IceType_f32 || Ty == IceType_f64); |
| 514 Str << "\tsqrt" << TypeX8632Attributes[Ty].SdSsString << "\t"; | 516 Str << "\tsqrt" << TypeX8632Attributes[Ty].SdSsString << "\t"; |
| 515 getDest()->emit(Func); | 517 getDest()->emit(Func); |
| 516 Str << ", "; | 518 Str << ", "; |
| 517 getSrc(0)->emit(Func); | 519 getSrc(0)->emit(Func); |
| 518 Str << "\n"; | 520 Str << "\n"; |
| 519 } | 521 } |
| 520 | 522 |
| 521 template <> void InstX8632Addss::emit(const Cfg *Func) const { | 523 template <> void InstX8632Addss::emit(const Cfg *Func) const { |
| 522 char buf[30]; | 524 char buf[30]; |
| 523 snprintf(buf, llvm::array_lengthof(buf), "add%s", | 525 snprintf(buf, llvm::array_lengthof(buf), "add%s", |
| 524 TypeX8632Attributes[getDest()->getType()].SdSsString); | 526 TypeX8632Attributes[getDest()->getType()].SdSsString); |
| 525 emitTwoAddress(buf, this, Func); | 527 emitTwoAddress(buf, this, Func); |
| 526 } | 528 } |
| 527 | 529 |
| 528 template <> void InstX8632Padd::emit(const Cfg *Func) const { | 530 template <> void InstX8632Padd::emit(const Cfg *Func) const { |
| 529 char buf[30]; | 531 char buf[30]; |
| 530 snprintf(buf, llvm::array_lengthof(buf), "padd%s", | 532 snprintf(buf, llvm::array_lengthof(buf), "padd%s", |
| 531 TypeX8632Attributes[getDest()->getType()].PackString); | 533 TypeX8632Attributes[getDest()->getType()].PackString); |
| 532 emitTwoAddress(buf, this, Func); | 534 emitTwoAddress(buf, this, Func); |
| 533 } | 535 } |
| 534 | 536 |
| 537 template <> void InstX8632Pmull::emit(const Cfg *Func) const { | |
| 538 char buf[30]; | |
| 539 assert(getDest()->getType() == IceType_v4i32 || | |
|
Jim Stichnoth
2014/07/29 23:01:16
It would be nice if the asserts here and in lowerA
wala
2014/07/30 00:11:24
I'm not sure what you mean by this. I don't see an
Jim Stichnoth
2014/07/30 02:58:56
I'm talking about lines 1244-1245 of IceTargetLowe
wala
2014/07/30 18:11:55
Done.
Thanks for the explanation.
| |
| 540 getDest()->getType() == IceType_v8i16); | |
| 541 // pmulld requires SSE4.1. | |
| 542 assert(getDest()->getType() != IceType_v4i32 || | |
| 543 static_cast<TargetX8632 *>(Func->getTarget())->getInstructionSet() | |
| 544 >= TargetX8632::SSE4_1); | |
| 545 snprintf(buf, llvm::array_lengthof(buf), "pmull%s", | |
| 546 TypeX8632Attributes[getDest()->getType()].PackString); | |
| 547 emitTwoAddress(buf, this, Func); | |
| 548 } | |
| 549 | |
| 535 template <> void InstX8632Subss::emit(const Cfg *Func) const { | 550 template <> void InstX8632Subss::emit(const Cfg *Func) const { |
| 536 char buf[30]; | 551 char buf[30]; |
| 537 snprintf(buf, llvm::array_lengthof(buf), "sub%s", | 552 snprintf(buf, llvm::array_lengthof(buf), "sub%s", |
| 538 TypeX8632Attributes[getDest()->getType()].SdSsString); | 553 TypeX8632Attributes[getDest()->getType()].SdSsString); |
| 539 emitTwoAddress(buf, this, Func); | 554 emitTwoAddress(buf, this, Func); |
| 540 } | 555 } |
| 541 | 556 |
| 542 template <> void InstX8632Psub::emit(const Cfg *Func) const { | 557 template <> void InstX8632Psub::emit(const Cfg *Func) const { |
| 543 char buf[30]; | 558 char buf[30]; |
| 544 snprintf(buf, llvm::array_lengthof(buf), "psub%s", | 559 snprintf(buf, llvm::array_lengthof(buf), "psub%s", |
| 545 TypeX8632Attributes[getDest()->getType()].PackString); | 560 TypeX8632Attributes[getDest()->getType()].PackString); |
| 546 emitTwoAddress(buf, this, Func); | 561 emitTwoAddress(buf, this, Func); |
| 547 } | 562 } |
| 548 | 563 |
| 549 template <> void InstX8632Mulss::emit(const Cfg *Func) const { | 564 template <> void InstX8632Mulss::emit(const Cfg *Func) const { |
| 550 char buf[30]; | 565 char buf[30]; |
| 551 snprintf(buf, llvm::array_lengthof(buf), "mul%s", | 566 snprintf(buf, llvm::array_lengthof(buf), "mul%s", |
| 552 TypeX8632Attributes[getDest()->getType()].SdSsString); | 567 TypeX8632Attributes[getDest()->getType()].SdSsString); |
| 553 emitTwoAddress(buf, this, Func); | 568 emitTwoAddress(buf, this, Func); |
| 554 } | 569 } |
| 555 | 570 |
| 556 template <> void InstX8632Pmullw::emit(const Cfg *Func) const { | |
| 557 assert(getSrc(0)->getType() == IceType_v8i16 && | |
| 558 getSrc(1)->getType() == IceType_v8i16); | |
| 559 emitTwoAddress(Opcode, this, Func); | |
| 560 } | |
| 561 | |
| 562 template <> void InstX8632Pmuludq::emit(const Cfg *Func) const { | 571 template <> void InstX8632Pmuludq::emit(const Cfg *Func) const { |
| 563 assert(getSrc(0)->getType() == IceType_v4i32 && | 572 assert(getSrc(0)->getType() == IceType_v4i32 && |
| 564 getSrc(1)->getType() == IceType_v4i32); | 573 getSrc(1)->getType() == IceType_v4i32); |
| 565 emitTwoAddress(Opcode, this, Func); | 574 emitTwoAddress(Opcode, this, Func); |
| 566 } | 575 } |
| 567 | 576 |
| 568 template <> void InstX8632Divss::emit(const Cfg *Func) const { | 577 template <> void InstX8632Divss::emit(const Cfg *Func) const { |
| 569 char buf[30]; | 578 char buf[30]; |
| 570 snprintf(buf, llvm::array_lengthof(buf), "div%s", | 579 snprintf(buf, llvm::array_lengthof(buf), "div%s", |
| 571 TypeX8632Attributes[getDest()->getType()].SdSsString); | 580 TypeX8632Attributes[getDest()->getType()].SdSsString); |
| 572 emitTwoAddress(buf, this, Func); | 581 emitTwoAddress(buf, this, Func); |
| 573 } | 582 } |
| 574 | 583 |
| 575 template <> void InstX8632Div::emit(const Cfg *Func) const { | 584 template <> void InstX8632Div::emit(const Cfg *Func) const { |
| 576 Ostream &Str = Func->getContext()->getStrEmit(); | 585 Ostream &Str = Func->getContext()->getStrEmit(); |
| 577 assert(getSrcSize() == 3); | 586 assert(getSrcSize() == 3); |
| 578 Str << "\t" << Opcode << "\t"; | 587 Str << "\t" << Opcode << "\t"; |
| 579 getSrc(1)->emit(Func); | 588 getSrc(1)->emit(Func); |
| 580 Str << "\n"; | 589 Str << "\n"; |
| 581 } | 590 } |
| 582 | 591 |
| 583 template <> void InstX8632Idiv::emit(const Cfg *Func) const { | 592 template <> void InstX8632Idiv::emit(const Cfg *Func) const { |
| 584 Ostream &Str = Func->getContext()->getStrEmit(); | 593 Ostream &Str = Func->getContext()->getStrEmit(); |
| 585 assert(getSrcSize() == 3); | 594 assert(getSrcSize() == 3); |
| 586 Str << "\t" << Opcode << "\t"; | 595 Str << "\t" << Opcode << "\t"; |
| 587 getSrc(1)->emit(Func); | 596 getSrc(1)->emit(Func); |
| 588 Str << "\n"; | 597 Str << "\n"; |
| 589 } | 598 } |
| 590 | 599 |
| 600 | |
| 601 namespace { | |
| 602 | |
| 603 // pblendvb and blendvps take xmm0 as a final implicit argument. | |
| 604 void emitVariableBlendInst(const char *Opcode, const Inst *Inst, | |
| 605 const Cfg *Func) { | |
| 606 Ostream &Str = Func->getContext()->getStrEmit(); | |
| 607 assert(Inst->getSrcSize() == 3); | |
| 608 assert(llvm::isa<Variable>(Inst->getSrc(2))); | |
| 609 assert(llvm::cast<Variable>(Inst->getSrc(2))->getRegNum() == | |
| 610 TargetX8632::Reg_xmm0); | |
| 611 Str << "\t" << Opcode << "\t"; | |
| 612 Inst->getDest()->emit(Func); | |
| 613 Str << ", "; | |
| 614 Inst->getSrc(1)->emit(Func); | |
| 615 Str << "\n"; | |
| 616 } | |
| 617 | |
| 618 } // end anonymous namespace | |
| 619 | |
| 620 template <> void InstX8632Blendvps::emit(const Cfg *Func) const { | |
| 621 assert(static_cast<TargetX8632 *>(Func->getTarget())->getInstructionSet() >= | |
| 622 TargetX8632::SSE4_1); | |
| 623 emitVariableBlendInst(Opcode, this, Func); | |
| 624 } | |
| 625 | |
| 626 template <> void InstX8632Pblendvb::emit(const Cfg *Func) const { | |
| 627 assert(static_cast<TargetX8632 *>(Func->getTarget())->getInstructionSet() >= | |
| 628 TargetX8632::SSE4_1); | |
| 629 emitVariableBlendInst(Opcode, this, Func); | |
| 630 } | |
| 631 | |
| 591 template <> void InstX8632Imul::emit(const Cfg *Func) const { | 632 template <> void InstX8632Imul::emit(const Cfg *Func) const { |
| 592 Ostream &Str = Func->getContext()->getStrEmit(); | 633 Ostream &Str = Func->getContext()->getStrEmit(); |
| 593 assert(getSrcSize() == 2); | 634 assert(getSrcSize() == 2); |
| 594 if (getDest()->getType() == IceType_i8) { | 635 if (getDest()->getType() == IceType_i8) { |
| 595 // The 8-bit version of imul only allows the form "imul r/m8". | 636 // The 8-bit version of imul only allows the form "imul r/m8". |
| 596 Variable *Src0 = llvm::dyn_cast<Variable>(getSrc(0)); | 637 Variable *Src0 = llvm::dyn_cast<Variable>(getSrc(0)); |
| 597 assert(Src0 && Src0->getRegNum() == TargetX8632::Reg_eax); | 638 assert(Src0 && Src0->getRegNum() == TargetX8632::Reg_eax); |
| 598 Str << "\timul\t"; | 639 Str << "\timul\t"; |
| 599 getSrc(1)->emit(Func); | 640 getSrc(1)->emit(Func); |
| 600 Str << "\n"; | 641 Str << "\n"; |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1120 emitTwoAddress(buf, this, Func); | 1161 emitTwoAddress(buf, this, Func); |
| 1121 } | 1162 } |
| 1122 | 1163 |
| 1123 template <> void InstX8632Pcmpgt::emit(const Cfg *Func) const { | 1164 template <> void InstX8632Pcmpgt::emit(const Cfg *Func) const { |
| 1124 char buf[30]; | 1165 char buf[30]; |
| 1125 snprintf(buf, llvm::array_lengthof(buf), "pcmpgt%s", | 1166 snprintf(buf, llvm::array_lengthof(buf), "pcmpgt%s", |
| 1126 TypeX8632Attributes[getDest()->getType()].PackString); | 1167 TypeX8632Attributes[getDest()->getType()].PackString); |
| 1127 emitTwoAddress(buf, this, Func); | 1168 emitTwoAddress(buf, this, Func); |
| 1128 } | 1169 } |
| 1129 | 1170 |
| 1130 template <> void InstX8632Pextrw::emit(const Cfg *Func) const { | 1171 template <> void InstX8632Pextr::emit(const Cfg *Func) const { |
| 1131 Ostream &Str = Func->getContext()->getStrEmit(); | 1172 Ostream &Str = Func->getContext()->getStrEmit(); |
| 1132 assert(getSrcSize() == 2); | 1173 assert(getSrcSize() == 2); |
| 1133 Str << "\t" << Opcode << "\t"; | 1174 // pextrb and pextrd are SSE4.1 instructions. |
| 1175 assert(getSrc(0)->getType() == IceType_v8i16 || | |
|
Jim Stichnoth
2014/07/29 23:01:16
Same comment about syntactically equivalent assert
wala
2014/07/30 00:11:24
See reply above.
wala
2014/07/30 18:11:55
Done.
| |
| 1176 getSrc(0)->getType() == IceType_v8i1 || | |
| 1177 static_cast<TargetX8632 *>(Func->getTarget())->getInstructionSet() | |
| 1178 >= TargetX8632::SSE4_1); | |
| 1179 Str << "\t" << Opcode | |
| 1180 << TypeX8632Attributes[getSrc(0)->getType()].PackString << "\t"; | |
| 1134 Variable *Dest = getDest(); | 1181 Variable *Dest = getDest(); |
| 1135 assert(Dest->hasReg() && Dest->getType() == IceType_i16); | 1182 // pextrw must take a register dest. |
| 1136 // pextrw takes r32 dest. | 1183 assert(Dest->getType() != IceType_i16 || Dest->hasReg()); |
| 1137 Dest->asType(IceType_i32).emit(Func); | 1184 Dest->asType(IceType_i32).emit(Func); |
| 1138 Str << ", "; | 1185 Str << ", "; |
| 1139 getSrc(0)->emit(Func); | 1186 getSrc(0)->emit(Func); |
| 1140 Str << ", "; | 1187 Str << ", "; |
| 1141 getSrc(1)->emit(Func); | 1188 getSrc(1)->emit(Func); |
| 1142 Str << "\n"; | 1189 Str << "\n"; |
| 1143 } | 1190 } |
| 1144 | 1191 |
| 1145 template <> void InstX8632Pinsrw::emit(const Cfg *Func) const { | 1192 template <> void InstX8632Pinsr::emit(const Cfg *Func) const { |
| 1146 Ostream &Str = Func->getContext()->getStrEmit(); | 1193 Ostream &Str = Func->getContext()->getStrEmit(); |
| 1147 assert(getSrcSize() == 3); | 1194 assert(getSrcSize() == 3); |
| 1148 Str << "\t" << Opcode << "\t"; | 1195 // pinsrb and pinsrd are SSE4.1 instructions. |
| 1196 assert(getDest()->getType() == IceType_v8i16 || | |
| 1197 getDest()->getType() == IceType_v8i1 || | |
| 1198 static_cast<TargetX8632 *>(Func->getTarget())->getInstructionSet() | |
| 1199 >= TargetX8632::SSE4_1); | |
| 1200 Str << "\t" << Opcode | |
| 1201 << TypeX8632Attributes[getDest()->getType()].PackString << "\t"; | |
| 1149 getDest()->emit(Func); | 1202 getDest()->emit(Func); |
| 1150 Str << ", "; | 1203 Str << ", "; |
| 1151 Operand *Src1 = getSrc(1); | 1204 Operand *Src1 = getSrc(1); |
| 1152 if (Variable *VSrc1 = llvm::dyn_cast<Variable>(Src1)) { | 1205 if (Variable *VSrc1 = llvm::dyn_cast<Variable>(Src1)) { |
| 1153 // If src1 is a register, it should be r32. | 1206 // If src1 is a register, it should always be r32. |
| 1154 VSrc1->asType(VSrc1->hasReg() ? IceType_i32 : IceType_i16).emit(Func); | 1207 if (VSrc1->hasReg()) { |
| 1208 VSrc1->asType(IceType_i32).emit(Func); | |
| 1209 } else { | |
| 1210 VSrc1->emit(Func); | |
| 1211 } | |
| 1155 } else { | 1212 } else { |
| 1156 Src1->emit(Func); | 1213 Src1->emit(Func); |
| 1157 } | 1214 } |
| 1158 Str << ", "; | 1215 Str << ", "; |
| 1159 getSrc(2)->emit(Func); | 1216 getSrc(2)->emit(Func); |
| 1160 Str << "\n"; | 1217 Str << "\n"; |
| 1161 } | 1218 } |
| 1162 | 1219 |
| 1163 void InstX8632Pop::emit(const Cfg *Func) const { | 1220 void InstX8632Pop::emit(const Cfg *Func) const { |
| 1164 Ostream &Str = Func->getContext()->getStrEmit(); | 1221 Ostream &Str = Func->getContext()->getStrEmit(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1209 } | 1266 } |
| 1210 | 1267 |
| 1211 void InstX8632Push::dump(const Cfg *Func) const { | 1268 void InstX8632Push::dump(const Cfg *Func) const { |
| 1212 Ostream &Str = Func->getContext()->getStrDump(); | 1269 Ostream &Str = Func->getContext()->getStrDump(); |
| 1213 Str << "push." << getSrc(0)->getType() << " "; | 1270 Str << "push." << getSrc(0)->getType() << " "; |
| 1214 dumpSources(Func); | 1271 dumpSources(Func); |
| 1215 } | 1272 } |
| 1216 | 1273 |
| 1217 template <> void InstX8632Psll::emit(const Cfg *Func) const { | 1274 template <> void InstX8632Psll::emit(const Cfg *Func) const { |
| 1218 assert(getDest()->getType() == IceType_v8i16 || | 1275 assert(getDest()->getType() == IceType_v8i16 || |
| 1219 getDest()->getType() == IceType_v4i32); | 1276 getDest()->getType() == IceType_v8i1 || |
| 1277 getDest()->getType() == IceType_v4i32 || | |
| 1278 getDest()->getType() == IceType_v4i1); | |
| 1220 char buf[30]; | 1279 char buf[30]; |
| 1221 snprintf(buf, llvm::array_lengthof(buf), "psll%s", | 1280 snprintf(buf, llvm::array_lengthof(buf), "psll%s", |
| 1222 TypeX8632Attributes[getDest()->getType()].PackString); | 1281 TypeX8632Attributes[getDest()->getType()].PackString); |
| 1223 emitTwoAddress(buf, this, Func); | 1282 emitTwoAddress(buf, this, Func); |
| 1224 } | 1283 } |
| 1225 | 1284 |
| 1226 template <> void InstX8632Psra::emit(const Cfg *Func) const { | 1285 template <> void InstX8632Psra::emit(const Cfg *Func) const { |
| 1227 assert(getDest()->getType() == IceType_v8i16 || | 1286 assert(getDest()->getType() == IceType_v8i16 || |
| 1228 getDest()->getType() == IceType_v4i32); | 1287 getDest()->getType() == IceType_v8i1 || |
| 1288 getDest()->getType() == IceType_v4i32 || | |
| 1289 getDest()->getType() == IceType_v4i1); | |
| 1229 char buf[30]; | 1290 char buf[30]; |
| 1230 snprintf(buf, llvm::array_lengthof(buf), "psra%s", | 1291 snprintf(buf, llvm::array_lengthof(buf), "psra%s", |
| 1231 TypeX8632Attributes[getDest()->getType()].PackString); | 1292 TypeX8632Attributes[getDest()->getType()].PackString); |
| 1232 emitTwoAddress(buf, this, Func); | 1293 emitTwoAddress(buf, this, Func); |
| 1233 } | 1294 } |
| 1234 | 1295 |
| 1235 void InstX8632Ret::emit(const Cfg *Func) const { | 1296 void InstX8632Ret::emit(const Cfg *Func) const { |
| 1236 Ostream &Str = Func->getContext()->getStrEmit(); | 1297 Ostream &Str = Func->getContext()->getStrEmit(); |
| 1237 Str << "\tret\n"; | 1298 Str << "\tret\n"; |
| 1238 } | 1299 } |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1408 default: | 1469 default: |
| 1409 Str << "???"; | 1470 Str << "???"; |
| 1410 break; | 1471 break; |
| 1411 } | 1472 } |
| 1412 Str << "("; | 1473 Str << "("; |
| 1413 Var->dump(Func); | 1474 Var->dump(Func); |
| 1414 Str << ")"; | 1475 Str << ")"; |
| 1415 } | 1476 } |
| 1416 | 1477 |
| 1417 } // end of namespace Ice | 1478 } // end of namespace Ice |
| OLD | NEW |