feat(shader): implement s_bfe_i64 #838
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/838"
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?
Imported from boykopovar/AnyPS5. Originally posted by ebosido444-ai on 2026-10-06T08:38:33Z.
What
s_bfe_i64(SOP2 0x2a) is the last SOP2 hole — shaders using a signed 64-bit bitfield extract die at translation withunsupported SOP2 opcode. Implemented as the sign twin of the existings_bfe_u64, exactly the pairing ofs_bfe_u32/s_bfe_i32:sBfeU64widens tosBfeU64(inst, bool sign)over a sharedextractBits64(the clamp-and-mask the unsigned path already had, plus the sign-extension idiom the 32-bit pair uses), so the unsigned path is byte-equivalent for its callers and the two 32/64 families now read symmetrically. Shader progress: 1125 to 1126 out of 1166 on top of currentmain(1127 combined with #821).Encoding sourced from LLVM's AMDGPU backend table
SOP2_Real_gfx6_gfx7_gfx10_gfx13<0x02a>— the PS5 generation (gfx11/gfx12 renumber this family, so the row is generation-specific). Field descriptor layout (offsetin bits 5:0,sizein bits 22:16) is the one the existings_bfe_u64already decodes; sizes are clamped to the bits remaining above the offset as before, and the extracted field sign-extends from its top bit.Tested
Windows 11:
core/libs/tests/ScalarBfe64.cpp(registered asscalar_bfe64) decodes both 0x2a and 0x29 throughDecodeRdnaSop2, asserts family and the two-dword destination bookkeeping (IsScalarAluOpcodeaccepted), translates both, and distinguishes them in the IR:ShiftRightArithmetic64is present exactly for the signed form and the sharedBitwiseAnd64clamp present for both. Standalone run passes. Scoped CMake/CTest suite (winlibs GCC 15.2.0 per BUILD.md):scalar_bfe64,scalar_bitcount64,scalar_saveexec,guest_rtc— 4/4 passed.tools/progress.py: shaders 1125 -> 1126 out of 1166 on this branch.Checklist
main; no other open PR implements the same functions (checked open-PR titles and diffs for BFE/bitfield — none)NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-06T08:59:21Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/shader/recompiler/Translation/include/Translation/TranslationContext.hppL242core/shader/recompiler/Translation/src/IntegerInstructions.cppL675-679, L683-684Imported from boykopovar/AnyPS5. Originally posted by ebosido444-ai on 2026-10-06T09:41:51Z.
Closing in favour of #234, which implements the same function and predates this by five days (both converged on the same sBfeU64(inst, bool sign) widening and shift-align sign extension). #234 is complete with full-suite evidence. One process note for the record: my duplicate check missed #234 because a capped PR listing never reached it — the pr-overlap report above caught it. No functional difference worth merging here.
Pull request closed