shader: lower s_pack_*_b32_b16, s_bfm_b64, s_bitreplicate_b64_b32 and v_mad_u32_u16 #84
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/84"
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 LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-26T13:52:07Z.
What this changes
In the tester logs of #66 and #68, 10 title shaders are first refused on
s_pack_ll_b32_b16(3),s_pack_hh_b32_b16(1),s_bitreplicate_b64_b32(4),s_bfm_b64(1) orv_mad_u32_u16(1). They were decoded but had no lowering. This lowers them, withs_pack_lh_b32_b16for the family, from the RDNA2 ISA reference (cross-checked with LLVM'sSOPInstructions.tdandVOP3Instructions.td):s_pack_ll_b32_b16S1[15:0] << 16 | S0[15:0]s_pack_lh_b32_b16S1[31:16] << 16 | S0[15:0]s_pack_hh_b32_b16S1[31:16] << 16 | S0[31:16]s_bfm_b64((1 << S0[5:0]) - 1) << S1[5:0]in 64 bitss_bitreplicate_b64_b32v_mad_u32_u16S0.u16 * S1.u16 + S2.u32, wrapping; op_sel bits 0 and 1 pick the high halvesir::writes_sccalready agrees that the scalar ones write no SCC.v_mad_u32_u16's op_sel bits 2 and 3 (the 32-bit S2 and D) are undefined in the manual, so they are refused rather than guessed, as are integer source modifiers. The manual's summary table givess_bfm_b645-bit fields, its opcode entry 6-bit ones; the entry is followed.Tests: a hand-assembled translation test (
llvm-mc -mcpu=gfx1030) ingfx_refusal_tests.rscovering all six, with op_sel combinations and wave32 on and off (fails onmainwith "s_pack_ll_b32_b16 is not supported"), and value probes insemantics_tests.rsfor the Windows CI (edge values,s_bfm_b64widths and offsets 0 to 65, the four op_sel combinations, a wrapping sum). Whether these 10 shaders now translate end to end still needs a live run: they may meet another refusal next.How it was tested
cargo test -p victory-shader(the value probes run only in the Windows CI)cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings, also with--all-featurescargo test --workspaceandcargo xtask policyChecklist
VICTORY_*variable and documented (none added)Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T14:54:45Z.
Review: APPROVED
Thanks, the opcode numbers and semantics check out, and refusing op_sel bits 2-3 is the right call.