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

Unified Diff: src/IceInstX8632.cpp

Issue 390443005: Lower bitmanip intrinsics, assuming absence of BMI/SSE4.2 for now. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: stuff Created 6 years, 5 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 c0e8c8d933002a0e7c8da99c9ac227bf3c45aa2f..0733b3a439b1c9744a56517b3167c803b1701dd4 100644
--- a/src/IceInstX8632.cpp
+++ b/src/IceInstX8632.cpp
@@ -121,7 +121,7 @@ IceString InstX8632Label::getName(const Cfg *Func) const {
}
InstX8632Br::InstX8632Br(Cfg *Func, CfgNode *TargetTrue, CfgNode *TargetFalse,
- InstX8632Label *Label, InstX8632Br::BrCond Condition)
+ InstX8632Label *Label, InstX8632::BrCond Condition)
: InstX8632(Func, InstX8632::Br, 0, NULL), Condition(Condition),
TargetTrue(TargetTrue), TargetFalse(TargetFalse), Label(Label) {}
@@ -139,6 +139,15 @@ InstX8632Cdq::InstX8632Cdq(Cfg *Func, Variable *Dest, Operand *Source)
addSource(Source);
}
+InstX8632Cmov::InstX8632Cmov(Cfg *Func, Variable *Dest, Operand *Source,
+ InstX8632::BrCond Condition)
+ : InstX8632(Func, InstX8632::Cmov, 2, Dest), Condition(Condition) {
+ // The final result is either the original Dest, or Source, so mark
+ // both as sources.
+ addSource(Dest);
+ addSource(Source);
+}
+
InstX8632Cmpxchg::InstX8632Cmpxchg(Cfg *Func, Operand *DestOrAddr,
Variable *Eax, Variable *Desired,
bool Locked)
@@ -452,6 +461,8 @@ template <> const char *InstX8632Divss::Opcode = "divss";
template <> const char *InstX8632Shl::Opcode = "shl";
template <> const char *InstX8632Shr::Opcode = "shr";
template <> const char *InstX8632Sar::Opcode = "sar";
+template <> const char *InstX8632Bsf::Opcode = "bsf";
+template <> const char *InstX8632Bsr::Opcode = "bsr";
template <> void InstX8632Addss::emit(const Cfg *Func) const {
char buf[30];
@@ -586,6 +597,26 @@ void InstX8632Cdq::dump(const Cfg *Func) const {
dumpSources(Func);
}
+void InstX8632Cmov::emit(const Cfg *Func) const {
+ Ostream &Str = Func->getContext()->getStrEmit();
+ Str << "\t";
+ assert(Condition != Br_None);
Jim Stichnoth 2014/07/14 23:20:45 Add an assert that Dest is a physical register.
jvoung (off chromium) 2014/07/15 21:30:23 Done.
+ Str << "cmov" << InstX8632BrAttributes[Condition].DisplayString << "\t";
+ getDest()->emit(Func);
+ Str << ", ";
+ getSrc(1)->emit(Func);
+ Str << "\n";
+}
+
+void InstX8632Cmov::dump(const Cfg *Func) const {
+ Ostream &Str = Func->getContext()->getStrDump();
+ Str << "cmov" << InstX8632BrAttributes[Condition].DisplayString << ".";
+ Str << getDest()->getType() << " ";
+ dumpDest(Func);
+ Str << ", ";
+ dumpSources(Func);
+}
+
void InstX8632Cmpxchg::emit(const Cfg *Func) const {
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 3);

Powered by Google App Engine
This is Rietveld 408576698