binutils Newspaper
OCTOBER 6, 2026
x86/apx — Proposed — Sentiment 7 / 10

x86/APX: Limit REX2 payload printing

Patch refines the printing of REX2 prefixes in the x86 disassembler to be more concise.

Jan Beulich proposes a patch to the x86 disassembler that limits the printing of REX2 payloads. When REX2 bits are consumed and only indicate the encoding is in use, the output will now simply show ‘{rex2}’ for better matching of original input. The patch also simplifies conditional logic and updates test cases.

In the Thread 5 participants
  1. Jan Beulich proposer

    Submitted a patch to simplify the output of REX2 prefixes in the disassembler, showing '{rex2}' when appropriate.

    “When set bits were properly consumed (and hence all we want is an indication that REX2-encoding is in use), print merely {rex2}, thus also better matching original input. While effectively copying parts of an existing conditional, also simplify the original: There's no need to apply the 3-bit mask twice. While adjusting testcases, also escape curly braces.”
  2. Jiang, Haochen other

    Commented on the patch, starting a discussion about its implications.

  3. Jan Beulich other

    Responded to Haochen Jiang's comment.

  4. H.J. Lu other

    Participated in the discussion.

  5. Jan Beulich other

    Continued the discussion with H.J. Lu.

Technical Tradeoffs

  • Conciseness of disassembler output vs. verbosity of REX2 prefix details.

In Details

This patch modifies the i386-dis.c file in binutils to refine how REX2 prefixes are displayed. Specifically, when the REX2 prefix is used but its specific bits are consumed or irrelevant for detailed display (e.g., just indicating REX2 usage), the disassembler will now output '{rex2}' instead of a more verbose representation like '{rex2 0x0}'. This aims to improve output clarity and consistency.

For Context
REX2 prefix
An extended prefix byte used in x86-64 architecture to encode additional addressing modes and features beyond the original REX prefix. It allows for features like REX.W, REX.R, REX.X, REX.B, and REX2.SPECIAL.
Disassembler
A program that translates machine code (binary) back into assembly language.
Payload
In this context, refers to the specific data or bits within the REX2 prefix that convey detailed information.
x86/APX
Refers to extensions or specific features related to the x86 architecture, possibly including Advanced Performance Extensions or similar.
Filed Under: disassemblerx86patch