Repository navigation
alpha: sign-extend memory-format displacement - #3036
Merged
Merged
Conversation
Rot127
approved these changes
Aug 26, 2026
Rot127
requested changes
Aug 26, 2026
Collaborator
|
@Samin061 Ping :) |
Samin061
force-pushed
the
alpha-mem-disp-signext
branch
from
October 5, 2026 19:08
1539bf3 to
01e3f1f
Compare
Contributor
Author
|
Sorry for the delay. Rebased onto current next, no conflicts. #3034 added |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #3036 +/- ##
=======================================
Coverage ? 61.09%
=======================================
Files ? 243
Lines ? 56756
Branches ? 10063
=======================================
Hits ? 34676
Misses ? 16871
Partials ? 5209 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Rot127
approved these changes
Oct 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Your checklist for this pull request
Detailed description
The Alpha memory-format instructions (
lda, the integer loads/stores, the store-conditional forms, and thelds/ldt/sts/sttfloat loads and stores) carry a 16-bit displacement that the ISA treats as signed, but the decoder read it out of the instruction word as a plain unsigned field and never sign-extended it, so any displacement with bit 15 set decoded to a large positive value.cstool -d alpha 0xb0,0xb0,0x42,0x20shows it: the offset prints as0xb0b0andoperands[1].immis0xb0b0, where it should be-20304. The displacement is read in the shared decode macro at the four memory-format cases (indices 1, 22, 23, 24), each storingfieldFromInstruction_4(insn, 0, 16)straight into the operand. Casting that field throughint16_tat those four sites stores the signed offset, so the same word now decodes tolda $2,-0x4f50($2). Positive displacements are unaffected.Test plan
cstool -d alpha 0xb0,0xb0,0x42,0x20now printslda $2,-0x4f50($2)withoperands[1].imm = 0xffffffffffffb0b0. I added negative-displacement cases totests/MC/Alpha/insn-alpha.s.yamlcovering the integer, store-conditional and float-memory forms, and updated the two detail cases intests/details/alpha.yamlandtests/details/cs_common_details.yamlthat had captured the old unsigned value.Closing issues
closes #3021