Skip to content

[General]: Unclear how to map between XED and the multiple instruction definitions #121

Backlog

Description

@pkhuong

Feedback or Inquiry

https://github.com/intel/SDM/blob/main/_posts/2026-10-13-first-eight-weeks.md suggests using the XED iform to figure out which definition to use for a given machine encoding. TL;DR: it mostly works, but not always? It would be nice for Intel to bless an algorithm to map between XED's decoding output and the correct ISA definition for that instruction.

However, the release sometimes has multiple instances of the same iform, with an index suffix, e.g., MOV_GPRv_MEMv_{0..5}. For this one, the ambiguity isn't that bad: one form is 32-bit only, 4 of the 64-bit forms are identical... but for the last one, we need to look for the F2 prefix.

CBW_{0,1,2} is more subtle: I see three versions, all with the same encoding definition, all three valid in 64-bit mode... but the first two (_0,_1) are also valid in 32-bit mode and the second (_1) rejects a 66 prefix.

I was hoping that the indices match the order of the template in XED, and that seems to be mostly the case?

I compared with XED v2026.06.29, the closest match I could find for the release's (mainline/external/v2026.06.29-2-g5f3b3a11) and found exceptions, e.g.:

  • MOV_GPRv_MEMv with 6 variants, when XED only has one template
  • JZ_RELBRb where the release has three variants (0 and 1 64-bit, 2 is 32-bit) and XED has two (0 is 64-bit, 1 is 32-bit)
  • BSF_GPRv_GPRv, BSF_GPRv_MEMv (and same for BSR): XED has two templates, the release only 1 (diff in TZCNT handling maybe?)
  • LOOPE_RELBRb, LOOPNE_RELBRb has 4 XED templates for the release's 2 (the two extra appear to be some P5 quirks?)
  • WBINVD has 2 XED templates, while the release has two copies (WBINVD.xml and WBNOINVD.xml)

In addition, the release has _MASK and _ZERO suffixes for some AVX-512 iforms. XED gives us xed_decoded_inst_zeroing, which we can use to disambiguate, but that's a bit irregular and not sure if documented.

Additional Information

Compared XED v2026.06.29 with 35eface (which reports XED mainline/external/v2026.06.29-2-g5f3b3a11 in data/versions.json)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions