Index: src/arm/disasm-arm.cc |
=================================================================== |
--- src/arm/disasm-arm.cc (revision 4740) |
+++ src/arm/disasm-arm.cc (working copy) |
@@ -401,6 +401,20 @@ |
PrintCondition(instr); |
return 4; |
} |
+ case 'f': { // 'f: bitfield instructions - v7 and above. |
+ uint32_t lsbit = instr->Bits(11, 7); |
+ uint32_t width = instr->Bits(20, 16) + 1; |
+ if (instr->Bit(21) == 0) { |
+ // BFC/BFI: |
+ // Bits 20-16 represent most-significant bit. Covert to width. |
+ width -= lsbit; |
+ ASSERT(width > 0); |
+ } |
+ ASSERT((width + lsbit) <= 32); |
+ out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_, |
+ "#%d, #%d", lsbit, width); |
+ return 1; |
+ } |
case 'h': { // 'h: halfword operation for extra loads and stores |
if (instr->HasH()) { |
Print("h"); |
@@ -446,16 +460,6 @@ |
out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_, |
"%d", instr->Offset12Field()); |
return 5; |
- } else if ((format[3] == '1') && (format[4] == '6')) { |
- ASSERT(STRING_STARTS_WITH(format, "off16to20")); |
- out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_, |
- "%d", instr->Bits(20, 16) +1); |
- return 9; |
- } else if (format[3] == '7') { |
- ASSERT(STRING_STARTS_WITH(format, "off7to11")); |
- out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_, |
- "%d", instr->ShiftAmountField()); |
- return 8; |
} else if (format[3] == '0') { |
// 'off0to3and8to19 16-bit immediate encoded in bits 19-8 and 3-0. |
ASSERT(STRING_STARTS_WITH(format, "off0to3and8to19")); |
@@ -882,13 +886,29 @@ |
case 3: { |
if (instr->HasW() && (instr->Bits(6, 4) == 0x5)) { |
uint32_t widthminus1 = static_cast<uint32_t>(instr->Bits(20, 16)); |
- uint32_t lsbit = static_cast<uint32_t>(instr->ShiftAmountField()); |
+ uint32_t lsbit = static_cast<uint32_t>(instr->Bits(11, 7)); |
uint32_t msbit = widthminus1 + lsbit; |
if (msbit <= 31) { |
- Format(instr, "ubfx'cond 'rd, 'rm, #'off7to11, #'off16to20"); |
+ if (instr->Bit(22)) { |
+ Format(instr, "ubfx'cond 'rd, 'rm, 'f"); |
+ } else { |
+ Format(instr, "sbfx'cond 'rd, 'rm, 'f"); |
+ } |
} else { |
UNREACHABLE(); |
} |
+ } else if (!instr->HasW() && (instr->Bits(6, 4) == 0x1)) { |
+ uint32_t lsbit = static_cast<uint32_t>(instr->Bits(11, 7)); |
+ uint32_t msbit = static_cast<uint32_t>(instr->Bits(20, 16)); |
+ if (msbit >= lsbit) { |
+ if (instr->RmField() == 15) { |
+ Format(instr, "bfc'cond 'rd, 'f"); |
+ } else { |
+ Format(instr, "bfi'cond 'rd, 'rm, 'f"); |
+ } |
+ } else { |
+ UNREACHABLE(); |
+ } |
} else { |
Format(instr, "'memop'cond'b 'rd, ['rn, +'shift_rm]'w"); |
} |