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

Unified Diff: src/IceInstX8632.cpp

Issue 617593002: Handle imul, pcmpeq, pcmpgt. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: go ahead and optimize i8 Created 6 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 side-by-side diff with in-line comments
Download patch
Index: src/IceInstX8632.cpp
diff --git a/src/IceInstX8632.cpp b/src/IceInstX8632.cpp
index 0a2d034f9ac941b6aa424e99590fc5e2b3d84043..ab323350e5649774e8ff46e0e47e4a1997c375f8 100644
--- a/src/IceInstX8632.cpp
+++ b/src/IceInstX8632.cpp
@@ -720,6 +720,12 @@ template <>
const x86::AssemblerX86::XmmEmitterTwoOps InstX8632Pandn::Emitter = {
&x86::AssemblerX86::pandn, &x86::AssemblerX86::pandn, NULL};
template <>
+const x86::AssemblerX86::XmmEmitterTwoOps InstX8632Pcmpeq::Emitter = {
+ &x86::AssemblerX86::pcmpeq, &x86::AssemblerX86::pcmpeq, NULL};
+template <>
+const x86::AssemblerX86::XmmEmitterTwoOps InstX8632Pcmpgt::Emitter = {
+ &x86::AssemblerX86::pcmpgt, &x86::AssemblerX86::pcmpgt, NULL};
+template <>
const x86::AssemblerX86::XmmEmitterTwoOps InstX8632Pmuludq::Emitter = {
&x86::AssemblerX86::pmuludq, &x86::AssemblerX86::pmuludq, NULL};
template <>
@@ -904,6 +910,30 @@ template <> void InstX8632Imul::emit(const Cfg *Func) const {
}
}
+template <> void InstX8632Imul::emitIAS(const Cfg *Func) const {
+ assert(getSrcSize() == 2);
+ const Variable *Var = getDest();
+ Type Ty = Var->getType();
+ const Operand *Src = getSrc(1);
+ if (isByteSizedArithType(Ty)) {
+ // The 8-bit version of imul only allows the form "imul r/m8".
+ Variable *Src0 = llvm::dyn_cast<Variable>(getSrc(0));
+ (void)Src0;
+ assert(Src0 && Src0->getRegNum() == RegX8632::Reg_eax);
+ const x86::AssemblerX86::GPREmitterOneOp Emitter = {
+ &x86::AssemblerX86::imul, &x86::AssemblerX86::imul};
+ emitIASOpTyGPR(Func, Ty, getSrc(1), Emitter);
+ } else {
+ // We only use imul as a two-address instruction even though
+ // there is a 3 operand version when one of the operands is a constant.
+ assert(Var == getSrc(0));
+ const x86::AssemblerX86::GPREmitterRegOp Emitter = {
+ &x86::AssemblerX86::imul, &x86::AssemblerX86::imul,
+ &x86::AssemblerX86::imul};
+ emitIASRegOpTyGPR(Func, Ty, Var, Src, Emitter);
+ }
+}
+
template <> void InstX8632Cbwdq::emit(const Cfg *Func) const {
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1);

Powered by Google App Engine
This is Rietveld 408576698