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

Unified Diff: src/IceInstX8632.cpp

Issue 452143003: Subzero: Make InstX8632Cbwdq a UnaryOp. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceInstX8632.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceInstX8632.cpp
diff --git a/src/IceInstX8632.cpp b/src/IceInstX8632.cpp
index 457f56e2d62f20b5ef57fbfeb27c974f87274821..03cdb952fce3e7313bd6bb8a01b0877dab69313a 100644
--- a/src/IceInstX8632.cpp
+++ b/src/IceInstX8632.cpp
@@ -136,11 +136,6 @@ InstX8632Call::InstX8632Call(Cfg *Func, Variable *Dest, Operand *CallTarget)
addSource(CallTarget);
}
-InstX8632Cbwdq::InstX8632Cbwdq(Cfg *Func, Variable *Dest, Operand *Source)
- : InstX8632(Func, InstX8632::Cbwdq, 1, Dest) {
- addSource(Source);
-}
-
InstX8632Cmov::InstX8632Cmov(Cfg *Func, Variable *Dest, Operand *Source,
InstX8632::BrCond Condition)
: InstX8632(Func, InstX8632::Cmov, 2, Dest), Condition(Condition) {
@@ -452,6 +447,7 @@ template <> const char *InstX8632Bsr::Opcode = "bsr";
template <> const char *InstX8632Lea::Opcode = "lea";
template <> const char *InstX8632Movd::Opcode = "movd";
template <> const char *InstX8632Sqrtss::Opcode = "sqrtss";
+template <> const char *InstX8632Cbwdq::Opcode = "cbw/cwd/cdq";
// Binary ops
template <> const char *InstX8632Add::Opcode = "add";
template <> const char *InstX8632Addps::Opcode = "addps";
@@ -647,6 +643,31 @@ template <> void InstX8632Imul::emit(const Cfg *Func) const {
}
}
+template <> void InstX8632Cbwdq::emit(const Cfg *Func) const {
+ Ostream &Str = Func->getContext()->getStrEmit();
+ assert(getSrcSize() == 1);
+ Operand *Src0 = getSrc(0);
+ assert(llvm::isa<Variable>(Src0));
+ assert(llvm::cast<Variable>(Src0)->getRegNum() == TargetX8632::Reg_eax);
+ switch (Src0->getType()) {
+ default:
+ llvm_unreachable("unexpected source type!");
+ break;
+ case IceType_i8:
+ assert(getDest()->getRegNum() == TargetX8632::Reg_eax);
+ Str << "\tcbw\n";
+ break;
+ case IceType_i16:
+ assert(getDest()->getRegNum() == TargetX8632::Reg_edx);
+ Str << "\tcwd\n";
+ break;
+ case IceType_i32:
+ assert(getDest()->getRegNum() == TargetX8632::Reg_edx);
+ Str << "\tcdq\n";
+ break;
+ }
+}
+
void InstX8632Mul::emit(const Cfg *Func) const {
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 2);
@@ -718,38 +739,6 @@ void InstX8632Shrd::dump(const Cfg *Func) const {
dumpSources(Func);
}
-void InstX8632Cbwdq::emit(const Cfg *Func) const {
- Ostream &Str = Func->getContext()->getStrEmit();
- assert(getSrcSize() == 1);
- Operand *Src0 = getSrc(0);
- assert(llvm::isa<Variable>(Src0));
- assert(llvm::cast<Variable>(Src0)->getRegNum() == TargetX8632::Reg_eax);
- switch (Src0->getType()) {
- default:
- llvm_unreachable("unexpected source type!");
- break;
- case IceType_i8:
- assert(getDest()->getRegNum() == TargetX8632::Reg_eax);
- Str << "\tcbw\n";
- break;
- case IceType_i16:
- assert(getDest()->getRegNum() == TargetX8632::Reg_edx);
- Str << "\tcwd\n";
- break;
- case IceType_i32:
- assert(getDest()->getRegNum() == TargetX8632::Reg_edx);
- Str << "\tcdq\n";
- break;
- }
-}
-
-void InstX8632Cbwdq::dump(const Cfg *Func) const {
- Ostream &Str = Func->getContext()->getStrDump();
- dumpDest(Func);
- Str << " = cbw/cwd/cdq." << getSrc(0)->getType() << " ";
- dumpSources(Func);
-}
-
void InstX8632Cmov::emit(const Cfg *Func) const {
Ostream &Str = Func->getContext()->getStrEmit();
Str << "\t";
« no previous file with comments | « src/IceInstX8632.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698