tombox-xshader: fix SCC and 64-bit mask handling in s_lshl_b64, s_bfm_b64, s_addk_i32 #29
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!29
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/29/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?
@artareias on GitHub · 2026-11-21 18:12 UTC · original
artareias:fix-salu-scc-bfm-addk→main· +29 −5 · 1 files · 64 commits · closed without mergingProblem
vop::basic::salu_basic(tests/exec_vop/basic.rs) fails with 55 cases on both a hardware adapter and WARP. 43 of them are three scalar ops in the HLSL emitter (crates/tombox-xshader/src/hlsl.rs):s_lshl_b64SCC = (result != 0), like the other SOP2 shiftss_bfm_b64((1 << S0[5:0]) - 1) << S1[5:0]s_addk_i32SCC= signed overflow ofD + signext(SIMM16)The oracles in
tests/exec_vop/basic.rsalready encode the expected behaviour, so no test change is needed.Change
s_lshl_b64: setsccafter writing both words (s_bfm_b64ands_cselect_b64still leave SCC alone).s_bfm_b64: build the 64-bit mask from two words, then shift the pair left byS1[5:0].s_addk_i32: computeD + imminto a temp, set SCC with the same overflow expressions_add_i32already uses, then write D.Testing
Windows 10 19045, MSVC 14.44, rustc 1.100.0, AMD Radeon RX 7600 (
TOMBOX_EXEC_HW=1) and WARP:salu_basic: 55 failing cases before, 12 after, on both adapters. All 43s_lshl_b64/s_bfm_b64/s_addk_i32cases pass.exectests on the RX 7600 before and after: no other test changes status.cargo test -p tombox-xshader --lib --test synthetic --test opcodes: pass. (ampandfixturesfail on this base because they need local fixtures, see #13.)Not changed
The remaining 12
salu_basicfailures are alls_bfe_i32. The emitter'stb_bfe_i32uses a 7-bit width ((b >> 16) & 127), whiles_bfe_u32in the same file and the test oracle use 5 bits (& 31). I could not tell which side matches hardware, so I left it.vop3_basic(55 failing cases:v_bfe_i32,v_fma_mix*) is a separate group.🤖 Generated with Claude Code
@omonkeyz on GitHub · 2026-11-22 13:13 UTC · original
Main's history was rewritten, which auto-closed this PR (sorry for the noise). Already on main (64-bit s_bfm_b64, s_lshl_b64 SCC and s_addk_i32 overflow SCC). Thanks!
@copilot-pull-request-reviewer[bot] on GitHub · 2026-11-21 18:12 UTC · original · reviewed
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Pull request closed