diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2014-07-11 10:57:49 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2014-07-21 09:54:20 +0100 |
commit | 96f89a290eb67d7bf4b1636798fa28df14309cc7 (patch) | |
tree | ca2b484a18107f8253aa7774cde304586a31bc60 /compiler/utils/arm/assembler_thumb2.cc | |
parent | 4436e926aa8e64ac7e4c4afb81f2a59b2477045a (diff) | |
download | art-96f89a290eb67d7bf4b1636798fa28df14309cc7.tar.gz art-96f89a290eb67d7bf4b1636798fa28df14309cc7.tar.bz2 art-96f89a290eb67d7bf4b1636798fa28df14309cc7.zip |
Add assembly operations with constants in optimizing compiler.
Change-Id: I5bcc35ab50d4457186effef5592a75d7f4e5b65f
Diffstat (limited to 'compiler/utils/arm/assembler_thumb2.cc')
-rw-r--r-- | compiler/utils/arm/assembler_thumb2.cc | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/compiler/utils/arm/assembler_thumb2.cc b/compiler/utils/arm/assembler_thumb2.cc index 2ce4fd22bd..c693ec0fe1 100644 --- a/compiler/utils/arm/assembler_thumb2.cc +++ b/compiler/utils/arm/assembler_thumb2.cc @@ -619,7 +619,8 @@ bool Thumb2Assembler::Is32BitDataProcessing(Condition cond, return true; } - bool can_contain_high_register = opcode == MOV || opcode == ADD || opcode == SUB; + bool can_contain_high_register = (opcode == MOV) + || ((opcode == ADD || opcode == SUB) && (rn == rd)); if (IsHighRegister(rd) || IsHighRegister(rn)) { if (can_contain_high_register) { @@ -757,23 +758,21 @@ void Thumb2Assembler::Emit32BitDataProcessing(Condition cond, int32_t encoding = 0; if (so.IsImmediate()) { // Check special cases. - if ((opcode == SUB || opcode == ADD) && rn == SP) { - // There are special ADD/SUB rd, SP, #imm12 instructions. + if ((opcode == SUB || opcode == ADD) && (so.GetImmediate() < (1u << 12))) { if (opcode == SUB) { thumb_opcode = 0b0101; } else { thumb_opcode = 0; } uint32_t imm = so.GetImmediate(); - CHECK_LT(imm, (1u << 12)); uint32_t i = (imm >> 11) & 1; uint32_t imm3 = (imm >> 8) & 0b111; uint32_t imm8 = imm & 0xff; encoding = B31 | B30 | B29 | B28 | B25 | - B19 | B18 | B16 | thumb_opcode << 21 | + rn << 16 | rd << 8 | i << 26 | imm3 << 12 | @@ -882,7 +881,12 @@ void Thumb2Assembler::Emit16BitDataProcessing(Condition cond, } break; - case CMN: thumb_opcode = 0b1011; rn = so.GetRegister(); break; + case CMN: { + thumb_opcode = 0b1011; + rd = rn; + rn = so.GetRegister(); + break; + } case ORR: thumb_opcode = 0b1100; break; case MOV: dp_opcode = 0; |