Chromium Code Reviews| Index: src/IceInstX8632.cpp |
| diff --git a/src/IceInstX8632.cpp b/src/IceInstX8632.cpp |
| index cc082d952cd53ea9e9d6afc3fdebeb9700a26176..1741f473ad38ecccb96df0570027b159f529b166 100644 |
| --- a/src/IceInstX8632.cpp |
| +++ b/src/IceInstX8632.cpp |
| @@ -470,6 +470,13 @@ template <> const char *InstX8632Sar::Opcode = "sar"; |
| template <> const char *InstX8632Psra::Opcode = "psra"; |
| template <> const char *InstX8632Pcmpeq::Opcode = "pcmpeq"; |
| template <> const char *InstX8632Pcmpgt::Opcode = "pcmpgt"; |
| +template <> const char *InstX8632Pextrw::Opcode = "pextrw"; |
| +template <> const char *InstX8632Pinsrw::Opcode = "pinsrw"; |
| +template <> const char *InstX8632Shufps::Opcode = "shufps"; |
| +template <> const char *InstX8632Pshufd::Opcode = "pshufd"; |
| +template <> const char *InstX8632Lea::Opcode = "lea"; |
|
jvoung (off chromium)
2014/07/17 19:36:38
Cluster lea, and movd w/ the other unary ops?
Cou
wala
2014/07/17 22:14:12
Done.
|
| +template <> const char *InstX8632Movd::Opcode = "movd"; |
| +template <> const char *InstX8632Movss::Opcode = "movss"; |
| template <> void InstX8632Sqrtss::emit(const Cfg *Func) const { |
| Ostream &Str = Func->getContext()->getStrEmit(); |
| @@ -511,6 +518,22 @@ template <> void InstX8632Divss::emit(const Cfg *Func) const { |
| emitTwoAddress(buf, this, Func); |
| } |
| +template <> void InstX8632Div::emit(const Cfg *Func) const { |
| + Ostream &Str = Func->getContext()->getStrEmit(); |
| + assert(getSrcSize() == 3); |
| + Str << "\t" << Opcode << "\t"; |
| + getSrc(1)->emit(Func); |
| + Str << "\n"; |
| +} |
| + |
| +template <> void InstX8632Idiv::emit(const Cfg *Func) const { |
| + Ostream &Str = Func->getContext()->getStrEmit(); |
| + assert(getSrcSize() == 3); |
| + Str << "\t" << Opcode << "\t"; |
| + getSrc(1)->emit(Func); |
| + Str << "\n"; |
| +} |
| + |
| template <> void InstX8632Imul::emit(const Cfg *Func) const { |
| Ostream &Str = Func->getContext()->getStrEmit(); |
| assert(getSrcSize() == 2); |
| @@ -823,6 +846,25 @@ void InstX8632StoreQ::dump(const Cfg *Func) const { |
| getSrc(0)->dump(Func); |
| } |
| +template <> void InstX8632Lea::emit(const Cfg *Func) const { |
| + Ostream &Str = Func->getContext()->getStrEmit(); |
| + assert(getSrcSize() == 1); |
| + assert(getDest()->hasReg()); |
| + Str << "\tlea\t"; |
| + getDest()->emit(Func); |
| + Str << ", "; |
| + Operand *Src0 = getSrc(0); |
| + if (Variable *VSrc0 = llvm::dyn_cast<Variable>(Src0)) { |
| + Type Ty = VSrc0->getType(); |
| + // lea on x86-32 doesn't accept mem128 operands, so cast VSrc0 to an |
| + // acceptable type. |
| + VSrc0->asType(isVectorType(Ty) ? IceType_i32 : Ty).emit(Func); |
| + } else { |
| + Src0->emit(Func); |
| + } |
| + Str << "\n"; |
| +} |
| + |
| void InstX8632Mov::emit(const Cfg *Func) const { |
| Ostream &Str = Func->getContext()->getStrEmit(); |
| assert(getSrcSize() == 1); |
| @@ -1021,6 +1063,39 @@ template <> void InstX8632Pcmpgt::emit(const Cfg *Func) const { |
| emitTwoAddress(buf, this, Func); |
| } |
| +template <> void InstX8632Pextrw::emit(const Cfg *Func) const { |
| + Ostream &Str = Func->getContext()->getStrEmit(); |
| + assert(getSrcSize() == 2); |
| + Str << "\t" << Opcode << "\t"; |
| + Variable *Dest = getDest(); |
| + assert(Dest->hasReg() && Dest->getType() == IceType_i16); |
| + // pextrw takes r32 dest. |
| + Dest->asType(IceType_i32).emit(Func); |
| + Str << ", "; |
| + getSrc(0)->emit(Func); |
| + Str << ", "; |
| + getSrc(1)->emit(Func); |
| + Str << "\n"; |
| +} |
| + |
| +template <> void InstX8632Pinsrw::emit(const Cfg *Func) const { |
| + Ostream &Str = Func->getContext()->getStrEmit(); |
| + assert(getSrcSize() == 3); |
| + Str << "\t" << Opcode << "\t"; |
| + getDest()->emit(Func); |
| + Str << ", "; |
| + Operand *Src1 = getSrc(1); |
| + if (Variable *VSrc1 = llvm::dyn_cast<Variable>(Src1)) { |
| + // If src1 is a register, it should be r32. |
| + VSrc1->asType(VSrc1->hasReg() ? IceType_i32 : IceType_i16).emit(Func); |
| + } else { |
| + Src1->emit(Func); |
| + } |
| + Str << ", "; |
| + getSrc(2)->emit(Func); |
| + Str << "\n"; |
| +} |
| + |
| void InstX8632Pop::emit(const Cfg *Func) const { |
| Ostream &Str = Func->getContext()->getStrEmit(); |
| assert(getSrcSize() == 0); |