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

Unified Diff: src/IceAssemblerARM32.cpp

Issue 1388323003: Add "sub immediate" instruction to the ARM integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Remove tabs. Created 5 years, 2 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 | « src/IceAssemblerARM32.h ('k') | src/IceInstARM32.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceAssemblerARM32.cpp
diff --git a/src/IceAssemblerARM32.cpp b/src/IceAssemblerARM32.cpp
index 2195d4d985766074c3dea6391637ad61e8c0c167..9972b44f29506f286618f931909fffdcca5422d9 100644
--- a/src/IceAssemblerARM32.cpp
+++ b/src/IceAssemblerARM32.cpp
@@ -28,6 +28,7 @@ using namespace Ice;
// The following define individual bits.
static constexpr uint32_t B0 = 1;
+static constexpr uint32_t B1 = 1 << 1;
static constexpr uint32_t B2 = 1 << 2;
static constexpr uint32_t B3 = 1 << 3;
static constexpr uint32_t B4 = 1 << 4;
@@ -220,4 +221,34 @@ void ARM32::AssemblerARM32::mov(const Operand *OpRd, const Operand *OpSrc,
UnimplementedError(Ctx->getFlags());
}
+void ARM32::AssemblerARM32::sub(const Operand *OpRd, const Operand *OpRn,
+ const Operand *OpSrc1, bool SetFlags,
+ CondARM32::Cond Cond) {
+ // Note: Loop is used so that we can short circuit using break;
+ do {
+ uint32_t Rd;
+ if (decode(OpRd, Rd) != DecodedAsRegister)
+ break;
+ uint32_t Rn;
+ if (decode(OpRn, Rn) != DecodedAsRegister)
+ break;
+ uint32_t Src1Value;
+ // TODO(kschimpf) Other possible decodings of add.
+ if (decode(OpSrc1, Src1Value) == DecodedAsRotatedImm8) {
+ // Sub (Immediate): See ARM section A8.8.222, rule A1.
+ // cccc0010010snnnnddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, nnnn=Rn,
+ // s=SetFlags and iiiiiiiiiiii=Src1Value
+ if (!isConditionDefined(Cond) || (Rd == RegARM32::Reg_pc && SetFlags) ||
+ (Rn == RegARM32::Reg_lr) || (Rn == RegARM32::Reg_pc && SetFlags))
+ // Conditions of rule violated.
+ break;
+ uint32_t Add = B1; // 0010
+ uint32_t InstType = 1;
+ emitType01(Cond, InstType, Add, SetFlags, Rn, Rd, Src1Value);
+ return;
+ }
+ } while (0);
+ UnimplementedError(Ctx->getFlags());
+}
+
} // end of namespace Ice
« no previous file with comments | « src/IceAssemblerARM32.h ('k') | src/IceInstARM32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698