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/IceInstX8632.h

Issue 401533002: Lower byte swap intrinsic. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: rebased 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
« no previous file with comments | « crosstest/test_bitmanip_main.cpp ('k') | src/IceInstX8632.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceInstX8632.h
diff --git a/src/IceInstX8632.h b/src/IceInstX8632.h
index db60d68ee53b5f3e7ed8ebeed96e30fab39edbc0..b50199b4f97649865b80f999042a84a59d7e3c49 100644
--- a/src/IceInstX8632.h
+++ b/src/IceInstX8632.h
@@ -141,6 +141,7 @@ public:
Br,
Bsf,
Bsr,
+ Bswap,
Call,
Cdq,
Cmov,
@@ -188,6 +189,7 @@ public:
Push,
Pxor,
Ret,
+ Rol,
Sar,
Sbb,
Shl,
@@ -352,6 +354,42 @@ private:
virtual ~InstX8632Call() {}
};
+// Instructions of the form x := op(x).
+template <InstX8632::InstKindX8632 K>
+class InstX8632Inplaceop : public InstX8632 {
+public:
+ static InstX8632Inplaceop *create(Cfg *Func, Operand *SrcDest) {
+ return new (Func->allocate<InstX8632Inplaceop>())
+ InstX8632Inplaceop(Func, SrcDest);
+ }
+ virtual void emit(const Cfg *Func) const {
+ Ostream &Str = Func->getContext()->getStrEmit();
+ assert(getSrcSize() == 1);
+ Str << "\t" << Opcode << "\t";
+ getSrc(0)->emit(Func);
+ Str << "\n";
+ }
+ virtual void dump(const Cfg *Func) const {
+ Ostream &Str = Func->getContext()->getStrDump();
+ dumpDest(Func);
+ Str << " = " << Opcode << "." << getDest()->getType() << " ";
+ dumpSources(Func);
+ }
+ static bool classof(const Inst *Inst) { return isClassof(Inst, K); }
+
+private:
+ InstX8632Inplaceop(Cfg *Func, Operand *SrcDest)
+ : InstX8632(Func, K, 1, llvm::dyn_cast<Variable>(SrcDest)) {
+ addSource(SrcDest);
+ }
+ InstX8632Inplaceop(const InstX8632Inplaceop &) LLVM_DELETED_FUNCTION;
+ InstX8632Inplaceop &
+ operator=(const InstX8632Inplaceop &) LLVM_DELETED_FUNCTION;
+ virtual ~InstX8632Inplaceop() {}
+ static const char *Opcode;
+};
+
+// Instructions of the form x := op(y)
template <InstX8632::InstKindX8632 K>
class InstX8632Unaryop : public InstX8632 {
public:
@@ -506,6 +544,8 @@ private:
static const char *Opcode;
};
+typedef InstX8632Inplaceop<InstX8632::Bswap> InstX8632Bswap;
+typedef InstX8632Inplaceop<InstX8632::Neg> InstX8632Neg;
typedef InstX8632Unaryop<InstX8632::Bsf> InstX8632Bsf;
typedef InstX8632Unaryop<InstX8632::Bsr> InstX8632Bsr;
typedef InstX8632Unaryop<InstX8632::Lea> InstX8632Lea;
@@ -535,6 +575,7 @@ typedef InstX8632Binop<InstX8632::Pmullw> InstX8632Pmullw;
typedef InstX8632Binop<InstX8632::Pmuludq> InstX8632Pmuludq;
typedef InstX8632Binop<InstX8632::Divps> InstX8632Divps;
typedef InstX8632Binop<InstX8632::Divss> InstX8632Divss;
+typedef InstX8632Binop<InstX8632::Rol, true> InstX8632Rol;
typedef InstX8632Binop<InstX8632::Shl, true> InstX8632Shl;
typedef InstX8632Binop<InstX8632::Psll> InstX8632Psll;
typedef InstX8632Binop<InstX8632::Shr, true> InstX8632Shr;
@@ -590,23 +631,6 @@ private:
virtual ~InstX8632Mul() {}
};
-// Neg instruction - Two's complement negation.
-class InstX8632Neg : public InstX8632 {
-public:
- static InstX8632Neg *create(Cfg *Func, Operand *SrcDest) {
- return new (Func->allocate<InstX8632Neg>()) InstX8632Neg(Func, SrcDest);
- }
- virtual void emit(const Cfg *Func) const;
- virtual void dump(const Cfg *Func) const;
- static bool classof(const Inst *Inst) { return isClassof(Inst, Neg); }
-
-private:
- InstX8632Neg(Cfg *Func, Operand *SrcDest);
- InstX8632Neg(const InstX8632Neg &) LLVM_DELETED_FUNCTION;
- InstX8632Neg &operator=(const InstX8632Neg &) LLVM_DELETED_FUNCTION;
- virtual ~InstX8632Neg() {}
-};
-
// Shld instruction - shift across a pair of operands. TODO: Verify
// that the validator accepts the shld instruction.
class InstX8632Shld : public InstX8632 {
« no previous file with comments | « crosstest/test_bitmanip_main.cpp ('k') | src/IceInstX8632.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698