[llvm] 5b2046c - [AVR] Disassemble register operands
Ayke van Laethem via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 24 10:36:11 PST 2020
Author: Ayke van Laethem
Date: 2020-02-24T19:35:51+01:00
New Revision: 5b2046c95c6701f8c8509b78a12a700c012789eb
URL: https://github.com/llvm/llvm-project/commit/5b2046c95c6701f8c8509b78a12a700c012789eb
DIFF: https://github.com/llvm/llvm-project/commit/5b2046c95c6701f8c8509b78a12a700c012789eb.diff
LOG: [AVR] Disassemble register operands
Simply by implementing a few functions I was able to correctly
disassemble a much larger amount of instructions.
Differential Revision: https://reviews.llvm.org/D74045
Added:
Modified:
llvm/lib/Target/AVR/Disassembler/AVRDisassembler.cpp
llvm/test/MC/AVR/inst-adc.s
llvm/test/MC/AVR/inst-add.s
llvm/test/MC/AVR/inst-adiw.s
llvm/test/MC/AVR/inst-and.s
llvm/test/MC/AVR/inst-andi.s
llvm/test/MC/AVR/inst-bld.s
llvm/test/MC/AVR/inst-bst.s
llvm/test/MC/AVR/inst-cbr.s
llvm/test/MC/AVR/inst-clr.s
llvm/test/MC/AVR/inst-cp.s
llvm/test/MC/AVR/inst-cpc.s
llvm/test/MC/AVR/inst-cpi.s
llvm/test/MC/AVR/inst-cpse.s
llvm/test/MC/AVR/inst-eor.s
llvm/test/MC/AVR/inst-ldi.s
llvm/test/MC/AVR/inst-lsl.s
llvm/test/MC/AVR/inst-mov.s
llvm/test/MC/AVR/inst-or.s
llvm/test/MC/AVR/inst-ori.s
llvm/test/MC/AVR/inst-rol.s
llvm/test/MC/AVR/inst-sbc.s
llvm/test/MC/AVR/inst-sbci.s
llvm/test/MC/AVR/inst-sbiw.s
llvm/test/MC/AVR/inst-sbr.s
llvm/test/MC/AVR/inst-ser.s
llvm/test/MC/AVR/inst-sub.s
llvm/test/MC/AVR/inst-subi.s
llvm/test/MC/AVR/inst-tst.s
Removed:
################################################################################
diff --git a/llvm/lib/Target/AVR/Disassembler/AVRDisassembler.cpp b/llvm/lib/Target/AVR/Disassembler/AVRDisassembler.cpp
index 694aee818f7c..3e1fd4503acd 100644
--- a/llvm/lib/Target/AVR/Disassembler/AVRDisassembler.cpp
+++ b/llvm/lib/Target/AVR/Disassembler/AVRDisassembler.cpp
@@ -57,18 +57,41 @@ extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAVRDisassembler() {
createAVRDisassembler);
}
+static const uint16_t GPRDecoderTable[] = {
+ AVR::R0, AVR::R1, AVR::R2, AVR::R3,
+ AVR::R4, AVR::R5, AVR::R6, AVR::R7,
+ AVR::R8, AVR::R9, AVR::R10, AVR::R11,
+ AVR::R12, AVR::R13, AVR::R14, AVR::R15,
+ AVR::R16, AVR::R17, AVR::R18, AVR::R19,
+ AVR::R20, AVR::R21, AVR::R22, AVR::R23,
+ AVR::R24, AVR::R25, AVR::R26, AVR::R27,
+ AVR::R28, AVR::R29, AVR::R30, AVR::R31,
+};
+
static DecodeStatus DecodeGPR8RegisterClass(MCInst &Inst, unsigned RegNo,
uint64_t Address, const void *Decoder) {
+ if (RegNo > 31)
+ return MCDisassembler::Fail;
+
+ unsigned Register = GPRDecoderTable[RegNo];
+ Inst.addOperand(MCOperand::createReg(Register));
return MCDisassembler::Success;
}
static DecodeStatus DecodeLD8RegisterClass(MCInst &Inst, unsigned RegNo,
uint64_t Address, const void *Decoder) {
+ if (RegNo > 15)
+ return MCDisassembler::Fail;
+
+ unsigned Register = GPRDecoderTable[RegNo+16];
+ Inst.addOperand(MCOperand::createReg(Register));
return MCDisassembler::Success;
}
static DecodeStatus DecodePTRREGSRegisterClass(MCInst &Inst, unsigned RegNo,
uint64_t Address, const void *Decoder) {
+ // Note: this function must be defined but does not seem to be called.
+ assert(false && "unimplemented: PTRREGS register class");
return MCDisassembler::Success;
}
diff --git a/llvm/test/MC/AVR/inst-adc.s b/llvm/test/MC/AVR/inst-adc.s
index 21ef6038b752..40c0f636cfbc 100644
--- a/llvm/test/MC/AVR/inst-adc.s
+++ b/llvm/test/MC/AVR/inst-adc.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -12,3 +13,8 @@ foo:
; CHECK: adc r15, r0 ; encoding: [0xf0,0x1c]
; CHECK: adc r16, r31 ; encoding: [0x0f,0x1f]
; CHECK: adc r31, r16 ; encoding: [0xf0,0x1f]
+
+; CHECK-INST: adc r0, r15
+; CHECK-INST: adc r15, r0
+; CHECK-INST: adc r16, r31
+; CHECK-INST: adc r31, r16
diff --git a/llvm/test/MC/AVR/inst-add.s b/llvm/test/MC/AVR/inst-add.s
index 0a42b5c7f755..37bc8a3c716c 100644
--- a/llvm/test/MC/AVR/inst-add.s
+++ b/llvm/test/MC/AVR/inst-add.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -12,3 +13,8 @@ foo:
; CHECK: add r15, r0 ; encoding: [0xf0,0x0c]
; CHECK: add r16, r31 ; encoding: [0x0f,0x0f]
; CHECK: add r31, r16 ; encoding: [0xf0,0x0f]
+
+; CHECK-INST: add r0, r15
+; CHECK-INST: add r15, r0
+; CHECK-INST: add r16, r31
+; CHECK-INST: add r31, r16
diff --git a/llvm/test/MC/AVR/inst-adiw.s b/llvm/test/MC/AVR/inst-adiw.s
index eeba76c608ce..d1009e79fe0b 100644
--- a/llvm/test/MC/AVR/inst-adiw.s
+++ b/llvm/test/MC/AVR/inst-adiw.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -mattr=addsubiw -show-encoding < %s | FileCheck %s
+; RUNx: llvm-mc -filetype=obj -triple avr -mattr=addsubiw < %s | llvm-objdump -d -mattr=addsubiw - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -25,3 +26,14 @@ foo:
; CHECK: adiw r24, SYMBOL ; encoding: [0b00AAAAAA,0x96]
; fixup A - offset: 0, value: SYMBOL, kind: fixup_6_adiw
+
+; CHECK-INST: adiw r26, 12
+; CHECK-INST: adiw r26, 63
+
+; CHECK-INST: adiw r28, 17
+; CHECK-INST: adiw r28, 0
+
+; CHECK-INST: adiw r30, 63
+; CHECK-INST: adiw r30, 3
+
+; CHECK-INST: adiw r24, 0
diff --git a/llvm/test/MC/AVR/inst-and.s b/llvm/test/MC/AVR/inst-and.s
index dcc9a25f5c5b..729361203e36 100644
--- a/llvm/test/MC/AVR/inst-and.s
+++ b/llvm/test/MC/AVR/inst-and.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -12,3 +13,8 @@ foo:
; CHECK: and r15, r0 ; encoding: [0xf0,0x20]
; CHECK: and r16, r31 ; encoding: [0x0f,0x23]
; CHECK: and r31, r16 ; encoding: [0xf0,0x23]
+
+; CHECK-INST: and r0, r15
+; CHECK-INST: and r15, r0
+; CHECK-INST: and r16, r31
+; CHECK-INST: and r31, r16
diff --git a/llvm/test/MC/AVR/inst-andi.s b/llvm/test/MC/AVR/inst-andi.s
index 5ff6825fcd5f..ab90ea6257dc 100644
--- a/llvm/test/MC/AVR/inst-andi.s
+++ b/llvm/test/MC/AVR/inst-andi.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -17,3 +18,10 @@ foo:
; CHECK: andi r20, BAR ; encoding: [0x40'A',0x70]
; CHECK: ; fixup A - offset: 0, value: BAR, kind: fixup_ldi
+
+; CHECK-INST: andi r16, 255
+; CHECK-INST: andi r29, 190
+; CHECK-INST: andi r22, 172
+; CHECK-INST: andi r27, 92
+
+; CHECK-INST: andi r20, 0
diff --git a/llvm/test/MC/AVR/inst-bld.s b/llvm/test/MC/AVR/inst-bld.s
index b84dbe7a3e04..2c6e106602f6 100644
--- a/llvm/test/MC/AVR/inst-bld.s
+++ b/llvm/test/MC/AVR/inst-bld.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -12,3 +13,8 @@ foo:
; CHECK: bld r1, 1 ; encoding: [0x11,0xf8]
; CHECK: bld r0, 0 ; encoding: [0x00,0xf8]
; CHECK: bld r7, 2 ; encoding: [0x72,0xf8]
+
+; CHECK-INST: bld r3, 5
+; CHECK-INST: bld r1, 1
+; CHECK-INST: bld r0, 0
+; CHECK-INST: bld r7, 2
diff --git a/llvm/test/MC/AVR/inst-bst.s b/llvm/test/MC/AVR/inst-bst.s
index ec7f5a35a498..923e4fef7b92 100644
--- a/llvm/test/MC/AVR/inst-bst.s
+++ b/llvm/test/MC/AVR/inst-bst.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -12,3 +13,8 @@ foo:
; CHECK: bst r1, 1 ; encoding: [0x11,0xfa]
; CHECK: bst r0, 0 ; encoding: [0x00,0xfa]
; CHECK: bst r7, 2 ; encoding: [0x72,0xfa]
+
+; CHECK-INST: bst r3, 5
+; CHECK-INST: bst r1, 1
+; CHECK-INST: bst r0, 0
+; CHECK-INST: bst r7, 2
diff --git a/llvm/test/MC/AVR/inst-cbr.s b/llvm/test/MC/AVR/inst-cbr.s
index f85ae87dff0b..cb2a16022a5e 100644
--- a/llvm/test/MC/AVR/inst-cbr.s
+++ b/llvm/test/MC/AVR/inst-cbr.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -12,3 +13,8 @@ foo:
; CHECK: andi r24, -191 ; encoding: [0x81,0x74]
; CHECK: andi r20, -174 ; encoding: [0x42,0x75]
; CHECK: andi r31, -1 ; encoding: [0xff,0x7f]
+
+; CHECK-INST: andi r17, 47
+; CHECK-INST: andi r24, 65
+; CHECK-INST: andi r20, 82
+; CHECK-INST: andi r31, 255
diff --git a/llvm/test/MC/AVR/inst-clr.s b/llvm/test/MC/AVR/inst-clr.s
index f48ef8674466..e4cae8f30823 100644
--- a/llvm/test/MC/AVR/inst-clr.s
+++ b/llvm/test/MC/AVR/inst-clr.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -13,3 +14,7 @@ foo:
; CHECK: clr r5 ; encoding: [0x55,0x24]
; CHECK: clr r0 ; encoding: [0x00,0x24]
+; CHECK-INST: clr r2
+; CHECK-INST: clr r12
+; CHECK-INST: clr r5
+; CHECK-INST: clr r0
diff --git a/llvm/test/MC/AVR/inst-cp.s b/llvm/test/MC/AVR/inst-cp.s
index aa109dccc339..e7d41830c092 100644
--- a/llvm/test/MC/AVR/inst-cp.s
+++ b/llvm/test/MC/AVR/inst-cp.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -12,3 +13,8 @@ foo:
; CHECK: cp r19, r0 ; encoding: [0x30,0x15]
; CHECK: cp r15, r31 ; encoding: [0xff,0x16]
; CHECK: cp r0, r0 ; encoding: [0x00,0x14]
+
+; CHECK-INST: cp r12, r2
+; CHECK-INST: cp r19, r0
+; CHECK-INST: cp r15, r31
+; CHECK-INST: cp r0, r0
diff --git a/llvm/test/MC/AVR/inst-cpc.s b/llvm/test/MC/AVR/inst-cpc.s
index 286c9e285d1f..e29b7b1d8fc2 100644
--- a/llvm/test/MC/AVR/inst-cpc.s
+++ b/llvm/test/MC/AVR/inst-cpc.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -12,3 +13,8 @@ foo:
; CHECK: cp r20, r0 ; encoding: [0x40,0x15]
; CHECK: cp r10, r31 ; encoding: [0xaf,0x16]
; CHECK: cp r0, r0 ; encoding: [0x00,0x14]
+
+; CHECK-INST: cp r13, r12
+; CHECK-INST: cp r20, r0
+; CHECK-INST: cp r10, r31
+; CHECK-INST: cp r0, r0
diff --git a/llvm/test/MC/AVR/inst-cpi.s b/llvm/test/MC/AVR/inst-cpi.s
index a7f8616d88cf..d049eecd0e38 100644
--- a/llvm/test/MC/AVR/inst-cpi.s
+++ b/llvm/test/MC/AVR/inst-cpi.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -18,3 +19,8 @@ foo:
; CHECK: cpi r21, ear ; encoding: [0x50'A',0x30]
; CHECK: ; fixup A - offset: 0, value: ear, kind: fixup_ldi
+; CHECK-INST: cpi r16, 241
+; CHECK-INST: cpi r29, 190
+; CHECK-INST: cpi r22, 172
+; CHECK-INST: cpi r27, 92
+; CHECK-INST: cpi r21, 0
diff --git a/llvm/test/MC/AVR/inst-cpse.s b/llvm/test/MC/AVR/inst-cpse.s
index 1a2d375fa676..ffcd12edcfc8 100644
--- a/llvm/test/MC/AVR/inst-cpse.s
+++ b/llvm/test/MC/AVR/inst-cpse.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -12,3 +13,8 @@ foo:
; CHECK: cpse r9, r0 ; encoding: [0x90,0x10]
; CHECK: cpse r5, r31 ; encoding: [0x5f,0x12]
; CHECK: cpse r3, r3 ; encoding: [0x33,0x10]
+
+; CHECK-INST: cpse r2, r13
+; CHECK-INST: cpse r9, r0
+; CHECK-INST: cpse r5, r31
+; CHECK-INST: cpse r3, r3
diff --git a/llvm/test/MC/AVR/inst-eor.s b/llvm/test/MC/AVR/inst-eor.s
index c15820d2edee..eb3ded799ca7 100644
--- a/llvm/test/MC/AVR/inst-eor.s
+++ b/llvm/test/MC/AVR/inst-eor.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -12,3 +13,8 @@ foo:
; CHECK: eor r15, r0 ; encoding: [0xf0,0x24]
; CHECK: eor r16, r31 ; encoding: [0x0f,0x27]
; CHECK: eor r31, r16 ; encoding: [0xf0,0x27]
+
+; CHECK-INST: eor r0, r15
+; CHECK-INST: eor r15, r0
+; CHECK-INST: eor r16, r31
+; CHECK-INST: eor r31, r16
diff --git a/llvm/test/MC/AVR/inst-ldi.s b/llvm/test/MC/AVR/inst-ldi.s
index 77137dae83bc..9696a36b430b 100644
--- a/llvm/test/MC/AVR/inst-ldi.s
+++ b/llvm/test/MC/AVR/inst-ldi.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr -mattr=sram < %s | llvm-objdump -d -mattr=sram - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -15,3 +16,9 @@ foo:
; CHECK: ldi r21, SYMBOL+3 ; encoding: [0x50'A',0xe0]
; CHECK: ; fixup A - offset: 0, value: SYMBOL+3, kind: fixup_ldi
+
+; CHECK-INST: ldi r16, 241
+; CHECK-INST: ldi r29, 190
+; CHECK-INST: ldi r22, 172
+; CHECK-INST: ldi r27, 92
+; CHECK-INST: ldi r21, 0
diff --git a/llvm/test/MC/AVR/inst-lsl.s b/llvm/test/MC/AVR/inst-lsl.s
index 1501d205449c..deceac9f6f79 100644
--- a/llvm/test/MC/AVR/inst-lsl.s
+++ b/llvm/test/MC/AVR/inst-lsl.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -12,3 +13,8 @@ foo:
; CHECK: lsl r25 ; encoding: [0x99,0x0f]
; CHECK: lsl r5 ; encoding: [0x55,0x0c]
; CHECK: lsl r0 ; encoding: [0x00,0x0c]
+
+; CHECK-INST: lsl r31
+; CHECK-INST: lsl r25
+; CHECK-INST: lsl r5
+; CHECK-INST: lsl r0
diff --git a/llvm/test/MC/AVR/inst-mov.s b/llvm/test/MC/AVR/inst-mov.s
index 43240fc4d298..9808b007d75c 100644
--- a/llvm/test/MC/AVR/inst-mov.s
+++ b/llvm/test/MC/AVR/inst-mov.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -12,3 +13,8 @@ foo:
; CHECK: mov r9, r0 ; encoding: [0x90,0x2c]
; CHECK: mov r5, r31 ; encoding: [0x5f,0x2e]
; CHECK: mov r3, r3 ; encoding: [0x33,0x2c]
+
+; CHECK-INST: mov r2, r13
+; CHECK-INST: mov r9, r0
+; CHECK-INST: mov r5, r31
+; CHECK-INST: mov r3, r3
diff --git a/llvm/test/MC/AVR/inst-or.s b/llvm/test/MC/AVR/inst-or.s
index 01116f19ed9f..c3489639dddf 100644
--- a/llvm/test/MC/AVR/inst-or.s
+++ b/llvm/test/MC/AVR/inst-or.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -11,3 +12,8 @@ foo:
; CHECK: or r15, r0 ; encoding: [0xf0,0x28]
; CHECK: or r16, r31 ; encoding: [0x0f,0x2b]
; CHECK: or r31, r16 ; encoding: [0xf0,0x2b]
+
+; CHECK-INST: or r0, r15
+; CHECK-INST: or r15, r0
+; CHECK-INST: or r16, r31
+; CHECK-INST: or r31, r16
diff --git a/llvm/test/MC/AVR/inst-ori.s b/llvm/test/MC/AVR/inst-ori.s
index e8b1de50a2d0..dd374f21e9cd 100644
--- a/llvm/test/MC/AVR/inst-ori.s
+++ b/llvm/test/MC/AVR/inst-ori.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -17,3 +18,10 @@ foo:
; CHECK: ori r16, FOOBAR ; encoding: [A,0x60]
; CHECK: ; fixup A - offset: 0, value: FOOBAR, kind: fixup_ldi
+
+; CHECK-INST: ori r17, 208
+; CHECK-INST: ori r24, 190
+; CHECK-INST: ori r20, 173
+; CHECK-INST: ori r31, 0
+
+; CHECK-INST: ori r16, 0
diff --git a/llvm/test/MC/AVR/inst-rol.s b/llvm/test/MC/AVR/inst-rol.s
index 443b8e86864b..ffb266c63351 100644
--- a/llvm/test/MC/AVR/inst-rol.s
+++ b/llvm/test/MC/AVR/inst-rol.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -12,3 +13,8 @@ foo:
; CHECK: rol r25 ; encoding: [0x99,0x1f]
; CHECK: rol r5 ; encoding: [0x55,0x1c]
; CHECK: rol r0 ; encoding: [0x00,0x1c]
+
+; CHECK-INST: rol r31
+; CHECK-INST: rol r25
+; CHECK-INST: rol r5
+; CHECK-INST: rol r0
diff --git a/llvm/test/MC/AVR/inst-sbc.s b/llvm/test/MC/AVR/inst-sbc.s
index f9625f45a0e8..62872b0499ef 100644
--- a/llvm/test/MC/AVR/inst-sbc.s
+++ b/llvm/test/MC/AVR/inst-sbc.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -12,3 +13,8 @@ foo:
; CHECK: sbc r15, r0 ; encoding: [0xf0,0x08]
; CHECK: sbc r16, r31 ; encoding: [0x0f,0x0b]
; CHECK: sbc r31, r16 ; encoding: [0xf0,0x0b]
+
+; CHECK-INST: sbc r0, r15
+; CHECK-INST: sbc r15, r0
+; CHECK-INST: sbc r16, r31
+; CHECK-INST: sbc r31, r16
diff --git a/llvm/test/MC/AVR/inst-sbci.s b/llvm/test/MC/AVR/inst-sbci.s
index aad15238455a..459dad2d5435 100644
--- a/llvm/test/MC/AVR/inst-sbci.s
+++ b/llvm/test/MC/AVR/inst-sbci.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -16,3 +17,9 @@ foo:
; CHECK: sbci r22, FOO ; encoding: [0x60'A',0x40]
; CHECK: ; fixup A - offset: 0, value: FOO, kind: fixup_ldi
+
+; CHECK-INST: sbci r17, 21
+; CHECK-INST: sbci r23, 196
+; CHECK-INST: sbci r30, 244
+; CHECK-INST: sbci r19, 16
+; CHECK-INST: sbci r22, 0
diff --git a/llvm/test/MC/AVR/inst-sbiw.s b/llvm/test/MC/AVR/inst-sbiw.s
index 45904acba83c..abd2df854dec 100644
--- a/llvm/test/MC/AVR/inst-sbiw.s
+++ b/llvm/test/MC/AVR/inst-sbiw.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -mattr=addsubiw -show-encoding < %s | FileCheck %s
+; RUNx: llvm-mc -filetype=obj -triple avr -mattr=addsubiw < %s | llvm-objdump -d -mattr=addsubiw - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -31,3 +32,17 @@ foo:
; CHECK: sbiw r24, SYMBOL-1 ; encoding: [0b00AAAAAA,0x97]
; fixup A - offset: 0, value: SYMBOL-1, kind: fixup_6_adiw
+
+; CHECK-INST: sbiw r26, 54
+; CHECK-INST: sbiw X, 63
+
+; CHECK-INST: sbiw 28, 52
+; CHECK-INST: sbiw r28, 0
+
+; CHECK-INST: sbiw r30, 63
+; CHECK-INST: sbiw Z, 47
+
+; CHECK-INST: sbiw r24, 1
+; CHECK-INST: sbiw r24, 2
+
+; CHECK-INST: sbiw r24, SYMBOL-1
diff --git a/llvm/test/MC/AVR/inst-sbr.s b/llvm/test/MC/AVR/inst-sbr.s
index 0189055094f1..4d1c8983a0c5 100644
--- a/llvm/test/MC/AVR/inst-sbr.s
+++ b/llvm/test/MC/AVR/inst-sbr.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -16,3 +17,10 @@ foo:
; CHECK: ori r19, _start ; encoding: [0x30'A',0x60]
; CHECK: ; fixup A - offset: 0, value: _start, kind: fixup_ldi
+
+; CHECK-INST: ori r17, 208
+; CHECK-INST: ori r24, 190
+; CHECK-INST: ori r20, 173
+; CHECK-INST: ori r31, 0
+
+; CHECK-INST: ori r19, 0
diff --git a/llvm/test/MC/AVR/inst-ser.s b/llvm/test/MC/AVR/inst-ser.s
index 90d4cb19409a..ac2a5fe86c07 100644
--- a/llvm/test/MC/AVR/inst-ser.s
+++ b/llvm/test/MC/AVR/inst-ser.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -11,3 +12,8 @@ foo:
; CHECK: ldi r31, 255 ; encoding: [0xff,0xef]
; CHECK: ldi r27, 255 ; encoding: [0xbf,0xef]
; CHECK: ldi r31, 255 ; encoding: [0xff,0xef]
+
+; CHECK-INST: ldi r16, 255
+; CHECK-INST: ldi r31, 255
+; CHECK-INST: ldi r27, 255
+; CHECK-INST: ldi r31, 255
diff --git a/llvm/test/MC/AVR/inst-sub.s b/llvm/test/MC/AVR/inst-sub.s
index 8aafa5b433f4..04909af2c6bc 100644
--- a/llvm/test/MC/AVR/inst-sub.s
+++ b/llvm/test/MC/AVR/inst-sub.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -11,3 +12,8 @@ foo:
; CHECK: sub r15, r0 ; encoding: [0xf0,0x18]
; CHECK: sub r16, r31 ; encoding: [0x0f,0x1b]
; CHECK: sub r31, r16 ; encoding: [0xf0,0x1b]
+
+; CHECK-INST: sub r0, r15
+; CHECK-INST: sub r15, r0
+; CHECK-INST: sub r16, r31
+; CHECK-INST: sub r31, r16
diff --git a/llvm/test/MC/AVR/inst-subi.s b/llvm/test/MC/AVR/inst-subi.s
index 1fa7d6444c95..7c1cc03f652b 100644
--- a/llvm/test/MC/AVR/inst-subi.s
+++ b/llvm/test/MC/AVR/inst-subi.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -16,3 +17,10 @@ foo:
; CHECK: subi r20, EXTERN_SYMBOL+0 ; encoding: [0x40'A',0x50]
; CHECK: ; fixup A - offset: 0, value: EXTERN_SYMBOL+0, kind: fixup_ldi
+
+; CHECK-INST: subi r22, 82
+; CHECK-INST: subi r27, 39
+; CHECK-INST: subi r31, 244
+; CHECK-INST: subi r16, 144
+
+; CHECK-INST: subi r20, 0
diff --git a/llvm/test/MC/AVR/inst-tst.s b/llvm/test/MC/AVR/inst-tst.s
index 0380f09da9e5..93c80953adb4 100644
--- a/llvm/test/MC/AVR/inst-tst.s
+++ b/llvm/test/MC/AVR/inst-tst.s
@@ -1,4 +1,5 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
foo:
@@ -12,3 +13,8 @@ foo:
; CHECK: tst r14 ; encoding: [0xee,0x20]
; CHECK: tst r24 ; encoding: [0x88,0x23]
; CHECK: tst r12 ; encoding: [0xcc,0x20]
+
+; CHECK-INST: tst r3
+; CHECK-INST: tst r14
+; CHECK-INST: tst r24
+; CHECK-INST: tst r12
More information about the llvm-commits
mailing list