Skip to content

[General]: SDM Vol. 2 §B.2.1 Table B-15 — ADD encodings decode as ADC or byte-ADD, not ADD #20

Open

Description

@rokokol

Note that issues are public so please don't include confidential information.
And note that the License states

If you give Intel any comments or suggestions related to this document or
the information contained in it, Intel can use them in any way and disclose
them to anyone, without payment or other obligations to you. You represent
and warrant that you own, or have sufficient rights from the owner of, any
such comments or suggestions, and the intellectual property rights in them,
to grant the above permission.

Feedback or Inquiry

Table B-15 "General Purpose Instruction Formats and Encodings for 64-Bit Mode" (§B.2.1) lists five encoding rows under "ADD – Add" whose printed bits do not actually encode ADD. Verified by hand-deriving the expected bytes from the opcode structure (opcode = 00ooo0dw, ADD's ooo = 000) and confirming against objdump disassembly of the literal byte sequences (GNU Binutils 2.46, -b binary -m i386:x86-64 -M intel):

  1. qwordregister1 to qwordregister2 (first direction) is listed as
    0100 1R0B 0000 0000 : 11 qwordreg1 qwordreg2
    The opcode byte 0000 0000 (00h) does not carry REX.W's width bit: 48 00 CB disassembles as rex.W add bl,cl (a byte operation), not a 64-bit ADD. It should read 0000 0001 (01h) — 48 01 CB disassembles as add rbx,rcx.

  2. qwordregister1 to qwordregister2 (second direction) is listed as
    0100 1R0B 0000 0010 : 11 qwordreg1 qwordreg2
    Same problem: 48 02 D9 disassembles as rex.W add bl,cl. It should read 0000 0011 (03h) — 48 03 D9 disassembles as add rbx,rcx.

  3. immediate32 to qwordregister is listed as
    0100 100B : 1000 0001 : 11 010 qwordreg : imm
    The ModR/M reg field 010 selects the /2 (ADC) extension of opcode 81h, not /0 (ADD): 48 81 D0 78 56 34 12 disassembles as adc rax,0x12345678. The reg field should be 000 — 48 81 C0 78 56 34 12 disassembles as add rax,0x12345678.

  4. immediate32 to memory64 — same mod 010 r/m, should be mod 000 r/m, same reason as [Bug]: Broken links #3.

  5. immediate8 to memory64 — same mod 010 r/m, should be mod 000 r/m, same reason as [Bug]: Broken links #3.

The neighbouring 32-bit register1 to register2 / memory to register / register to memory / immediate to register / immediate to memory rows for ADD are all correct, and the ADC block immediately above ADD in the same table correctly uses reg field 010 (its own /2 extension) throughout. That points to the qword- and memory64-specific ADD rows having been copied from the ADC block above without updating the opcode/ModR/M-reg bits back to ADD's own values.

Additional Information

  • Location: Intel® 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (2A, 2B, 2C & 2D): Instruction Set Reference, A-Z, Order Number 325383-092US, June 2026, §B.2.1, Table B-15, page B-19.
  • Verified with objdump (GNU Binutils 2.46) against the literal byte sequences printed in the table, and by re-deriving them from the documented opcode structure in the same manual (§2.1).

Activity

  1. added
    SDM PDF issueThis problem is present in the SDM PDF and is/may be present in the website as a consequence
    on Sep 19, 2026
  2. alastairreid commented on Sep 19, 2026

    @alastairreid
    Contributor

    Thanks for the detailed report and the commands to reproduce the issue.
    I have attached the "SDM PDF issue" label since this is an issue in the (upstream) SDM PDF.

    This relates to a general issue that we have not been consistently updating this chapter as new encodings of instructions are added and we rely on manual review of this content to find issues.

    While we can/should definitely fix individual issues as they are reported, I think that the way to completely solve this is to automatically generate these binary encoding strings from the XED database and use those to automatically generate appendix B and also to add the information in the "Further encoding details" part of the website and also as a 'tooltip' when hovering the mouse over symbolic encoding strings such as "00 /r".
    I see two steps in doing this

    1. (The 'easy' bit): in the website, generate and display binary strings for each XED encoding. This should not be too hard.

    2. (The hard bit): in the website, experiment with generating tables like those in Appendix B.

      What makes this hard is that a single entry in appendix B often corresponds to several entries in the XED database because appendix B uses symbolic fields such as 's', 'w', 'tttn', etc. while XED uses concrete values (0/1) resulting in a lot more encodings.
      Unless we can generate similar (ideally identical) binary encoding strings (by merging several XED encodings into a single binary encoding string), this would result in a significant expansion of appendix B and would lose the explanatory power that use of symbolic fields gives us.

    3. (The other hard bit) It will be hard to retain the existing concise natural language descriptions of encodings such as "register1 with immediate to register2" because we don't have that information in a database, trying to scrape the information from the existing SDM content will be affected by bugs in the existing SDM, and we would have to deal with all the missing entries.

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

    SDM PDF issueThis problem is present in the SDM PDF and is/may be present in the website as a consequence

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions