Repository navigation
Conversation
dasm_imm13() accepted some non-encodable constants and returned a bogus encoding, so AND/OR/XOR with them computed a wrong result (0x5555555555555554) or emitted an illegal instruction (0x200000003). It also negated INT64_MIN in signed arithmetic. Backport the rewritten dasm_imm13() from DynASM (LuaJIT a9981441), already in master via the IR update.
ndossche
approved these changes
Oct 25, 2026
ndossche
left a comment
Member
There was a problem hiding this comment.
Looks like a clean backport, thanks
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.
Backport of the dasm_imm13() rewrite from DynASM (LuaJIT a9981441, LuaJIT/LuaJIT#1522), which landed in master with the IR update in #24298.
The old
dasm_imm13()accepts some constants that are not valid AArch64 logical immediates and returns a bogus encoding.AND/OR/XORwith such a constant then:$x & 0x5555555555555554has bit 0 set$x & 0x200000003It also negates INT64_MIN in signed arithmetic (UB).
Only
dasm_imm13()and its helpers are taken from the DynASM update; the rest of that update stays in master.