xshader: lower fourteen ordinary VOP3 integer forms #95
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/95"
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 brcly/TuxBox. Originally posted by JohnVonWells on 2026-11-24T22:01:08Z.
A synthetic sweep over the decoder's ALU opcode table (one instruction with ordinary register operands per opcode, no shader inputs) showed about 95 decodable instructions the translator refuses as
unsupported vector op. This PR takes the group with exact integer semantics, which is the easiest to verify:v_add_nc_i16,v_sub_nc_i16,v_mad_u16,v_mad_i16,v_min3_u16,v_max3_u16,v_med3_u16,v_min3_i16,v_max3_i16,v_med3_i16v_add_nc_i32,v_sub_nc_i32,v_mad_u32_u16,v_mad_i32_i16Lowering
int16half-select path: op_sel picks the source halves, and op_sel bit 3 picks the destination half. The other half is preserved, as for the existing newer 16-bit forms.min3/max3/med3compare sign-extended halves for_i16.int32module.v_mad_u32_u16/v_mad_i32_i16accept op_sel on the two multiplicands only.Verification
tools/check_ordinary_integer_gpu.pyassembles every legal op_sel combination withllvm-mc -mcpu=gfx1030. The result register aliases one source, so destination-half preservation is tested too. The script runs the translated shaders through DXC/DXV and stock Proton, then compares all 384 readback words per dispatch, including the inputs and guard words, with a Python model. Hand-computed values for that model are intests/test_ordinary_integer_gpu.py.1002:73a5, RADV): 154 selector combinations, 2,464 results, 8,448 GPU words, zero mismatches. The receipt isevidence/ordinary-integer-vop3-control.json.5cee10frefuses all 22 test shaders (--baseline). For each instruction, the clamp form and an SGPR-source form are refused.min3/max3/med3comparing unsigned. The check then failed at the firstv_min3_i16case, exactly on the inputs with bit 15 set.Not included:
v_cvt_pk_u16_u32andv_cvt_pk_i16_i32were refused in the same sweep. I could not independently confirm their saturation behaviour (LLVM does not constant-foldllvm.amdgcn.cvt.pk.*), so they remain refused.AI-assisted.
🤖 Generated with Claude Code
https://claude.ai/code/session_01NhDbTJdTcjebsL5u7pwFoY