[llvm] [AVR] Fix parsing & emitting relative jumps (PR #102936)

Ben Shi via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 2 18:09:22 PDT 2024


================
@@ -1,24 +1,25 @@
 ; 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
+; RUN:     | llvm-objdump -dr - | FileCheck --check-prefix=INST %s
 
 foo:
-
   brbc 3, .+8
   brbc 0, .-16
   .short 0xf759
   .short 0xf752
   .short 0xf74c
   .short 0xf4c7
 
-; CHECK: brvc .Ltmp0+8              ; encoding: [0bAAAAA011,0b111101AA]
-; CHECK:                            ; fixup A - offset: 0, value: .Ltmp0+8, kind: fixup_7_pcrel
-; CHECK: brcc .Ltmp1-16             ; encoding: [0bAAAAA000,0b111101AA]
-; CHECK:                            ; fixup A - offset: 0, value: .Ltmp1-16, kind: fixup_7_pcrel
+; CHECK: brvc (.Ltmp0+8)+2   ; encoding: [0bAAAAA011,0b111101AA]
----------------
benshi001 wrote:

Though the generated binary is correct, which makes TinyGo fully work. The disassembly of llvm-objdump is not in accordance with avr-objdump. avr-objdump will output `1a:	23 f4       	brvc	.+8`, without an extra `+2`.

So can we also fix llvm-objdump ? BTW, is it possible to fix this issue by modification  in `adjustRelativeBranch`. (Sorry I have not enough time to investigate my suggestion)

https://github.com/llvm/llvm-project/pull/102936


More information about the llvm-commits mailing list