shader: lower scalar leading-bit scans in pixel_aot #622
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!622
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/622/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?
@descent81 on GitHub · 2026-11-22 16:16 UTC · original
descent81:shader/scalar-leading-bit→main· +60 −0 · 2 files · 1 commits · merged 2026-11-22 17:01 UTCChange
Add four distinct gfx1013 SOP1 encodings:
s_flbit_i32_b32ands_flbit_i32_b64count leading zeros, whiles_flbit_i32ands_flbit_i32_i64count leading bits equal to the sign bit. The result is0xffffffffif the search finds no differing bit, and SCC is preserved. The 64-bit paths operate on two 32-bit words. The signed path normalizes both words using bit 63 before searching either word. The 32-bit paths reuse the existing high-bit helpers.Verification
Tested
4724e26on baseefecacf. The fixture compares the full result word to a Python reference that searches a width-limited bit string, and reads SCC before the equality comparison. It covers zero, all ones, a set high bit, crossings at counts 31/32, and positive and negative inputs that reach count 63. As a negative control, substituting the unsigned 64-bit scan for the signed one changes the result for0xffffffff_fffffffefrom 63 to 0. Both GPU backends caught that substitution.Evidence and follow-up
The fixture uses source-written assembly and synthetic input words under the repository's MIT license. This covers the scalar MSB scan family independently of the scalar LSB scans in #618. AMD RDNA 2 ISA reference
AI-assisted.