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

Unified Diff: src/IceInstX86BaseImpl.h

Issue 1497033002: Fuse icmp/fcmp with select (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: unittests work Created 5 years 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/IceInstX86BaseImpl.h
diff --git a/src/IceInstX86BaseImpl.h b/src/IceInstX86BaseImpl.h
index 84ff8dc89263156b4d273c42fec0c0eec8b1f8ea..c33c99cb65ad1d33a1c2d72ac26faf5bf84b8caa 100644
--- a/src/IceInstX86BaseImpl.h
+++ b/src/IceInstX86BaseImpl.h
@@ -1105,6 +1105,72 @@ void InstX86Mulss<Machine>::emit(const Cfg *Func) const {
}
template <class Machine>
+void InstX86Andnps<Machine>::emit(const Cfg *Func) const {
+ if (!BuildDefs::dump())
+ return;
+
+ char buf[30];
Jim Stichnoth 2015/12/08 18:55:59 This style of generating the opcode string bothers
sehr 2015/12/15 20:45:44 OK, I think there's a larger commonality to the SS
+ const char *suffix = (this->getDest()->getType() == IceType_f64) ? "d" : "s";
+ snprintf(buf, llvm::array_lengthof(buf), "andnp%s", suffix);
+ this->emitTwoAddress(buf, this, Func);
+}
+
+template <class Machine>
+void InstX86Andps<Machine>::emit(const Cfg *Func) const {
+ if (!BuildDefs::dump())
+ return;
+
+ char buf[30];
+ const char *suffix = (this->getDest()->getType() == IceType_f64) ? "d" : "s";
+ snprintf(buf, llvm::array_lengthof(buf), "andp%s", suffix);
+ this->emitTwoAddress(buf, this, Func);
+}
+
+template <class Machine>
+void InstX86Maxss<Machine>::emit(const Cfg *Func) const {
+ if (!BuildDefs::dump())
+ return;
+
+ char buf[30];
+ const char *suffix = (this->getDest()->getType() == IceType_f64) ? "d" : "s";
+ snprintf(buf, llvm::array_lengthof(buf), "maxs%s", suffix);
+ this->emitTwoAddress(buf, this, Func);
+}
+
+template <class Machine>
+void InstX86Minss<Machine>::emit(const Cfg *Func) const {
+ if (!BuildDefs::dump())
+ return;
+
+ char buf[30];
+ const char *suffix = (this->getDest()->getType() == IceType_f64) ? "d" : "s";
+ snprintf(buf, llvm::array_lengthof(buf), "mins%s", suffix);
+ this->emitTwoAddress(buf, this, Func);
+}
+
+template <class Machine>
+void InstX86Orps<Machine>::emit(const Cfg *Func) const {
+ if (!BuildDefs::dump())
+ return;
+
+ char buf[30];
+ const char *suffix = (this->getDest()->getType() == IceType_f64) ? "d" : "s";
+ snprintf(buf, llvm::array_lengthof(buf), "orp%s", suffix);
+ this->emitTwoAddress(buf, this, Func);
+}
+
+template <class Machine>
+void InstX86Xorps<Machine>::emit(const Cfg *Func) const {
+ if (!BuildDefs::dump())
+ return;
+
+ char buf[30];
+ const char *suffix = (this->getDest()->getType() == IceType_f64) ? "d" : "s";
+ snprintf(buf, llvm::array_lengthof(buf), "xorp%s", suffix);
+ this->emitTwoAddress(buf, this, Func);
+}
+
+template <class Machine>
void InstX86Pmuludq<Machine>::emit(const Cfg *Func) const {
if (!BuildDefs::dump())
return;
@@ -1627,7 +1693,7 @@ void InstX86Cmpps<Machine>::emit(const Cfg *Func) const {
Str << "\t";
Str << "cmp"
<< InstX86Base<Machine>::Traits::InstCmppsAttributes[Condition].EmitString
- << "ps"
+ << "p" << ((this->getDest()->getType() == IceType_f64) ? "d" : "s")
<< "\t";
this->getSrc(1)->emit(Func);
Str << ", ";
@@ -1646,14 +1712,16 @@ void InstX86Cmpps<Machine>::emitIAS(const Cfg *Func) const {
auto *Target = InstX86Base<Machine>::getTarget(Func);
const auto *SrcVar = llvm::cast<Variable>(this->getSrc(1));
if (SrcVar->hasReg()) {
- Asm->cmpps(InstX86Base<Machine>::Traits::getEncodedXmm(
+ Asm->cmpps(this->getDest()->getType(),
+ InstX86Base<Machine>::Traits::getEncodedXmm(
this->getDest()->getRegNum()),
InstX86Base<Machine>::Traits::getEncodedXmm(SrcVar->getRegNum()),
Condition);
} else {
typename InstX86Base<Machine>::Traits::Address SrcStackAddr =
Target->stackVarToAsmOperand(SrcVar);
- Asm->cmpps(InstX86Base<Machine>::Traits::getEncodedXmm(
+ Asm->cmpps(this->getDest()->getType(),
+ InstX86Base<Machine>::Traits::getEncodedXmm(
this->getDest()->getRegNum()),
SrcStackAddr, Condition);
}

Powered by Google App Engine
This is Rietveld 408576698