Skip to content

Commit b9eeb0c

Browse files
committed
[AVR] Add SUBIW disassembly
1 parent 2f48e11 commit b9eeb0c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

llvm/lib/Target/AVR/Disassembler/AVRDisassembler.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -328,14 +328,14 @@ static DecodeStatus decodeCondBranch(MCInst &Inst, unsigned Insn,
328328
return MCDisassembler::Success;
329329
}
330330

331-
static DecodeStatus decodeAddWordImm(MCInst &Inst, unsigned Insn,
332-
uint64_t Address,
333-
const MCDisassembler *Decoder) {
331+
static DecodeStatus decodeAddSubWordImm(MCInst &Inst, unsigned Insn,
332+
uint64_t Address,
333+
const MCDisassembler *Decoder) {
334334
// Get the register
335335
unsigned RegVal = GPRDecoderTable[24 + 2 * ((Insn >> 4) & 0x3)];
336336

337-
if ((Insn & 0xff00) == 0x9600) {
338-
Inst.setOpcode(AVR::ADIWRdK);
337+
if ((Insn & 0xfe00) == 0x9600) {
338+
Inst.setOpcode((Insn & 0xff00) == 0x9600 ? AVR::ADIWRdK : AVR::SUBIWRdK);
339339
Inst.addOperand(MCOperand::createReg(RegVal));
340340
Inst.addOperand(
341341
MCOperand::createImm(((Insn & 0x00C0) >> 2) | (Insn & 0xF)));
@@ -540,7 +540,7 @@ DecodeStatus AVRDisassembler::getInstruction(MCInst &Instr, uint64_t &Size,
540540
return Result;
541541

542542
// Try to decode to a ADIW instruction
543-
Result = decodeAddWordImm(Instr, Insn, Address, this);
543+
Result = decodeAddSubWordImm(Instr, Insn, Address, this);
544544
if (Result != MCDisassembler::Fail)
545545
return Result;
546546

0 commit comments

Comments
 (0)