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

Unified Diff: src/IceAssemblerARM32.cpp

Issue 1403403009: Add MOV (register) to ARM integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix issue in patch set 2. 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 | « no previous file | tests_lit/assembler/arm32/mul.ll » ('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 eb10ab76b2588ebd3e10029e2fbc21af22484035..105b78b388c4bc9ca58d5cc2413b0401fb1d6ddb 100644
--- a/src/IceAssemblerARM32.cpp
+++ b/src/IceAssemblerARM32.cpp
@@ -625,20 +625,38 @@ void AssemblerARM32::mov(const Operand *OpRd, const Operand *OpSrc,
return setNeedsTextFixup();
IValueT Src;
// TODO(kschimpf) Handle other forms of mov.
- if (decodeOperand(OpSrc, Src) != DecodedAsRotatedImm8)
- return setNeedsTextFixup();
- // MOV (immediate) - ARM section A8.8.102, encoding A1:
- // mov{S}<c> <Rd>, #<RotatedImm8>
- //
- // cccc0011101s0000ddddiiiiiiiiiiii where cccc=Cond, s=SetFlags, dddd=Rd, and
- // iiiiiiiiiiii=RotatedImm8=Src. Note: We don't use movs in this assembler.
constexpr bool SetFlags = false;
- if ((Rd == RegARM32::Encoded_Reg_pc && SetFlags))
- // Conditions of rule violated.
- return setNeedsTextFixup();
constexpr IValueT Rn = 0;
constexpr IValueT Mov = B3 | B2 | B0; // 1101.
- emitType01(Cond, kInstTypeDataImmediate, Mov, SetFlags, Rn, Rd, Src);
+ switch (decodeOperand(OpSrc, Src)) {
+ default:
+ return setNeedsTextFixup();
+ case DecodedAsRegister: {
+ // MOV (register) - ARM section A8.8.104, encoding A1:
+ // mov{S}<c> <Rd>, <Rn>
+ //
+ // cccc0001101s0000dddd00000000mmmm where cccc=Cond, s=SetFlags, dddd=Rd,
+ // and nnnn=Rn.
+ if ((Rd == RegARM32::Encoded_Reg_pc && SetFlags))
+ // Conditions of rule violated.
+ return setNeedsTextFixup();
+ emitType01(Cond, kInstTypeDataRegister, Mov, SetFlags, Rn, Rd, Src);
+ return;
+ }
+ case DecodedAsRotatedImm8: {
+ // MOV (immediate) - ARM section A8.8.102, encoding A1:
+ // mov{S}<c> <Rd>, #<RotatedImm8>
+ //
+ // cccc0011101s0000ddddiiiiiiiiiiii where cccc=Cond, s=SetFlags, dddd=Rd,
+ // and iiiiiiiiiiii=RotatedImm8=Src. Note: We don't use movs in this
+ // assembler.
+ if ((Rd == RegARM32::Encoded_Reg_pc && SetFlags))
+ // Conditions of rule violated.
+ return setNeedsTextFixup();
+ emitType01(Cond, kInstTypeDataImmediate, Mov, SetFlags, Rn, Rd, Src);
+ return;
+ }
+ }
}
void AssemblerARM32::movw(const Operand *OpRd, const Operand *OpSrc,
« no previous file with comments | « no previous file | tests_lit/assembler/arm32/mul.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698