tombox-xshader: fix v_bfe_i32 when offset + width reaches past bit 31 #33
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!33
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/33/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:31 UTC · original
artareias:fix-v-bfe-i32-wide-field→main· +4 −2 · 1 files · 68 commits · closed without mergingProblem
v_bfe_i32extracted the field with(a << ((32 - w - o) & 31)) >> (32 - w). Whenw + o > 32the left-shift count wraps through the& 31mask. Example:a = 1, o = 31, w = 31shifts left by 2 instead of 0, so the emitter returns 2 where the field is 0.vop::basic::vop3_basicshows this as 18 failingv_bfe_i32cases (on both a hardware adapter and WARP).Change
When
w + o >= 32the field already reaches the sign bit, so the arithmetic shiftasint(a) >> oalone sign-fills it. The shift pair is kept forw + o < 32, where both shift counts are in 1..31. This is the same split the existingtb_bfe_i32helper (used bys_bfe_i32) already makes. Width 0 still returns 0.Reference: RDNA 2 ISA guide, VOP3
V_BFE_I32(p. 177): offset isS1[4:0], width isS2[4:0].Testing
Windows 10 19045, MSVC 14.44, rustc 1.100.0, AMD Radeon RX 7600 (
TOMBOX_EXEC_HW=1) and WARP:vop3_basicfailing cases (RX 7600)vop3_basicfailing cases (WARP)v_bfe_i32failing casesThe 37 left are
v_fma_mixhi_f16(36) andv_fma_mix_f32(1), a separate issue. I ran all 61exectests one at a time 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 (v_bfe_i32 goes through tb_bfe_i32). Thanks!
@copilot-pull-request-reviewer[bot] on GitHub · 2026-11-21 18:31 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