Skip to content

[AVR] Fix 16-bit LDDs with immediate overflows #104923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

Patryk27
Copy link
Contributor

16-bit loads are expanded into a pair of 8-bit loads, so a maximum offset of such load must be 62, not 63 - our current logic doesn't handle it properly and triggers:

assert(Imm <= 62 && "Offset is out of range");

... which this commit fixes.

Spotted in the wild at Rahix/avr-hal#573.

@Patryk27
Copy link
Contributor Author

cc @benshi001 🙂

@benshi001 benshi001 merged commit c7a4efa into llvm:main Aug 29, 2024
9 checks passed
@benshi001
Copy link
Member

LGTM, thanks!

@benshi001 benshi001 self-requested a review August 29, 2024 07:34
@Patryk27 Patryk27 deleted the fix-immediate-overflows branch September 2, 2024 10:21
llvmbot pushed a commit to llvmbot/llvm-project that referenced this pull request Sep 2, 2024
16-bit loads are expanded into a pair of 8-bit loads, so the maximum
offset of such 16-bit loads must be 62, not 63.

(cherry picked from commit c7a4efa)
tru pushed a commit to llvmbot/llvm-project that referenced this pull request Sep 24, 2024
16-bit loads are expanded into a pair of 8-bit loads, so the maximum
offset of such 16-bit loads must be 62, not 63.

(cherry picked from commit c7a4efa)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants