@@ -328,6 +328,22 @@ static DecodeStatus decodeCondBranch(MCInst &Inst, unsigned Insn,
328328 return MCDisassembler::Success;
329329}
330330
331+ static DecodeStatus decodeMoveWord (MCInst &Inst, unsigned Insn,
332+ uint64_t Address,
333+ const MCDisassembler *Decoder) {
334+ // Get the registers
335+ unsigned RegValD = GPRDecoderTable[2 * ((Insn >> 4 ) & 0xf )];
336+ unsigned RegValR = GPRDecoderTable[2 * (Insn & 0xf )];
337+
338+ if ((Insn & 0xff00 ) == 0x0100 ) {
339+ Inst.setOpcode (AVR::MOVWRdRr);
340+ Inst.addOperand (MCOperand::createReg (RegValD));
341+ Inst.addOperand (MCOperand::createReg (RegValR));
342+ return MCDisassembler::Success;
343+ }
344+ return MCDisassembler::Fail;
345+ }
346+
331347static DecodeStatus decodeLoadStore (MCInst &Inst, unsigned Insn,
332348 uint64_t Address,
333349 const MCDisassembler *Decoder) {
@@ -502,6 +518,11 @@ DecodeStatus AVRDisassembler::getInstruction(MCInst &Instr, uint64_t &Size,
502518 if (Result != MCDisassembler::Fail)
503519 return Result;
504520
521+ // Try to decode to a MOVW instruction
522+ Result = decodeMoveWord (Instr, Insn, Address, this );
523+ if (Result != MCDisassembler::Fail)
524+ return Result;
525+
505526 // Try to decode to a load/store instruction. ST/LD need a specified
506527 // DecoderMethod, as they already have a specified PostEncoderMethod.
507528 Result = decodeLoadStore (Instr, Insn, Address, this );
0 commit comments