disasm_rdna2: decode v_madmk_f32 and v_madak_f32 with their literal #615

Manually merged
github merged 1 commit from gh-pr/615/head into gh-pr/615/base 2026-11-26 22:06:02 +00:00
Owner

@⁠JB2WIN on GitHub · 2026-11-22 15:59 UTC · original
JB2WIN:fix/disasm-madak-madmk → main · +8 −3 · 2 files · 1 commits · merged 2026-11-22 16:34 UTC

Change

tools/disasm_rdna2.py did not know VOP2 opcodes 0x20 (v_madmk_f32) and 0x21 (v_madak_f32). It printed v_vop2_20/21, and because it did not consume their mandatory 32-bit literal, the next word was decoded as a separate instruction. That meant the scanner could not recognise the forms that #595 made pixel_aot lower. The two opcodes now join the literal set with v_fmamk_f32/v_fmaak_f32 (0x2c/0x2d), using the same operand order: K second for madmk, last for madak.

Follow-up to #595 (noted there). AI-assisted (Claude Code).

Verification

  • The opcodes come from LLVM 15.0.7 llvm-mc -mcpu=gfx1013 -show-encoding. The disassembler tests add the two encodings as golden vectors:
    • v_madmk_f32 v5, v1, 0x11213141, v3 encodes as [0x01,0x07,0x0a,0x40,0x41,0x31,0x21,0x11]
    • v_madak_f32 v5, v1, v2, 0x11213141 encodes as [0x01,0x05,0x0a,0x42,0x41,0x31,0x21,0x11]
  • python -B tests/rdna2_tools_check.py: OK (skipped=1). Without the change to tools/disasm_rdna2.py the new vectors fail: AssertionError: 2 != 1 : Failed for 01070a4041312111, because the literal decoded as a second instruction.
  • python -B tests/pixel_aot_check.py (controls): passed.

🤖 Generated with Claude Code

**@⁠JB2WIN** on GitHub · 2026-11-22 15:59 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/615) `JB2WIN:fix/disasm-madak-madmk` → `main` · +8 −3 · 2 files · 1 commits · merged 2026-11-22 16:34 UTC ## Change `tools/disasm_rdna2.py` did not know VOP2 opcodes 0x20 (`v_madmk_f32`) and 0x21 (`v_madak_f32`). It printed `v_vop2_20/21`, and because it did not consume their mandatory 32-bit literal, the next word was decoded as a separate instruction. That meant the scanner could not recognise the forms that #595 made `pixel_aot` lower. The two opcodes now join the literal set with `v_fmamk_f32`/`v_fmaak_f32` (0x2c/0x2d), using the same operand order: K second for madmk, last for madak. Follow-up to #595 (noted there). AI-assisted (Claude Code). ## Verification - The opcodes come from LLVM 15.0.7 `llvm-mc -mcpu=gfx1013 -show-encoding`. The disassembler tests add the two encodings as golden vectors: - `v_madmk_f32 v5, v1, 0x11213141, v3` encodes as `[0x01,0x07,0x0a,0x40,0x41,0x31,0x21,0x11]` - `v_madak_f32 v5, v1, v2, 0x11213141` encodes as `[0x01,0x05,0x0a,0x42,0x41,0x31,0x21,0x11]` - `python -B tests/rdna2_tools_check.py`: OK (skipped=1). Without the change to `tools/disasm_rdna2.py` the new vectors fail: `AssertionError: 2 != 1 : Failed for 01070a4041312111`, because the literal decoded as a second instruction. - `python -B tests/pixel_aot_check.py` (controls): passed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
VOP2 opcodes 0x20/0x21 were unknown and their mandatory literal was decoded as
a separate instruction. Encodings checked with LLVM 15 llvm-mc for gfx1013.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:06:00 +00:00
github manually merged commit b845728892 into gh-pr/615/base 2026-11-26 22:06:01 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.