Commit Graph

3 Commits

Author SHA1 Message Date
77b110ea34 rdna2spirv: add 16-bit VOP3 min3, max3, and med3 instructions 2026-11-22 14:28:23 +01:00
85a4e7b2a7 Translator: v_subrev_f16 (S1 - S0 on the selected halves)
v_subrev_f16 (VOP2 0x34 on GFX10) raised Unsupported. Translate it with the
other f16 VOP2/VOP3 ops, swapping the two operands of the subtraction: op_sel
still names src0/src1 and the destination half, neg/abs/clamp apply as for
v_sub_f16, and the half that is not written is kept.

Tests: tests/semantic/test_alu_subrev_f16.py (VOP2 and VOP3 forms, every
op_sel combination, neg and clamp, and a seeded comparison with v_sub_f16 on
swapped operands), plus v_subrev_f16 rows in the f16 op_sel tables.
2026-11-21 20:28:24 -03:00
439887f04f Tests: check computed values with a small SPIR-V interpreter
tests/spirv_interp.py runs the straight-line, single-lane SPIR-V the translator
emits for branch-free shaders (binary32 rounding after every op, GLSL.std.450
subset, Function/Output variables). Unknown opcodes raise NotImplementedError.

- test_values.py: 49 value checks over the supported instruction families, with
  references written in plain Python from the ISA definitions.
- test_f16_op_sel_values.py: 84 value checks for op_sel on f16 VOP3 ops (all
  select combinations, neg/abs/clamp, fmac).
- listing.py: hand-written listing helper. shader_ir.parse_file treats the first
  line of a listing as its header, so the helper writes one; test_f16_op_sel.py
  used to lose its first instruction and now uses the helper.

None of these need llvm-mc or spirv-tools. Mutation-checked: breaking the
op_sel source index or the destination merge makes them fail.
2026-11-21 17:46:28 +01:00