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

Unified Diff: src/IceInstARM32.h

Issue 1655313002: Subzero: ARM32: lowering of vector insert and extract. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | src/IceInstARM32.cpp » ('j') | src/IceInstARM32.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceInstARM32.h
diff --git a/src/IceInstARM32.h b/src/IceInstARM32.h
index 21505a185045fd2267d2d80ddf293bb971cbf65a..b81c02337fd513c6586baa849b0e826d46efdbd7 100644
--- a/src/IceInstARM32.h
+++ b/src/IceInstARM32.h
@@ -23,6 +23,7 @@
#include "IceInst.h"
#include "IceInstARM32.def"
#include "IceOperand.h"
+#include "IceRegistersARM32.h"
namespace Ice {
namespace ARM32 {
@@ -389,6 +390,8 @@ public:
Cmp,
Dmb,
Eor,
+ Extract,
+ Insert,
Label,
Ldr,
Ldrex,
@@ -1353,6 +1356,72 @@ private:
Variable *DestHi = nullptr;
};
+/// Common methods between InstARM32Extract and InstARM32Insert.
+class InstARM32ExtractInsert : public InstARM32Pred {
+ InstARM32ExtractInsert() = delete;
+ InstARM32ExtractInsert(const InstARM32ExtractInsert &) = delete;
+ InstARM32ExtractInsert &operator=(const InstARM32ExtractInsert &) = delete;
+
+protected:
+ InstARM32ExtractInsert(Cfg *Func, Variable *Dest, uint32_t Index,
+ CondARM32::Cond Predicate)
+ : InstARM32Pred(Func, InstARM32::Extract, 2, Dest, Predicate),
Jim Stichnoth 2016/02/03 15:28:37 Since both Insert and Extract have a single source
Eric Holk 2016/02/03 21:02:21 Done. Originally I thought there was going to be
+ Index(Index) {}
+
+ uint32_t Index;
Jim Stichnoth 2016/02/03 15:28:37 const uint32_t Index
John 2016/02/03 16:06:51 const also, why don't you add a const uint32_t N
Eric Holk 2016/02/03 21:02:21 It wasn't immediately clear what the right NumElem
Eric Holk 2016/02/03 21:02:21 Done.
+
+ // These next two functions find the D register that maps to the half of the Q
+ // register that this instruction is accessing.
+ RegARM32::AllRegisters getDRegister(Variable *Src, uint32_t VectorSize) const;
Jim Stichnoth 2016/02/03 15:28:37 This isn't absolutely clear-cut, but I think it wo
Eric Holk 2016/02/03 21:02:21 I wasn't totally thrilled with the design I used h
Jim Stichnoth 2016/02/03 22:32:21 I was thinking that the common code could determin
John 2016/02/04 15:23:57 what about defining a virtual method in this class
John 2016/02/04 15:23:57 Another issue I'd like to point out here. if this
Jim Stichnoth 2016/02/04 16:44:12 I recalled that in general, we had tried to avoid
John 2016/02/04 16:52:24 I am **not** suggesting this member in lieu of the
+ uint32_t getDIndex(uint32_t VectorSize) const;
John 2016/02/03 16:06:51 VectorSize to me is always 128-bit. Maybe rename t
Eric Holk 2016/02/03 21:02:21 Done.
+
+ // For floating point values, we can read directly from an S register. This
+ // function finds the right one.
+ RegARM32::AllRegisters getSRegister(Variable *Src) const;
+};
Jim Stichnoth 2016/02/03 15:28:37 Implement classof() for completeness.
Eric Holk 2016/02/03 21:02:21 Does it make sense to have classof here, given tha
Jim Stichnoth 2016/02/03 22:32:21 If you aren't already aware, have a look at http:/
Eric Holk 2016/02/04 20:57:25 Ah, that makes sense. Thanks.
+
+/// Generates vmov Rd, Dn[x] instructions, and their related floating point
+/// versions.
+class InstARM32Extract final : public InstARM32ExtractInsert {
+ InstARM32Extract() = delete;
+ InstARM32Extract(const InstARM32Extract &) = delete;
+ InstARM32Extract &operator=(const InstARM32Extract &) = delete;
+
+public:
+ static InstARM32Extract *create(Cfg *Func, Variable *Dest, Variable *Src,
+ uint32_t Index, CondARM32::Cond Predicate) {
+ return new (Func->allocate<InstARM32Extract>())
+ InstARM32Extract(Func, Dest, Src, Index, Predicate);
+ }
+ void emit(const Cfg *Func) const override;
+ static bool classof(const Inst *Inst) { return isClassof(Inst, Extract); }
+
+private:
+ InstARM32Extract(Cfg *Func, Variable *Dest, Variable *Src, uint32_t Index,
+ CondARM32::Cond Predicate);
+};
+
+/// Generates vmov Dn[x], Rd instructions, and their related floating point
+/// versions.
+class InstARM32Insert final : public InstARM32ExtractInsert {
+ InstARM32Insert() = delete;
+ InstARM32Insert(const InstARM32Insert &) = delete;
+ InstARM32Insert &operator=(const InstARM32Insert &) = delete;
+
+public:
+ static InstARM32Insert *create(Cfg *Func, Variable *Dest, Variable *Src0,
+ uint32_t Index, CondARM32::Cond Predicate) {
+ return new (Func->allocate<InstARM32Insert>())
+ InstARM32Insert(Func, Dest, Src0, Index, Predicate);
+ }
+ void emit(const Cfg *Func) const override;
+ static bool classof(const Inst *Inst) { return isClassof(Inst, Insert); }
+
+private:
+ InstARM32Insert(Cfg *Func, Variable *Dest, Variable *Src0, uint32_t Index,
Jim Stichnoth 2016/02/03 15:28:37 This parameter is named Src0, the one for Extract
Eric Holk 2016/02/03 21:02:21 Done.
+ CondARM32::Cond Predicate);
+};
+
class InstARM32Vcmp final : public InstARM32Pred {
InstARM32Vcmp() = delete;
InstARM32Vcmp(const InstARM32Vcmp &) = delete;
« no previous file with comments | « no previous file | src/IceInstARM32.cpp » ('j') | src/IceInstARM32.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698