tombox-xshader: s_bfe_u32 field width is 7 bits; add a scalar oracle in the test #38
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!38
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/38/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:52 UTC · original
artareias:fix-s-bfe-7bit-width→main· +21 −3 · 2 files · 69 commits · closed without mergingProblem
vop::basic::salu_basicfails 12s_bfe_i32cases. The RDNA 2 ISA guide (S_BFE_U32/S_BFE_I32, p. 113) puts the field offset inS1[4:0]and the field width inS1[22:16], which is 7 bits. In this repo:s_bfe_i32emitter (tb_bfe_i32) already reads a 7-bit width;s_bfe_u32emitter masks the width with& 31(5 bits);The vector
V_BFE_*ops are different (offsetS1[4:0], widthS2[4:0], p. 177), so the existing 5-bit helper is right for them.Change
hlsl.rs:s_bfe_u32reads the width as(S1 >> 16) & 127.tests/exec_vop/basic.rs: newsbfe()oracle for the scalar ops (7-bit width).bfe()stays as is for the vector ops.An inference to review
For a width of 32 or more, the manual's
(1 << width) - 1is not defined in 32-bit arithmetic. The emitter and the new oracle both treat it as a full mask, with sign extension from bit 31 fors_bfe_i32. This is my reading, not something the manual states. Since the emitter and the oracle were written together, they agree by construction, so this case is not independent evidence. If you know the hardware behaviour for widths 32..127, it is a one-line change in both places.Testing
Windows 10 19045, MSVC 14.44, rustc 1.100.0, AMD Radeon RX 7600 (
TOMBOX_EXEC_HW=1) and WARP:salu_basics_bfe_i32failing cases (RX 7600)salu_basics_bfe_i32failing cases (WARP)The 43 other
salu_basiccases (s_lshl_b64,s_bfm_b64,s_addk_i32) are fixed separately in #29. Per-test run of all 61exectests on the RX 7600 before and after: no other test changes status.🤖 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 (same s_bfe_u32 expression and test), so nothing is left to apply. Thanks!
@copilot-pull-request-reviewer[bot] on GitHub · 2026-11-21 18:52 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