<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/63609>63609</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [AVR] llvm-mc produces wrong instructions for RJMP
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          257m
      </td>
    </tr>
</table>

<pre>
    I am running the command to turn a file of avr assembly into an object
`llvm-mc -filetype=obj -arch=avr -mcpu=atmeg328p all.s`

Here is the assembly file:
```
.text
.set __tmp_reg__, 0
.set __zero_reg__, 1
.set __SREG__, 63
.set __SP_H__, 62
.set __SP_L__, 61
    .file   "llvm-link"
    .globl  main ; -- Begin function main
    .p2align    1
    .type main,@function
main:                                   ; @main
; %bb.0:
    ldi r24, -1
.LBB0_1:                                ; =>This Inner Loop Header: Depth=1
    out 4, r24
    out 5, r1
    rjmp .LBB0_1
.Lfunc_end0:
    .size   main, .Lfunc_end0-main
 ; -- End function
```

The problem is instead of producing rjmp -6 as expected it produces rjmp +0. This is a obvious bug because it would just create an infinite loop.

Here is the objdump all.o
```
obj/all.o:      file format elf32-avr

Disassembly of section .text:

00000000 <main>:
 0: 8f ef         ldi     r24, 0xff
       2: 84 b9         out     0x4, r24
       4: 15 b8         out     0x5, r1
       6: 00 c0 rjmp    .+0
```

6: should be 06 c8 not 00 c0. When I pass the assembly to avra (without the clang directives) it produces the correct hex. 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVUtv4zYQ_jX0ZSCBph5rHXxYr-MmRQos0kV7NEhpJNGlSIGknGR_fUFKcezs9kEEjMxvXpz5Zsidk51G3JJiR4r9ik--N3bLik_DSpjmdfsAfAA7aS11B75HqM0wcN2AN-Anq4FDKxWCaYGfLXDncBDqFaT2BrgGI05Ye0L3hH4mJVXqPCRDDUlQ8q8jkmxvxA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