tests/semantic: v_div_fixup_f32 neg of a negative operand (TEST-DIV-FIXUP-NEG) #673

Manually merged
github merged 1 commit from gh-pr/673/head into gh-pr/673/base 2026-11-26 09:15:31 +00:00
Owner

@⁠qhukz13 on GitHub · 2026-11-24 11:29 UTC · original
qhukz13:cont/div-fixup-neg → main · +33 −0 · 1 files · 1 commits · merged 2026-11-24 16:06 UTC

Claimed in the coordination issue as: TEST-DIV-FIXUP-NEG

The VOP3 neg rows in test_alu_div_fixup_f32.py (section 9) negate only positive inputs. There an OR with the sign bit gives the same word as the flip, so _raw_f32_bits (tools/rdna2spirv.py:11774) could emit OpBitwiseOr instead of OpBitwiseXor and the file still passed.

test_neg_of_negative_operand negates a negative S1 and S2 (two finite values, two NaNs). Each must give exactly the word MEASURED holds for the unmodified row with the positive value, so every expectation comes from a gfx1036 measurement already in the file (the test asserts that the base row is there). No new hardware values are introduced.

tools/semantic_mutants.py --lines 11766-11776 tests/semantic/test_alu_div_fixup_f32.py: 5 of 6 mutants caught before, 6 of 6 after (XOR -> OR now fails 4 subtests).

Test only, no translator change. Tested: python -m unittest discover -s tests/semantic -p test_alu_div_fixup_f32.py (5 tests OK) on main 21625bca8, Linux, CPU interpreter; no GPU needed. No game files.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

**@⁠qhukz13** on GitHub · 2026-11-24 11:29 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/673) `qhukz13:cont/div-fixup-neg` → `main` · +33 −0 · 1 files · 1 commits · merged 2026-11-24 16:06 UTC Claimed in the coordination issue as: TEST-DIV-FIXUP-NEG The VOP3 `neg` rows in `test_alu_div_fixup_f32.py` (section 9) negate only positive inputs. There an OR with the sign bit gives the same word as the flip, so `_raw_f32_bits` (`tools/rdna2spirv.py:11774`) could emit `OpBitwiseOr` instead of `OpBitwiseXor` and the file still passed. `test_neg_of_negative_operand` negates a negative S1 and S2 (two finite values, two NaNs). Each must give exactly the word `MEASURED` holds for the unmodified row with the positive value, so every expectation comes from a gfx1036 measurement already in the file (the test asserts that the base row is there). No new hardware values are introduced. `tools/semantic_mutants.py --lines 11766-11776 tests/semantic/test_alu_div_fixup_f32.py`: 5 of 6 mutants caught before, 6 of 6 after (XOR -> OR now fails 4 subtests). Test only, no translator change. Tested: `python -m unittest discover -s tests/semantic -p test_alu_div_fixup_f32.py` (5 tests OK) on `main` 21625bca8, Linux, CPU interpreter; no GPU needed. No game files. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The neg rows in section 9 negate only positive inputs, where an OR with the sign bit gives the same word as the
flip, so `_raw_f32_bits` could emit OpBitwiseOr for neg and the file still passed. The new test negates a
negative S1 and S2 (two finite, two NaN) and checks each against the unmodified MEASURED row with the positive
value. tools/semantic_mutants.py --lines 11766-11776: 5 of 6 mutants caught before, 6 of 6 after.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:15:27 +00:00
github manually merged commit 0253b381c6 into gh-pr/673/base 2026-11-26 09:15:31 +00:00
Author
Owner

@⁠trigger337 on GitHub · 2026-11-24 11:37 UTC · original

agent: yes
AI-assisted: yes

Verified on Linux (CachyOS x86_64, Python 3.13):

  1. Semantic Tests:
    • python3 -m unittest discover -s tests/semantic -p test_alu_div_fixup_f32.py -v: 5/5 passed cleanly (including test_neg_of_negative_operand).
  2. Mutant Verification:
    • python3 tools/semantic_mutants.py --lines 11766-11776 tests/semantic/test_alu_div_fixup_f32.py:
      • 6 of 6 mutants caught (0 survived).
      • Confirmed that OpBitwiseXor -> OpBitwiseOr on line 11774 now triggers 4 subtest failures as expected.
**@⁠trigger337** on GitHub · 2026-11-24 11:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/673#issuecomment-7130345490) agent: yes AI-assisted: yes Verified on Linux (CachyOS x86_64, Python 3.13): 1. **Semantic Tests**: - `python3 -m unittest discover -s tests/semantic -p test_alu_div_fixup_f32.py -v`: 5/5 passed cleanly (including `test_neg_of_negative_operand`). 2. **Mutant Verification**: - `python3 tools/semantic_mutants.py --lines 11766-11776 tests/semantic/test_alu_div_fixup_f32.py`: - 6 of 6 mutants caught (0 survived). - Confirmed that `OpBitwiseXor -> OpBitwiseOr` on line 11774 now triggers 4 subtest failures as expected.
This discussion has been locked. Commenting is limited to contributors.
No description provided.