static DecodeStatus decodeMemri(MCInst &Inst, unsigned Insn, uint64_t Address,
const MCDisassembler *Decoder);
+static DecodeStatus decodeFBRk(MCInst &Inst, unsigned Insn, uint64_t Address,
+ const MCDisassembler *Decoder);
+
static DecodeStatus decodeLoadStore(MCInst &Inst, unsigned Insn,
uint64_t Address,
const MCDisassembler *Decoder);
return MCDisassembler::Success;
}
+static DecodeStatus decodeFBRk(MCInst &Inst, unsigned Insn, uint64_t Address,
+ const MCDisassembler *Decoder) {
+ // Decode the opcode.
+ switch (Insn & 0xf000) {
+ case 0xc000:
+ Inst.setOpcode(AVR::RJMPk);
+ break;
+ case 0xd000:
+ Inst.setOpcode(AVR::RCALLk);
+ break;
+ default: // Unknown relative branch instruction.
+ return MCDisassembler::Fail;
+ }
+ // Decode the relative offset.
+ int16_t Offset = ((int16_t)((Insn & 0xfff) << 4)) >> 3;
+ Inst.addOperand(MCOperand::createImm(Offset));
+ return MCDisassembler::Success;
+}
+
static DecodeStatus decodeLoadStore(MCInst &Inst, unsigned Insn,
uint64_t Address,
const MCDisassembler *Decoder) {
if ((Insn & 0xf000) == 0x8000) {
unsigned RegBase = (Insn & 0x8) ? AVR::R29R28 : AVR::R31R30;
unsigned Offset = Insn & 7; // We need not consider offset > 7.
- if ((Insn & 0x200) == 0) { // Decode LDD.
+ if ((Insn & 0x200) == 0) { // Decode LDD.
Inst.setOpcode(AVR::LDDRdPtrQ);
Inst.addOperand(MCOperand::createReg(RegVal));
Inst.addOperand(MCOperand::createReg(RegBase));
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s \
+; RUN: | llvm-objdump -d - | FileCheck --check-prefix=INST %s
foo:
rcall .-8
rcall .+12
rcall .+46
+ .short 0xdfea
; CHECK: rcall .Ltmp0+0 ; encoding: [A,0b1101AAAA]
; CHECK: ; fixup A - offset: 0, value: .Ltmp0+0, kind: fixup_13_pcrel
; CHECK: rcall .Ltmp3+46 ; encoding: [A,0b1101AAAA]
; CHECK: ; fixup A - offset: 0, value: .Ltmp3+46, kind: fixup_13_pcrel
+; INST: rcall .+0
+; INST: rcall .+0
+; INST: rcall .+0
+; INST: rcall .+0
+; INST: rcall .-44