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

Unified Diff: src/IceInstX8632.cpp

Issue 353553004: Add support for vector types and vector constants. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: 1) Fix alignment in type table. 2) Add VECT128_BYTES constant. 3) add _movp() function. Created 6 years, 6 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 376d4541add697a0643fc1e7d3f585cce5a3ac2f..47038ef3be37bbc09465cc3fd502ced47856855d 100644
--- a/src/IceInstX8632.cpp
+++ b/src/IceInstX8632.cpp
@@ -182,6 +182,11 @@ InstX8632Mov::InstX8632Mov(Cfg *Func, Variable *Dest, Operand *Source)
addSource(Source);
}
+InstX8632Movp::InstX8632Movp(Cfg *Func, Variable *Dest, Operand *Source)
+ : InstX8632(Func, InstX8632::Movp, 1, Dest) {
+ addSource(Source);
+}
+
InstX8632StoreQ::InstX8632StoreQ(Cfg *Func, Operand *Value, OperandX8632 *Mem)
: InstX8632(Func, InstX8632::StoreQ, 2, NULL) {
addSource(Value);
@@ -237,6 +242,19 @@ bool InstX8632Mov::isRedundantAssign() const {
return false;
}
+bool InstX8632Movp::isRedundantAssign() const {
jvoung (off chromium) 2014/06/26 23:33:46 At some point, we should just have a base implemen
wala 2014/06/27 21:09:19 I'll add a TODO...
+ Variable *Src = llvm::dyn_cast<Variable>(getSrc(0));
+ if (Src == NULL)
+ return false;
+ if (getDest()->hasReg() && getDest()->getRegNum() == Src->getRegNum()) {
+ return true;
+ }
+ if (!getDest()->hasReg() && !Src->hasReg() &&
+ Dest->getStackOffset() == Src->getStackOffset())
+ return true;
+ return false;
+}
+
bool InstX8632Movq::isRedundantAssign() const {
Variable *Src = llvm::dyn_cast<Variable>(getSrc(0));
if (Src == NULL)
@@ -680,6 +698,19 @@ void InstX8632Mov::dump(const Cfg *Func) const {
dumpSources(Func);
}
+void InstX8632Movp::emit(const Cfg *Func) const {
+ // TODO(wala): movups works with all vector operands, but there exist
Jim Stichnoth 2014/06/27 18:30:16 maybe TODO(wala,stichnot) just in case
+ // other instructions (movaps, movdqa, movdqu) that may perform
+ // better, depending on the data type and alignment of the operands.
+ Ostream &Str = Func->getContext()->getStrEmit();
+ assert(getSrcSize() == 1);
+ Str << "\tmovups\t";
+ getDest()->emit(Func);
+ Str << ", ";
+ getSrc(0)->emit(Func);
+ Str << "\n";
+}
+
void InstX8632Movq::emit(const Cfg *Func) const {
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1);
@@ -692,6 +723,14 @@ void InstX8632Movq::emit(const Cfg *Func) const {
Str << "\n";
}
+void InstX8632Movp::dump(const Cfg *Func) const {
+ Ostream &Str = Func->getContext()->getStrDump();
+ Str << "movups." << getDest()->getType() << " ";
+ dumpDest(Func);
+ Str << ", ";
+ dumpSources(Func);
+}
+
void InstX8632Movq::dump(const Cfg *Func) const {
Ostream &Str = Func->getContext()->getStrDump();
Str << "movq." << getDest()->getType() << " ";

Powered by Google App Engine
This is Rietveld 408576698