[PATCH] D143901: [AVR] Fix inaccurate offsets in PC relative branch instructions

Ben Shi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 13 03:53:52 PST 2023


benshi001 created this revision.
benshi001 added reviewers: aykevl, jacquesguan.
Herald added subscribers: Jim, hiraditya, dylanmckay.
Herald added a project: All.
benshi001 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

In avr-gcc, the destination of "rjmp label + offset" is address
'label + offset', while destination of "rjmp . + offset" is
'address_of_rjmp + offset + 2'.

Clang is in accordance with avr-gcc for "rjmp label + offset", but
emits incorrect destination of "rjmp . + offset" to 'address_of_rjmp + offset'.

This patch fixes the above issue.

Fixes https://github.com/llvm/llvm-project/issues/60019


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D143901

Files:
  llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp
  llvm/test/MC/AVR/inst-brbc.s
  llvm/test/MC/AVR/inst-brbs.s
  llvm/test/MC/AVR/inst-family-cond-branch.s
  llvm/test/MC/AVR/inst-rcall.s
  llvm/test/MC/AVR/inst-rjmp.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143901.496922.patch
Type: text/x-patch
Size: 8968 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230213/eb7d773a/attachment.bin>


More information about the llvm-commits mailing list