Skip to content

tests/semantic: add v_cvt_f32_ubyte2 translator coverage - #6319

Draft
x2Tweek wants to merge 1 commit into
ItsNotRexed:mainfrom
x2Tweek:test/semantic-cvt-f32-ubyte2
Draft

x2Tweek wants to merge 1 commit into
ItsNotRexed:mainfrom
x2Tweek:test/semantic-cvt-f32-ubyte2

Conversation

@x2Tweek

@x2Tweek x2Tweek commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

tests/semantic: add v_cvt_f32_ubyte2 translator coverage

What

Add a semantic regression test for RDNA2 v_cvt_f32_ubyte2: it extracts byte 2
(bits [16:23]) of a u32 source register, zero-extends it to 32 bits, and
converts unsigned int to float (D.f32 = (float)((S0.u32 >> 16) & 0xFF)).

The plain (non-SDWA, non-_e64) form encodes the byte index in the opcode name
(v_cvt_f32_ubyte0..3). This instruction is implemented in the translator
(tools/rdna2spirv.py:2418-2425) but has no semantic test on upstream/main,
so this closes that coverage gap.

How it's verified

  • Each case is a synthetic one-lane pixel shader translated by the
    translator and executed by tests/semantic/spirv_mini_interp.py, compared
    against a hand-computed reference.
  • Standard library only: no GPU, no game data, no LLVM.
  • Verified locally: 6 passed, 143 subtests, exit status 0
    (python -m pytest tests/semantic/test_alu_cvt_f32_ubyte2.py).

Coverage

  • VGPR / SGPR / inline-literal source forms
  • destination aliasing a source (v1 = v_cvt_f32_ubyte2 v1, v1)
  • all four v_cvt_f32_ubyte{N} forms (N = 0..3)
  • hand-written boundary cases (0, 0xFF, 255, sign-bit patterns)
  • 120 seeded random operands

AI-assisted.

🤖 Generated with Claude Code

Add a semantic regression test for RDNA2 v_cvt_f32_ubyte2 (extract byte 2 of
a u32 source, zero-extend, convert unsigned int to float) translated via
tools/rdna2spirv.py and executed through spirv_mini_interp.py, compared
against a hand-computed reference. Covers VGPR/SGPR/inline-literal sources,
destination aliasing, all four v_cvt_f32_ubyte{N} forms, and random operands.

This instruction is implemented in the translator (rdna2spirv.py:2418-2425)
but has no semantic test on upstream/main.

Standard library only: no GPU, no game data.

AI-assisted.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant