mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 21:58:38 +00:00
v_perm_b32 returned 0x00 for selectors 8-11. Per the RDNA ISa BYTE_PERMUTE
they give 0xff when bit 7 of byte 1, 3, 5 or 7 of {src0, src1} is set. Each
byte pick also shifted both sources by up to 56 bits (undefined in SPIR-V,
the select kept the right one); the shift is now (sel & 3) * 8 on the source
chosen by sel < 4.
New test shaders, checked on the GPU (check.py, run_gpu_tests.py) and in
tests/semantic with expected words derived from the ISA:
- ps_ops7: v_perm_b32 (byte picks, 0x00/0xff, sign selectors), v_alignbit_b32
with a shift of 36, v_med3_i32 vs v_med3_u32.
- ps_ops8: v_mul_hi_u32/i32, v_bcnt_u32_b32, v_ffbl_b32, v_ffbh_u32 (of 0),
v_xad_u32, v_add3_u32.
The semantic interpreter gains OpUMulExtended/OpSMulExtended,
OpUGreaterThanEqual and GLSL FindILsb, FindUMsb, UMax, SMin, UClamp, SClamp,
with direct tests; the unsupported-ext example moves from FindUMsb to Ldexp.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
19 lines
655 B
NASM
19 lines
655 B
NASM
; v_perm_b32 (byte selects 0-7, 12 = 0x00, >= 13 = 0xff, 8-11 = sign of bytes 1/3/5/7 of {S0, S1}),
|
|
; v_alignbit_b32 (shift taken mod 32), v_med3_i32 vs v_med3_u32 on the same operands.
|
|
; Expected mrt0 bits: 0x00ff8077, 0xff0000ff, 0x89abcdef, 0x00070003
|
|
v_mov_b32_e32 v0, 0x80112233
|
|
v_mov_b32_e32 v1, 0x4455e677
|
|
v_mov_b32_e32 v2, 0x0c0d0700
|
|
v_perm_b32 v3, v0, v1, v2
|
|
v_mov_b32_e32 v2, 0x0b0a0908
|
|
v_perm_b32 v4, v0, v1, v2
|
|
v_mov_b32_e32 v5, 0x12345678
|
|
v_mov_b32_e32 v6, 0x9abcdef0
|
|
v_alignbit_b32 v7, v5, v6, 36
|
|
v_mov_b32_e32 v8, -5
|
|
v_med3_i32 v9, v8, 7, 3
|
|
v_med3_u32 v10, v8, 7, 3
|
|
v_lshl_add_u32 v11, v10, 16, v9
|
|
exp mrt0 v3, v4, v7, v11 done vm
|
|
s_endpgm
|