tests: Update enc= values to preserve useless 0x67 address-size prefix#804
Open
mattst88 wants to merge 5 commits into
Open
tests: Update enc= values to preserve useless 0x67 address-size prefix#804mattst88 wants to merge 5 commits into
mattst88 wants to merge 5 commits into
Conversation
Track whether the original encoding contained a 0x67 address-size prefix that had no semantic effect (i.e. the instruction has no memory operand). Backed by a free bit (bit 20) in InstrFlags1::flags1, following the same pattern as has_lock_prefix.
…0x67 OpCodeHandler_Prefix67 flips the address size and delegates to the real opcode handler. If the decoded instruction has no memory operand of any kind (OpKind >= MemorySegSI), the 0x67 byte had no semantic effect and was previously silently discarded. Record it via has_address_size_prefix so the encoder and formatters can reproduce the original bytes.
Extend write_prefixes() to emit the address-size prefix byte when instruction.has_address_size_prefix() is true, in addition to the existing EncoderFlags::P67 path that handles memory operands.
When has_address_size_prefix() is true and show_useless_prefixes is enabled, emit the NASM address-size keyword (a16 in 32-bit mode, a32 otherwise) so NASM can reproduce the original 0x67-prefixed bytes.
For 25 decoder test entries that have a 0x67 prefix on a non-memory instruction, the enc= field previously specified the canonical form with 0x67 stripped. Now that the encoder round-trips has_address_size_prefix, update all enc= values to include the leading 67 byte. Affected entries: - 22 x "66 67 4E <rm8-r8 ops>" in DecoderTest64.txt - "67 8F E9 78 12 C3" (XOP Llwpcb_r32) in all three bitness files - "67 8F E9 F8 12 C3" (XOP Llwpcb_r64) in DecoderTest64.txt
2 tasks
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.
Summary
enc=entries inDecoderTest{16,32,64}.txtto include the leading67byte0x67prefix in the original bytes; withhas_address_size_prefixnow preserved through encode, the re-encoded bytes include67and the test expectations must matchDepends on: #802, #803
Test plan
cargo test -p iced-x86 -- encode_16 encode_32 encode_64passes