shader: decode SOPC scalar comparisons in disasm_rdna2 #426
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/432"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by Jawschamp on 2026-11-22T02:17:57Z.
Change
tools/disasm_rdna2.pydid not recognize SOPC encodings ([31:23] == 0b101111110). Those 32-bit words fell through to the SOPK prefix check and decoded as unknown SOPK ops. For example,s_cmp_eq_i32 s0, s1(000100bf) came out ass_sopk_1e s0, 0x100.This change decodes the GFX10 / RDNA 2 SOPC table used by
gfx1013:s_cmp_{eq,lg,gt,ge,lt,le}_{i32,u32}s_bitcmp{0,1}_b32ands_bitcmp{0,1}_b64s_cmp_{eq,lg}_u6464-bit operands print as SGPR pairs or the named specials (
s[0:1],exec,vcc,null). Aliteralsource consumes the following dword so the next instruction stays aligned. The SOPK prefix check now also excludes the SOPC encoding as a backstop.No issue tracks this. It follows the same
disasm_rdna2line as #263, #264 and #245, and does not touch the VOP2 table in open #251.Verification
Commit
e0081e8onshader/decode-sopc, based onorigin/mainatc2fc84cafter a rebase. Linux host, Python 3.13.5. LLVM 15 is not available on this Debian Trixie box, so the optional LLVM comparison inrdna2_tools_checkwas skipped (the same skip as on the Python-only Linux CI job). Windows C++, HLSL, WARP and hardware checks were not run locally.The skipped test is
test_llvm_comparison, which now also lists the new SOPC mnemonics. The Ubuntupixel-binaryjob should assemble those with LLVM 15 (llvm-mc -mcpu=gfx1013) and compare opcodes againstlibLLVM-15.so.1.The rest of the platform-independent Python suite also passed:
All of those commands exited 0.
git diff --checkwas clean.Evidence and follow-up
Golden encodings follow LLVM's GFX10 SOPC layout (
Inst{31-23}=0x17e, opcode in bits 22–16). Opcode numbers match LLVM'sSOPC_Real_gfx10assignments. Fixtures are source-owned hex vectors and a two-instruction stream that placess_endpgmafter an 8-byte SOPC-with-literal.A useful next step, kept out of this PR, is decoding VOPC (currently swallowed by the VOP2 catch-all) after #251 lands, and then VOP3, whose 64-bit encodings are still returned as a 4-byte unrecognized word and desynchronize the rest of a binary shader.
Checklist
AI-assisted.