Files
mandy/runtime/test/shaders/ps_ops8.asm
simonbronk 48adc7b9a5 Translator: v_perm_b32 sign selectors 8-11; integer ALU tests ps_ops7/ps_ops8
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>
2026-11-21 22:33:25 +01:00

24 lines
745 B
NASM

; v_mul_hi_u32 / v_mul_hi_i32, v_bcnt_u32_b32 with an accumulator, v_ffbl_b32 / v_ffbh_u32 (and v_ffbh_u32 of 0
; = 0xffffffff), v_xad_u32 and v_add3_u32 wrapping.
; Expected mrt0 bits: 0x80000000, 0xffffffff, 0x000f100e, 0x0f0f0f1f
v_mov_b32_e32 v0, 0x80000001
v_mov_b32_e32 v1, -1
v_mul_hi_u32 v2, v0, v1
v_mov_b32_e32 v3, -2
v_mov_b32_e32 v4, 0x40000000
v_mul_hi_i32 v5, v3, v4
v_mov_b32_e32 v6, 0xf0f00001
v_bcnt_u32_b32 v7, v6, 5
v_mov_b32_e32 v8, 0x00010000
v_ffbl_b32_e32 v9, v8
v_ffbh_u32_e32 v10, v8
v_lshl_add_u32 v11, v9, 8, v7
v_lshl_add_u32 v11, v10, 16, v11
v_mov_b32_e32 v12, 0xf0f0f0f0
v_xad_u32 v13, v12, -1, 1
v_mov_b32_e32 v14, 0
v_ffbh_u32_e32 v15, v14
v_add3_u32 v16, v13, 16, v15
exp mrt0 v2, v5, v11, v16 done vm
s_endpgm