[llvm] [AVR] Emit relocation record for local branch (PR #145291)
Tom Vijlbrief via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 24 06:49:37 PDT 2025
https://github.com/tomtor updated https://github.com/llvm/llvm-project/pull/145291
>From ac2988a0578a0febd504336e1cdba11bed1b821b Mon Sep 17 00:00:00 2001
From: Tom Vijlbrief <tvijlbrief at gmail.com>
Date: Mon, 23 Jun 2025 10:41:09 +0200
Subject: [PATCH] [AVR] Emit relocation record for local branch
---
.../Target/AVR/MCTargetDesc/AVRAsmBackend.cpp | 14 +---------
.../AVR/branch-relaxation-long-backward.ll | 12 ++++++---
.../AVR/branch-relaxation-long-forward.ll | 12 ++++++---
llvm/test/CodeGen/AVR/jmp.ll | 3 ++-
llvm/test/MC/AVR/inst-brbc.s | 6 +++--
llvm/test/MC/AVR/inst-brbs.s | 6 +++--
llvm/test/MC/AVR/inst-brcc.s | 12 ++++++---
llvm/test/MC/AVR/inst-brcs.s | 11 +++++---
llvm/test/MC/AVR/inst-breq.s | 10 ++++---
llvm/test/MC/AVR/inst-brge.s | 9 ++++---
llvm/test/MC/AVR/inst-brhc.s | 9 ++++---
llvm/test/MC/AVR/inst-brhs.s | 9 ++++---
llvm/test/MC/AVR/inst-brid.s | 9 ++++---
llvm/test/MC/AVR/inst-brie.s | 9 ++++---
llvm/test/MC/AVR/inst-brlo.s | 9 ++++---
llvm/test/MC/AVR/inst-brlt.s | 9 ++++---
llvm/test/MC/AVR/inst-brmi.s | 9 ++++---
llvm/test/MC/AVR/inst-brne.s | 10 ++++---
llvm/test/MC/AVR/inst-brpl.s | 9 ++++---
llvm/test/MC/AVR/inst-brsh.s | 9 ++++---
llvm/test/MC/AVR/inst-brtc.s | 9 ++++---
llvm/test/MC/AVR/inst-brts.s | 9 ++++---
llvm/test/MC/AVR/inst-brvc.s | 9 ++++---
llvm/test/MC/AVR/inst-brvs.s | 9 ++++---
llvm/test/MC/AVR/inst-rcall.s | 12 +++++----
llvm/test/MC/AVR/inst-rjmp.s | 26 +++++++++++++------
26 files changed, 163 insertions(+), 97 deletions(-)
diff --git a/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp b/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp
index 41341387b42c2..b26bbdb514c24 100644
--- a/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp
+++ b/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp
@@ -520,19 +520,7 @@ bool AVRAsmBackend::forceRelocation(const MCFragment &F, const MCFixup &Fixup,
return false;
case AVR::fixup_7_pcrel:
- case AVR::fixup_13_pcrel: {
- uint64_t Offset = Target.getConstant();
- uint64_t Size = AVRAsmBackend::getFixupKindInfo(Fixup.getKind()).TargetSize;
-
- // If the jump is too large to encode it, fall back to a relocation.
- //
- // Note that trying to actually link that relocation *would* fail, but the
- // hopes are that the module we're currently compiling won't be actually
- // linked to the final binary.
- return !adjust::adjustRelativeBranch(Size, Fixup, Offset,
- getContext().getSubtargetInfo());
- }
-
+ case AVR::fixup_13_pcrel:
case AVR::fixup_call:
return true;
}
diff --git a/llvm/test/CodeGen/AVR/branch-relaxation-long-backward.ll b/llvm/test/CodeGen/AVR/branch-relaxation-long-backward.ll
index 3562b93a22503..f49624d7ea059 100644
--- a/llvm/test/CodeGen/AVR/branch-relaxation-long-backward.ll
+++ b/llvm/test/CodeGen/AVR/branch-relaxation-long-backward.ll
@@ -5,15 +5,18 @@
; ATTINY85: <main>:
; ATTINY85-NEXT: andi r24, 0x1
; ATTINY85: cpi r24, 0x0
-; ATTINY85-NEXT: breq .+2
-; ATTINY85-NEXT: rjmp .+4086
+; ATTINY85-NEXT: breq .-2
+; ATTINY85-NEXT: R_AVR_7_PCREL .text+0x100c
+; ATTINY85-NEXT: rjmp .-2
+; ATTINY85-NEXT: R_AVR_13_PCREL .text+0x2
; ATTINY85: ldi r24, 0x3
; ATTINY85-NEXT: ret
; AVR25: <main>:
; AVR25-NEXT: andi r24, 0x1
; AVR25: cpi r24, 0x0
-; AVR25-NEXT: breq .+2
+; AVR25-NEXT: breq .-2
+; AVR25-NEXT: R_AVR_7_PCREL .text+0x100c
; AVR25-NEXT: rjmp .-2
; AVR25-NEXT: R_AVR_13_PCREL .text+0x2
; AVR25: ldi r24, 0x3
@@ -22,7 +25,8 @@
; AVR3: <main>:
; AVR3-NEXT: andi r24, 0x1
; AVR3: cpi r24, 0x0
-; AVR3-NEXT: breq .+4
+; AVR3-NEXT: breq .-2
+; AVR3-NEXT: R_AVR_7_PCREL .text+0x100e
; AVR3-NEXT: jmp 0x0
; AVR3-NEXT: R_AVR_CALL .text+0x2
; AVR3: ldi r24, 0x3
diff --git a/llvm/test/CodeGen/AVR/branch-relaxation-long-forward.ll b/llvm/test/CodeGen/AVR/branch-relaxation-long-forward.ll
index a51cf42d5de8b..de4d4465a021d 100644
--- a/llvm/test/CodeGen/AVR/branch-relaxation-long-forward.ll
+++ b/llvm/test/CodeGen/AVR/branch-relaxation-long-forward.ll
@@ -5,15 +5,18 @@
; ATTINY85: <main>:
; ATTINY85-NEXT: andi r24, 0x1
; ATTINY85-NEXT: cpi r24, 0x0
-; ATTINY85-NEXT: brne .+2
-; ATTINY85-NEXT: rjmp .-4092
+; ATTINY85-NEXT: brne .-2
+; ATTINY85-NEXT: R_AVR_7_PCREL .text+0x8
+; ATTINY85-NEXT: rjmp .-2
+; ATTINY85-NEXT: R_AVR_13_PCREL .text+0x100c
; ATTINY85: ldi r24, 0x3
; ATTINY85-NEXT: ret
; AVR25: <main>:
; AVR25-NEXT: andi r24, 0x1
; AVR25-NEXT: cpi r24, 0x0
-; AVR25-NEXT: brne .+2
+; AVR25-NEXT: brne .-2
+; AVR25-NEXT: R_AVR_7_PCREL .text+0x8
; AVR25-NEXT: rjmp .-2
; AVR25-NEXT: R_AVR_13_PCREL .text+0x100c
; AVR25: ldi r24, 0x3
@@ -22,7 +25,8 @@
; AVR3: <main>:
; AVR3-NEXT: andi r24, 0x1
; AVR3-NEXT: cpi r24, 0x0
-; AVR3-NEXT: brne .+4
+; AVR3-NEXT: brne .-2
+; AVR3-NEXT: R_AVR_7_PCREL .text+0xa
; AVR3-NEXT: jmp 0x0
; AVR3-NEXT: R_AVR_CALL .text+0x100e
; AVR3: ldi r24, 0x3
diff --git a/llvm/test/CodeGen/AVR/jmp.ll b/llvm/test/CodeGen/AVR/jmp.ll
index 95dfff4836b4e..1cbc6375dea17 100644
--- a/llvm/test/CodeGen/AVR/jmp.ll
+++ b/llvm/test/CodeGen/AVR/jmp.ll
@@ -18,7 +18,8 @@ declare i8 @bar(i8);
; CHECK: rcall .-2
; CHECK-NEXT: 00000000: R_AVR_13_PCREL bar
; CHECK-NEXT: cpi r24, 0x7b
-; CHECK-NEXT: brne .+4
+; CHECK-NEXT: brne .-2
+; CHECK-NEXT: R_AVR_7_PCREL .text+0xa
; CHECK-NEXT: ldi r24, 0x64
; CHECK-NEXT: ret
; CHECK-NEXT: ldi r24, 0xc8
diff --git a/llvm/test/MC/AVR/inst-brbc.s b/llvm/test/MC/AVR/inst-brbc.s
index 6d96393b42ad1..bf73188cf7c3f 100644
--- a/llvm/test/MC/AVR/inst-brbc.s
+++ b/llvm/test/MC/AVR/inst-brbc.s
@@ -15,8 +15,10 @@ foo:
; CHECK: brcc .Ltmp1-16+2 ; encoding: [0bAAAAA000,0b111101AA]
; INST-LABEL: <foo>:
-; INST-NEXT: 23 f4 brvc .+8
-; INST-NEXT: c0 f7 brsh .-16
+; INST-NEXT: fb f7 brvc .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0xa
+; INST-NEXT: f8 f7 brsh .-2
+; INST-NEXT: R_AVR_7_PCREL .text-0xc
; INST-NEXT: 59 f7 brne .-42
; INST-NEXT: 52 f7 brpl .-44
; INST-NEXT: 4c f7 brge .-46
diff --git a/llvm/test/MC/AVR/inst-brbs.s b/llvm/test/MC/AVR/inst-brbs.s
index 9dde5e16abde3..3e64ebce542b8 100644
--- a/llvm/test/MC/AVR/inst-brbs.s
+++ b/llvm/test/MC/AVR/inst-brbs.s
@@ -14,8 +14,10 @@ foo:
; CHECK: brcs .Ltmp1-12+2 ; encoding: [0bAAAAA000,0b111100AA]
; INST-LABEL: <foo>:
-; INST-NEXT: 23 f0 brvs .+8
-; INST-NEXT: d0 f3 brlo .-12
+; INST-NEXT: fb f3 brvs .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0xa
+; INST-NEXT: f8 f3 brlo .-2
+; INST-NEXT: R_AVR_7_PCREL .text-0x8
; INST-NEXT: 59 f3 breq .-42
; INST-NEXT: 52 f3 brmi .-44
; INST-NEXT: 4c f3 brlt .-46
diff --git a/llvm/test/MC/AVR/inst-brcc.s b/llvm/test/MC/AVR/inst-brcc.s
index 0edefa167ac44..eba05e06bb43b 100644
--- a/llvm/test/MC/AVR/inst-brcc.s
+++ b/llvm/test/MC/AVR/inst-brcc.s
@@ -18,7 +18,11 @@ bar:
; CHECK: brcc bar ; encoding: [0bAAAAA000,0b111101AA]
; INST-LABEL: <foo>:
-; INST-NEXT: 08 f5 brsh .+66
-; INST-NEXT: a8 f7 brsh .-22
-; INST-NEXT: 08 f5 brsh .+66
-; INST-NEXT: 00 f4 brsh .+0
+; INST-NEXT: f8 f7 brsh .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x44
+; INST-NEXT: f8 f7 brsh .-2
+; INST-NEXT: R_AVR_7_PCREL .text-0x12
+; INST-NEXT: f8 f7 brsh .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x48
+; INST-NEXT: f8 f7 brsh .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x8
diff --git a/llvm/test/MC/AVR/inst-brcs.s b/llvm/test/MC/AVR/inst-brcs.s
index ea8a3f527c9e4..1aea7216a13de 100644
--- a/llvm/test/MC/AVR/inst-brcs.s
+++ b/llvm/test/MC/AVR/inst-brcs.s
@@ -18,7 +18,10 @@ bar:
; CHECK: brcs bar ; encoding: [0bAAAAA000,0b111100AA]
; INST-LABEL: <foo>:
-; INST-NEXT: 20 f0 brlo .+8
-; INST-NEXT: 10 f0 brlo .+4
-; INST-NEXT: 20 f0 brlo .+8
-; INST-NEXT: 00 f0 brlo .+0
+; INST-NEXT: f8 f3 brlo .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0xa
+; INST-NEXT: f8 f3 brlo .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x8
+; INST-NEXT: f8 f3 brlo .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0xe
+; INST-NEXT: f8 f3 brlo .-2
diff --git a/llvm/test/MC/AVR/inst-breq.s b/llvm/test/MC/AVR/inst-breq.s
index d916f6dc18c8f..59bbb13df13e0 100644
--- a/llvm/test/MC/AVR/inst-breq.s
+++ b/llvm/test/MC/AVR/inst-breq.s
@@ -18,7 +18,9 @@ bar:
; CHECK: brbs 1, bar ; encoding: [0bAAAAA001,0b111100AA]
; INST-LABEL: <foo>:
-; INST-NEXT: b9 f3 breq .-18
-; INST-NEXT: d1 f3 breq .-12
-; INST-NEXT: b9 f3 breq .-18
-; INST-NEXT: 01 f0 breq .+0
+; INST-NEXT: f9 f3 breq .-2
+; INST-NEXT: R_AVR_7_PCREL .text-0x10
+; INST-NEXT: f9 f3 breq .-2
+; INST-NEXT: R_AVR_7_PCREL .text-0x8
+; INST-NEXT: f9 f3 breq .-2
+; INST-NEXT: R_AVR_7_PCREL .text-0xc
diff --git a/llvm/test/MC/AVR/inst-brge.s b/llvm/test/MC/AVR/inst-brge.s
index 3a8fd727d773e..ed96d8961ba16 100644
--- a/llvm/test/MC/AVR/inst-brge.s
+++ b/llvm/test/MC/AVR/inst-brge.s
@@ -16,6 +16,9 @@ bar:
; CHECK: brge bar ; encoding: [0bAAAAA100,0b111101AA]
; INST-LABEL: <foo>:
-; INST-NEXT: cc f4 brge .+50
-; INST-NEXT: ac f4 brge .+42
-; INST-NEXT: 04 f4 brge .+0
+; INST-NEXT: fc f7 brge .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x34
+; INST-NEXT: fc f7 brge .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x2e
+; INST-NEXT: fc f7 brge .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x6
diff --git a/llvm/test/MC/AVR/inst-brhc.s b/llvm/test/MC/AVR/inst-brhc.s
index 4fc55b6ab0347..8421c9112edd6 100644
--- a/llvm/test/MC/AVR/inst-brhc.s
+++ b/llvm/test/MC/AVR/inst-brhc.s
@@ -16,6 +16,9 @@ bar:
; CHECK: brhc bar ; encoding: [0bAAAAA101,0b111101AA]
; INST-LABEL: <foo>:
-; INST-NEXT: 35 f4 brhc .+12
-; INST-NEXT: 3d f4 brhc .+14
-; INST-NEXT: 05 f4 brhc .+0
+; INST-NEXT: fd f7 brhc .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0xe
+; INST-NEXT: fd f7 brhc .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x12
+; INST-NEXT: fd f7 brhc .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x6
diff --git a/llvm/test/MC/AVR/inst-brhs.s b/llvm/test/MC/AVR/inst-brhs.s
index d0968753cded2..a3777b40b25d0 100644
--- a/llvm/test/MC/AVR/inst-brhs.s
+++ b/llvm/test/MC/AVR/inst-brhs.s
@@ -16,6 +16,9 @@ bar:
; CHECK: brhs bar ; encoding: [0bAAAAA101,0b111100AA]
; INST-LABEL: <foo>:
-; INST-NEXT: fd f2 brhs .-66
-; INST-NEXT: 3d f0 brhs .+14
-; INST-NEXT: 05 f0 brhs .+0
+; INST-NEXT: fd f3 brhs .-2
+; INST-NEXT: R_AVR_7_PCREL .text-0x40
+; INST-NEXT: fd f3 brhs .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x12
+; INST-NEXT: fd f3 brhs .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x6
diff --git a/llvm/test/MC/AVR/inst-brid.s b/llvm/test/MC/AVR/inst-brid.s
index 2a3a30f905cf5..888ae02ed6522 100644
--- a/llvm/test/MC/AVR/inst-brid.s
+++ b/llvm/test/MC/AVR/inst-brid.s
@@ -16,6 +16,9 @@ bar:
; CHECK: brid bar ; encoding: [0bAAAAA111,0b111101AA]
; INST-LABEL: <foo>:
-; INST-NEXT: af f4 brid .+42
-; INST-NEXT: ff f4 brid .+62
-; INST-NEXT: 07 f4 brid .+0
+; INST-NEXT: ff f7 brid .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x2c
+; INST-NEXT: ff f7 brid .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x42
+; INST-NEXT: ff f7 brid .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x6
diff --git a/llvm/test/MC/AVR/inst-brie.s b/llvm/test/MC/AVR/inst-brie.s
index 4f867ae99852a..1d175f184baa7 100644
--- a/llvm/test/MC/AVR/inst-brie.s
+++ b/llvm/test/MC/AVR/inst-brie.s
@@ -16,6 +16,9 @@ bar:
; CHECK: brie bar ; encoding: [0bAAAAA111,0b111100AA]
; INST-LABEL: <foo>:
-; INST-NEXT: 57 f0 brie .+20
-; INST-NEXT: a7 f0 brie .+40
-; INST-NEXT: 07 f0 brie .+0
+; INST-NEXT: ff f3 brie .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x16
+; INST-NEXT: ff f3 brie .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x2c
+; INST-NEXT: ff f3 brie .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x6
diff --git a/llvm/test/MC/AVR/inst-brlo.s b/llvm/test/MC/AVR/inst-brlo.s
index 48499aa69926b..4b57e77ed77b1 100644
--- a/llvm/test/MC/AVR/inst-brlo.s
+++ b/llvm/test/MC/AVR/inst-brlo.s
@@ -16,6 +16,9 @@ bar:
; CHECK: brlo bar ; encoding: [0bAAAAA000,0b111100AA]
; INST-LABEL: <foo>:
-; INST-NEXT: 30 f0 brlo .+12
-; INST-NEXT: 70 f0 brlo .+28
-; INST-NEXT: 00 f0 brlo .+0
+; INST-NEXT: f8 f3 brlo .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0xe
+; INST-NEXT: f8 f3 brlo .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x20
+; INST-NEXT: f8 f3 brlo .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x6
diff --git a/llvm/test/MC/AVR/inst-brlt.s b/llvm/test/MC/AVR/inst-brlt.s
index e16fd05b3e144..58e57c4dc7e1d 100644
--- a/llvm/test/MC/AVR/inst-brlt.s
+++ b/llvm/test/MC/AVR/inst-brlt.s
@@ -16,6 +16,9 @@ bar:
; CHECK: brlt bar ; encoding: [0bAAAAA100,0b111100AA]
; INST-LABEL: <foo>:
-; INST-NEXT: 44 f0 brlt .+16
-; INST-NEXT: 0c f0 brlt .+2
-; INST-NEXT: 04 f0 brlt .+0
+; INST-NEXT: fc f3 brlt .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x12
+; INST-NEXT: fc f3 brlt .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x6
+; INST-NEXT: fc f3 brlt .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x6
diff --git a/llvm/test/MC/AVR/inst-brmi.s b/llvm/test/MC/AVR/inst-brmi.s
index 0d46af8b75969..c40644885fdcf 100644
--- a/llvm/test/MC/AVR/inst-brmi.s
+++ b/llvm/test/MC/AVR/inst-brmi.s
@@ -16,6 +16,9 @@ bar:
; CHECK: brmi bar ; encoding: [0bAAAAA010,0b111100AA]
; INST-LABEL: <foo>:
-; INST-NEXT: 0a f1 brmi .+66
-; INST-NEXT: ea f0 brmi .+58
-; INST-NEXT: 02 f0 brmi .+0
+; INST-NEXT: fa f3 brmi .-2
+; INST-NEXT: VR_7_PCREL .text+0x44
+; INST-NEXT: fa f3 brmi .-2
+; INST-NEXT: VR_7_PCREL .text+0x3e
+; INST-NEXT: fa f3 brmi .-2
+; INST-NEXT: VR_7_PCREL .text+0x6
diff --git a/llvm/test/MC/AVR/inst-brne.s b/llvm/test/MC/AVR/inst-brne.s
index e87813a60b504..cf7e70d919659 100644
--- a/llvm/test/MC/AVR/inst-brne.s
+++ b/llvm/test/MC/AVR/inst-brne.s
@@ -18,7 +18,9 @@ bar:
; CHECK: brbc 1, bar ; encoding: [0bAAAAA001,0b111101AA]
; INST-LABEL: <foo>:
-; INST-NEXT: 29 f4 brne .+10
-; INST-NEXT: 09 f4 brne .+2
-; INST-NEXT: 29 f4 brne .+10
-; INST-NEXT: 01 f4 brne .+0
+; INST-NEXT: f9 f7 brne .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0xc
+; INST-NEXT: f9 f7 brne .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x6
+; INST-NEXT: f9 f7 brne .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x10
diff --git a/llvm/test/MC/AVR/inst-brpl.s b/llvm/test/MC/AVR/inst-brpl.s
index 34877961bf328..9049e24197b89 100644
--- a/llvm/test/MC/AVR/inst-brpl.s
+++ b/llvm/test/MC/AVR/inst-brpl.s
@@ -16,6 +16,9 @@ bar:
; CHECK: brpl bar ; encoding: [0bAAAAA010,0b111101AA]
; INST-LABEL: <foo>:
-; INST-NEXT: d2 f7 brpl .-12
-; INST-NEXT: 4a f4 brpl .+18
-; INST-NEXT: 02 f4 brpl .+0
+; INST-NEXT: fa f7 brpl .-2
+; INST-NEXT: R_AVR_7_PCREL .text-0xa
+; INST-NEXT: fa f7 brpl .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x16
+; INST-NEXT: fa f7 brpl .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x6
diff --git a/llvm/test/MC/AVR/inst-brsh.s b/llvm/test/MC/AVR/inst-brsh.s
index be0a06c445e65..0f32fbae73357 100644
--- a/llvm/test/MC/AVR/inst-brsh.s
+++ b/llvm/test/MC/AVR/inst-brsh.s
@@ -16,6 +16,9 @@ bar:
; CHECK: brsh bar ; encoding: [0bAAAAA000,0b111101AA]
; INST-LABEL: <foo>:
-; INST-NEXT: 80 f4 brsh .+32
-; INST-NEXT: 18 f5 brsh .+70
-; INST-NEXT: 00 f4 brsh .+0
+; INST-NEXT: f8 f7 brsh .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x22
+; INST-NEXT: f8 f7 brsh .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x4a
+; INST-NEXT: f8 f7 brsh .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x6
diff --git a/llvm/test/MC/AVR/inst-brtc.s b/llvm/test/MC/AVR/inst-brtc.s
index 312c55c3f4729..731b495a787ea 100644
--- a/llvm/test/MC/AVR/inst-brtc.s
+++ b/llvm/test/MC/AVR/inst-brtc.s
@@ -16,6 +16,9 @@ bar:
; CHECK: brtc bar ; encoding: [0bAAAAA110,0b111101AA]
; INST-LABEL: <foo>:
-; INST-NEXT: d6 f4 brtc .+52
-; INST-NEXT: ce f4 brtc .+50
-; INST-NEXT: 06 f4 brtc .+0
+; INST-NEXT: fe f7 brtc .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x36
+; INST-NEXT: fe f7 brtc .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x36
+; INST-NEXT: fe f7 brtc .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x6
diff --git a/llvm/test/MC/AVR/inst-brts.s b/llvm/test/MC/AVR/inst-brts.s
index 40ef6af5eef16..bb00acb55d28c 100644
--- a/llvm/test/MC/AVR/inst-brts.s
+++ b/llvm/test/MC/AVR/inst-brts.s
@@ -16,6 +16,9 @@ bar:
; CHECK: brts bar ; encoding: [0bAAAAA110,0b111100AA]
; INST-LABEL: <foo>:
-; INST-NEXT: 4e f0 brts .+18
-; INST-NEXT: 5e f0 brts .+22
-; INST-NEXT: 06 f0 brts .+0
+; INST-NEXT: fe f3 brts .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x14
+; INST-NEXT: fe f3 brts .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x1a
+; INST-NEXT: fe f3 brts .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x6
diff --git a/llvm/test/MC/AVR/inst-brvc.s b/llvm/test/MC/AVR/inst-brvc.s
index d493ff1fbf544..f65e735440274 100644
--- a/llvm/test/MC/AVR/inst-brvc.s
+++ b/llvm/test/MC/AVR/inst-brvc.s
@@ -16,6 +16,9 @@ bar:
; CHECK: brvc bar ; encoding: [0bAAAAA011,0b111101AA]
; INST-LABEL: <foo>:
-; INST-NEXT: 93 f7 brvc .-28
-; INST-NEXT: 0b f7 brvc .-62
-; INST-NEXT: 03 f4 brvc .+0
+; INST-NEXT: fb f7 brvc .-2
+; INST-NEXT: R_AVR_7_PCREL .text-0x1a
+; INST-NEXT: fb f7 brvc .-2
+; INST-NEXT: R_AVR_7_PCREL .text-0x3a
+; INST-NEXT: fb f7 brvc .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x6
diff --git a/llvm/test/MC/AVR/inst-brvs.s b/llvm/test/MC/AVR/inst-brvs.s
index 07755d8aea21f..a5b7e4b7904e6 100644
--- a/llvm/test/MC/AVR/inst-brvs.s
+++ b/llvm/test/MC/AVR/inst-brvs.s
@@ -16,6 +16,9 @@ bar:
; CHECK: brvs bar ; encoding: [0bAAAAA011,0b111100AA]
; INST-LABEL: <foo>:
-; INST-NEXT: 4b f0 brvs .+18
-; INST-NEXT: 83 f0 brvs .+32
-; INST-NEXT: 03 f0 brvs .+0
+; INST-NEXT: fb f3 brvs .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x14
+; INST-NEXT: fb f3 brvs .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x24
+; INST-NEXT: fb f3 brvs .-2
+; INST-NEXT: R_AVR_7_PCREL .text+0x6
diff --git a/llvm/test/MC/AVR/inst-rcall.s b/llvm/test/MC/AVR/inst-rcall.s
index 1da6e7f5dddf9..572153c15996b 100644
--- a/llvm/test/MC/AVR/inst-rcall.s
+++ b/llvm/test/MC/AVR/inst-rcall.s
@@ -17,8 +17,10 @@ foo:
; CHECK: rcall .Ltmp3+46+2 ; encoding: [A,0b1101AAAA]
; INST-LABEL: <foo>:
-; INST-NEXT: 00 d0 rcall .+0
-; INST-NEXT: fc df rcall .-8
-; INST-NEXT: 06 d0 rcall .+12
-; INST-NEXT: 17 d0 rcall .+46
-; INST-NEXT: ea df rcall .-44
+; INST-NEXT: ff df rcall .-2
+; INST-NEXT: R_AVR_13_PCREL .text+0x2
+; INST-NEXT: ff df rcall .-2
+; INST-NEXT: R_AVR_13_PCREL .text-0x4
+; INST-NEXT: ff df rcall .-2
+; INST-NEXT: R_AVR_13_PCREL .text+0x12
+; INST-NEXT: ff df rcall .-2
diff --git a/llvm/test/MC/AVR/inst-rjmp.s b/llvm/test/MC/AVR/inst-rjmp.s
index 6712319bbc268..6ac6343894cb8 100644
--- a/llvm/test/MC/AVR/inst-rjmp.s
+++ b/llvm/test/MC/AVR/inst-rjmp.s
@@ -33,18 +33,28 @@ x:
; CHECK: rjmp .Ltmp6+4094+2 ; encoding: [A,0b1100AAAA]
; INST-LABEL: <foo>:
-; INST-NEXT: 01 c0 rjmp .+2
; INST-NEXT: ff cf rjmp .-2
-; INST-NEXT: fd cf rjmp .-6
-; INST-NEXT: 04 c0 rjmp .+8
-; INST-NEXT: 01 c0 rjmp .+2
-; INST-NEXT: 00 c0 rjmp .+0
+; INST-NEXT: R_AVR_13_PCREL .text+0x4
+; INST-NEXT: ff cf rjmp .-2
+; INST-NEXT: R_AVR_13_PCREL .text+0x2
+; INST-NEXT: ff cf rjmp .-2
+; INST-NEXT: R_AVR_13_PCREL .text
+; INST-NEXT: ff cf rjmp .-2
+; INST-NEXT: R_AVR_13_PCREL .text+0x10
+; INST-NEXT: ff cf rjmp .-2
+; INST-NEXT: R_AVR_13_PCREL .text+0xc
+; INST-NEXT: ff cf rjmp .-2
+; INST-NEXT: R_AVR_13_PCREL .text+0xc
; INST-EMPTY:
; INST-LABEL: <end>:
-; INST-NEXT: fe cf rjmp .-4
-; INST-NEXT: fd cf rjmp .-6
+; INST-NEXT: ff cf rjmp .-2
+; INST-NEXT: R_AVR_13_PCREL .text+0xa
+; INST-NEXT: ff cf rjmp .-2
+; INST-NEXT: R_AVR_13_PCREL .text+0xa
; INST-EMPTY:
; INST-LABEL: <x>:
; INST-NEXT: ff cf rjmp .-2
+; INST-NEXT: R_AVR_13_PCREL .text+0x10
; INST-NEXT: 0f c0 rjmp .+30
-; INST-NEXT: ff c7 rjmp .+4094
+; INST-NEXT: ff cf rjmp .-2
+; INST-NEXT: R_AVR_13_PCREL .text+0x1014
More information about the llvm-commits
mailing list