Repository navigation
jit: sign-extend LDRSB/LDRSH/LDRSW destination loads - #3
Open
bluetoe-99 wants to merge 2 commits into
Open
bluetoe-99 wants to merge 2 commits into
bluetoe-99 wants to merge 2 commits into
Conversation
bluetoe-99
force-pushed
the
feature/ldr-signed-extend
branch
from
October 29, 2026 15:50
e7ac320 to
bcc060b
Compare
bluetoe-99
force-pushed
the
feature/engine-sized-guest-read
branch
from
October 29, 2026 15:50
3a5a81a to
646707a
Compare
bluetoe-99
force-pushed
the
feature/engine-sized-guest-read
branch
from
October 29, 2026 19:21
646707a to
c057245
Compare
bluetoe-99
force-pushed
the
feature/ldr-signed-extend
branch
from
October 29, 2026 19:21
bcc060b to
baa3092
Compare
bluetoe-99
force-pushed
the
feature/engine-sized-guest-read
branch
from
October 29, 2026 19:46
c057245 to
f6f6822
Compare
bluetoe-99
force-pushed
the
feature/ldr-signed-extend
branch
from
October 29, 2026 19:46
baa3092 to
b05a6f7
Compare
The truncation block keyed only on the access-size field, so the signed variants were zero-extended. The vendored spec sign-extends them: LDRSB/LDRSH to 32 or 64 bits per the destination entry, LDRSW always to 64. Shift the loaded sign into bit 63 and restore with SAR (existing 64-bit macros); W destinations reuse the existing 32-bit move to stop at bit 31. Signed-off-by: bluetoe-99 <102478736+bluetoe-99@users.noreply.github.com>
Seven cases over LDRSB/LDRSH/LDRSW with bit 7/15/31 set, covering both destination widths, and unscaled pre-index writeback; positive-value controls pin that non-negative loads are bit-identical to the old masks. Signed-off-by: bluetoe-99 <102478736+bluetoe-99@users.noreply.github.com>
bluetoe-99
force-pushed
the
feature/engine-sized-guest-read
branch
from
October 29, 2026 20:22
f6f6822 to
45d9d99
Compare
bluetoe-99
force-pushed
the
feature/ldr-signed-extend
branch
from
October 29, 2026 20:22
b05a6f7 to
2154396
Compare
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.
Tier 1 zero-extended every sized load, but the vendored ARM spec sign-extends the signed variants:
The destination width is already in the decoder table: LDRSB/LDRSH have paired entries whose destination operand type carries the W/X split (for example
0x39800000REGISTER_64 vs0x39C00000REGISTER_32), and LDRSW has a single REGISTER_64 entry. This replaces the truncation for those mnemonics withSHL (64-access_size_bits)plusSAR(both existing 64-bit macros, already used by the shifted-register logical translations), and reuses the existing 32-bit-move macro to stop the extension at bit 31 for W destinations.Fuzzer (full corpus, same seed order as baseline): fixes 50 previously-failing seeds, 0 new failures, 0 new errors vs main.
This is stacked on
feature/engine-sized-guest-read(fork PR #2 head): the hunk sits inside thetranslate_ldrregion that the LDR pre/post and sized-guest-read chain rewrote, and it depends on that access-size scaling.