tests: cover S_FF1_I32_B32 and V_CMPX_U_F32 #1155

Closed
github-bot wants to merge 2 commits from gh-pr/1155/head into gh-pr/1155/base
Owner

@⁠Nawid3333 on GitHub · 2026-10-07 17:53 UTC · original
Nawid3333:tests/remaining-opcode-coverage → main · +67 −0 · 1 files · 2 commits · closed without merging

What

These two opcodes decode and translate, but no test names them (V_CMPX_U_F32 was added in #1120). This adds a GPU case for each to shader_recompiler_compute_tests, one commit per opcode. Test-only: no source change.

  • ScalarFf1I32B32 checks the index of the lowest set bit for 0, 1, 0x80000000, 0x00f00000 and 0xffffffff. The result is -1 when no bit is set, as the existing S_FF1_I32_B64 check in ScalarBitfieldPack expects. The case also checks that SCC is left unchanged when it is 1 and when it is 0. It runs in the default list and with --sff1-b32-only.
  • VectorCmpxUF32CapturedExecMask: a NaN on either side keeps the lane in EXEC. Ordered operands (1.0 vs 2.0, 1.0 vs 1.0) clear it, so the following store leaves the initial value. It runs in the default list and with --fp32-compare-only.

Cross-check for S_FF1_I32_B32 in LLVM's AMDGPU backend (SOPInstructions.td):

  • its pattern is AMDGPUffbl_b32;
  • its definition follows the } // End Defs = [SCC] line, so it isn't marked as writing SCC;
  • its GFX11 encoding is named s_ctz_i32_b32 (SOP1_Real_gfx11_gfx12<0x008, "s_ctz_i32_b32">).

Testing

