xshader: RDNA2 VOPC i16/u16/i64/u64 + class_f16 (RDNA2 734/779) #22
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator!22
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/22/head"
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?
@QuentinDanblon on GitHub · 2026-11-21 17:49 UTC · original
QuentinDanblon:feat/vopc-16-64→main· +1388 −823 · 13 files · 2 commits · closed without mergingLibrary / area: tombox-xshader (RDNA2 VOPC decode + translation), progress map
Exports changed (exports.txt rows): none
Source of the behaviour: LLVM
VOPCInstructions.td(GFX10 section) for the opcode map; LLVM AMDGPUOperandSyntax for literal/inline extension; RDNA2 ISA for semantics. Design ported/adapted from brcly/TomBox (crates declare MIT OR Apache-2.0):rdna2/mnem.rs,hlsl/compare.rs, be622e8.Rebased on main after #15 landed as
ad43ad2: one code commit and one progress commit.What
The decoder had no entries for the RDNA2 VOPC i16/u16/i64/u64 compares or for
v_cmp(x)_class_f16. A title shader using one of them could not be translated. This PR adds:rdna2/mnem.rs: 58 opcodes (i16/u16 ×6 ×cmp/cmpx, i64/u64 ×8 ×cmp/cmpx, class_f16 0x8f/0x9f). Checked against LLVM GFX10 and brcly's table.hlsl/icmp.rs(new): 64-bit sources from register pairs. Inline ints are sign-extended. A 32-bit literal is sign-extended for i64 and zero-extended for u64. Anything else is refused.hlsl.rs: onevcmp_condpath for all VOPC/VOP3 compares. 16-bit compares read [15:0], sign-extended for i16; VOP3 OPSEL selects the high half.tb_cmp_class16. Class abs/neg apply to src0 only (VOPC_Class_Profile), now also for class_f32/f64.v_cmpxstill writes EXEC only. The tests check that VCC keeps a sentinel.SDWA operand selection before compares and CMPK zero-extension (the other parts of be622e8) were already correct here, so they are unchanged.
Tests (WARP, DXC 1.9.2609)
--test exec vop::vopc: 10/10 (5 existing + newvopc_i16,vopc_u16,vopc_i64,vopc_u64,vopc_class_f16). Expected values come from an i128 / ISA class-bit model. Cases: e32 cmp/cmpx, e64 with SGPR/VCC/NULL destinations, masked lanes, inline/literal/SGPR-pair src0, OPSEL 1/2/3, class abs/neg.--test opcodes: 22/22 (18 new decode rows plus HLSL checks).--lib: 8/8.--test exec: 61 pass, 4 fail. The 4 failures are thevop::basicones already present at226938c, fixed separately.Progress
mnem_groups.jsonis regenerated frommnem.rswith the same rule assync.py(I checked that the rule reproduces the committed file at226938cexactly). The 58 new mnemonics are added tordna2_verified. RDNA2 instructions 676/721 → 734/779.Not verified on hardware: OPSEL on VOPC-in-VOP3 (LLVM does not encode op_sel for GFX10 VOPC, so compilers shouldn't emit it) and the 64-bit literal extension rule. brcly's
tools/progress/native-vopc.tsvreports all of these mnemonics as matching on gfx1036, but it doesn't include the test vectors.cargo test -p tombox-xshaderpasses (except the pre-existingvop::basicfailures)missingwith a notemnem_groups.json regenerated from rdna2/mnem.rs (same rule as sync.py): 58 new VOPC mnemonics, all verified by the new vopc_{i16,u16,i64,u64, class_f16} exec groups on WARP.@QuentinDanblon on GitHub · 2026-11-21 21:03 UTC · original
Merged in the source sync
1159c96(adapted). Thanks! Closing.Pull request closed