Windows 11, clang-cl 19.1.5, Release, AMD RX 9070 XT, this branch on main d2413fc2:

  • --sff1-b32-only and --fp32-compare-only: pass.
  • The cases can fail. In the local gate run, each of these makes the matching case fail at readback:
    • translating S_FF1_I32_B32 with FindUMsb32 instead of FindILsb32;
    • translating V_CMPX_U_F32 as an ordered compare.
  • Builds on Windows, Linux and macOS (fork CI: https://github.com/Nawid3333/KytyPS5/actions/runs/37659777263).
  • Rebased onto main c86c8b4d: both modes still pass there, and both changes above still make them fail.

AI use (per the README's AI policy): Claude (Anthropic) found the untested opcodes, wrote the cases, derived the expected values and ran the checks above on my machine. I reviewed the cases and the results before opening this PR.

🤖 Generated with Claude Code

**@⁠Nawid3333** on GitHub · 2026-10-07 17:53 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1155) `Nawid3333:tests/remaining-opcode-coverage` → `main` · +67 −0 · 1 files · 2 commits · closed without merging ## What These two opcodes decode and translate, but no test names them (`V_CMPX_U_F32` was added in #1120). This adds a GPU case for each to `shader_recompiler_compute_tests`, one commit per opcode. Test-only: no source change. - `ScalarFf1I32B32` checks the index of the lowest set bit for `0`, `1`, `0x80000000`, `0x00f00000` and `0xffffffff`. The result is `-1` when no bit is set, as the existing `S_FF1_I32_B64` check in `ScalarBitfieldPack` expects. The case also checks that SCC is left unchanged when it is 1 and when it is 0. It runs in the default list and with `--sff1-b32-only`. - `VectorCmpxUF32CapturedExecMask`: a NaN on either side keeps the lane in EXEC. Ordered operands (`1.0` vs `2.0`, `1.0` vs `1.0`) clear it, so the following store leaves the initial value. It runs in the default list and with `--fp32-compare-only`. Cross-check for `S_FF1_I32_B32` in LLVM's AMDGPU backend (`SOPInstructions.td`): - its pattern is `AMDGPUffbl_b32`; - its definition follows the `} // End Defs = [SCC]` line, so it isn't marked as writing SCC; - its GFX11 encoding is named `s_ctz_i32_b32` (`SOP1_Real_gfx11_gfx12<0x008, "s_ctz_i32_b32">`). ## Testing Windows 11, clang-cl 19.1.5, Release, AMD RX 9070 XT, this branch on `main` d2413fc2: - `--sff1-b32-only` and `--fp32-compare-only`: pass. - The cases can fail. In the local gate run, each of these makes the matching case fail at readback: - translating `S_FF1_I32_B32` with `FindUMsb32` instead of `FindILsb32`; - translating `V_CMPX_U_F32` as an ordered compare. - Builds on Windows, Linux and macOS (fork CI: https://github.com/Nawid3333/KytyPS5/actions/runs/37659777263). - Rebased onto `main` c86c8b4d: both modes still pass there, and both changes above still make them fail. **AI use** (per the README's AI policy): Claude (Anthropic) found the untested opcodes, wrote the cases, derived the expected values and ran the checks above on my machine. I reviewed the cases and the results before opening this PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
S_FF1_I32_B32 decodes and translates but no test exercised it. ScalarFf1I32B32
checks the index of the lowest set bit for 0, 1, 0x80000000, 0x00f00000 and
0xffffffff (-1 when no bit is set, like the existing S_FF1_I32_B64 check) and
that SCC is left unchanged in both states. It runs in the default list and with
--sff1-b32-only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
V_CMPX_U_F32 (#1120) has no test. VectorCmpxUF32CapturedExecMask runs it with a
NaN on either side, which keeps the lane in EXEC, and with ordered operands
(1.0 vs 2.0 and 1.0 vs 1.0), which clears it so the following store leaves the
initial value. It runs in the default list and with --fp32-compare-only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:45:26 +00:00
github-bot closed this pull request 2026-11-26 09:45:26 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-07 18:11 UTC · original · edited 2026-10-07 22:15 UTC

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1677c7af-6a1b-4213-91de-b0752a822d02
📥 Commits

Reviewing files that changed from the base of the PR and between e6d80110ab442e562a1e38704f3c82dffe0aa78b and 2b9c9a261e.

📒 Files selected for processing (1)
  • tests/ShaderRecompilerComputeTests.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The compute tests add ScalarFf1I32B32 for S_FF1_I32_B32 and VectorCmpxUF32CapturedExecMask for unordered F32 compare-and-execute masking. Both tests are registered in the standard case list. The scalar test has a dedicated selector, and the vector test is added to the FP32 compare selector.

Suggested reviewers: nmzik

Priority: ⬇️ Low

Change: Other

Merge Risk: ⚪ Minimal · up to 2b9c9

This test-only change adds focused coverage for FF1 and unordered compare behavior. No material merge-blocking risk remains beyond normal checks.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the two opcodes covered by the test-only changes: S_FF1_I32_B32 and V_CMPX_U_F32.
Description check ✅ Passed The description directly explains the added tests, expected behavior, selectors, and validation results. It is relevant to the changeset.
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-07 18:11 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1155#issuecomment-6043950005) · edited 2026-10-07 22:15 UTC <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/1155?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=2" alt="Review in Change Stack →" width="220" height="32"></a> <!-- review_stack_entry_end --> <!-- recent_review_start --> No actionable comments were generated in the recent review. 🎉 <details> <summary>ℹ️ Recent review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `1677c7af-6a1b-4213-91de-b0752a822d02` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between e6d80110ab442e562a1e38704f3c82dffe0aa78b and 2b9c9a261e38fd2a89c144953a930c930d327c18. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `tests/ShaderRecompilerComputeTests.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. </details> --- <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough The compute tests add `ScalarFf1I32B32` for `S_FF1_I32_B32` and `VectorCmpxUF32CapturedExecMask` for unordered F32 compare-and-execute masking. Both tests are registered in the standard case list. The scalar test has a dedicated selector, and the vector test is added to the FP32 compare selector. **Suggested reviewers:** `nmzik` </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ⬇️ Low <!-- change_assessment_commit:"2b9c9a261e38fd2a89c144953a930c930d327c18" --> **Change:** Other <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** **⚪ Minimal** · up to `2b9c9` <!-- final_review_risk_coverage:{"sourceCommitId":"2b9c9a261e38fd2a89c144953a930c930d327c18","coveredCommitId":"2b9c9a261e38fd2a89c144953a930c930d327c18","kind":"reviewed"} --> This test-only change adds focused coverage for FF1 and unordered compare behavior. No material merge-blocking risk remains beyond normal checks. <!-- final_review_risk_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary>🚥 Pre-merge checks | ✅ 5</summary> <details> <summary>✅ Passed checks (5 passed)</summary> | Check name | Status | Explanation | | :------------------------ | :------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0… | | Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | | Title check | ✅ Passed | The title clearly identifies the two opcodes covered by the test-only changes: S_FF1_I32_B32 and V_CMPX_U_F32. | | Description check | ✅ Passed | The description directly explains the added tests, expected behavior, selectors, and validation results. It is relevant to the changeset. | </details> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autopilot</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=1155)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary>❤️ Share</summary> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.