shader: support S_ASHR_I64 #658

Manually merged
github merged 2 commits from gh-pr/658/head into gh-pr/658/base 2026-11-26 09:28:21 +00:00
Owner

@⁠ElijaOwO on GitHub · 2026-09-17 02:48 UTC · original
ElijaOwO:shader-s-ashr-i64 → main · +330 −1 · 7 files · 2 commits · merged 2026-09-17 06:48 UTC

Added support for the SOP2 S_ASHR_I64 instruction (0x23).

Added focused shader CFG regression test for decoding and
arithmetic-shift lowering.

Tested on Windows with clang-cl 22.1.3.

  • Release launcher build: passed
  • shader_cfg_tests build: passed
  • shader_recompiler_compute_tests build: passed
  • shader_cfg CTest: passed (1/1)

Summary by CodeRabbit

  • New Features

    • Added support for decoding and translating 64-bit arithmetic right-shift shader instructions.
    • Enables correct handling of signed 64-bit shift operations during shader recompilation.
  • Tests

    • Added coverage verifying recognition and intermediate representation of 64-bit arithmetic right shifts.
**@⁠ElijaOwO** on GitHub · 2026-09-17 02:48 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/658) `ElijaOwO:shader-s-ashr-i64` → `main` · +330 −1 · 7 files · 2 commits · merged 2026-09-17 06:48 UTC Added support for the SOP2 S_ASHR_I64 instruction (0x23). Added focused shader CFG regression test for decoding and arithmetic-shift lowering. Tested on Windows with clang-cl 22.1.3. - Release launcher build: passed - shader_cfg_tests build: passed - shader_recompiler_compute_tests build: passed - shader_cfg CTest: passed (1/1) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added support for decoding and translating 64-bit arithmetic right-shift shader instructions. * Enables correct handling of signed 64-bit shift operations during shader recompilation. * **Tests** * Added coverage verifying recognition and intermediate representation of 64-bit arithmetic right shifts. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:28:20 +00:00
github manually merged commit c89e08befa into gh-pr/658/base 2026-11-26 09:28:21 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-17 02:48 UTC · original · edited 2026-09-17 06:48 UTC

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 6d9dbd04-6979-45e5-8237-606d13e1be42

📥 Commits

Reviewing files that changed from the base of the PR and between 63fb822f8a and ae252875e5b96ed9b8e95277b3e88d097cb79d77.

📒 Files selected for processing (4)
  • src/graphics/shader/recompiler/frontend/decode/ScalarAluOps.cpp
  • src/graphics/shader/recompiler/frontend/decode/ShaderDecoder.h
  • src/graphics/shader/recompiler/frontend/translate/Scalar.cpp
  • tests/shaderCfgTests.cpp

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The shader recompiler now recognizes S_ASHR_I64, translates it as a 64-bit arithmetic right shift, and tests both decoding and IR lowering.

Changes

Scalar 64-bit arithmetic right shift

Layer / File(s) Summary
Opcode decoding and translation
src/graphics/shader/recompiler/frontend/decode/ShaderDecoder.h, src/graphics/shader/recompiler/frontend/decode/ScalarAluOps.cpp, src/graphics/shader/recompiler/frontend/translate/Scalar.cpp, tests/shaderCfgTests.cpp
Adds Opcode::S_ASHR_I64, maps opcode 0x23, emits 64-bit arithmetic right-shift IR, and validates decoding and lowering.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant ShaderDecoder
  participant Translator
  participant IR
  ShaderDecoder->>ShaderDecoder: Decode s_ashr_i64
  ShaderDecoder->>Translator: Dispatch S_ASHR_I64
  Translator->>IR: Emit ShiftRightArithmeticI64

Suggested reviewers: nmzik

Merge Risk: ⚪ Minimal · up to ae252

The decoder, lowering, and regression coverage are aligned, with no remaining concrete merge risk identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the main change: support for the S_ASHR_I64 shader instruction.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. (1 skipped: 1 too large.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

**@⁠coderabbitai[bot]** on GitHub · 2026-09-17 02:48 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/658#issuecomment-5707710573) · edited 2026-09-17 06:48 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/658#gh-light-mode-only"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg" alt="Review Change Stack" width="202" height="32"></a><a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/658#gh-dark-mode-only"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg" alt="Review Change Stack" width="202" 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**: defaults **Review profile**: CHILL **Plan**: Advanced **Run ID**: `6d9dbd04-6979-45e5-8237-606d13e1be42` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 63fb822f8a3f7339803c26f78b764ad0995817e2 and ae252875e5b96ed9b8e95277b3e88d097cb79d77. </details> <details> <summary>📒 Files selected for processing (4)</summary> * `src/graphics/shader/recompiler/frontend/decode/ScalarAluOps.cpp` * `src/graphics/shader/recompiler/frontend/decode/ShaderDecoder.h` * `src/graphics/shader/recompiler/frontend/translate/Scalar.cpp` * `tests/shaderCfgTests.cpp` </details> **Included review availability:** Your plan provides up to 10 included reviews per hour; 9 remain after this review. </details> --- <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough The shader recompiler now recognizes `S_ASHR_I64`, translates it as a 64-bit arithmetic right shift, and tests both decoding and IR lowering. ### Changes **Scalar 64-bit arithmetic right shift** |Layer / File(s)|Summary| |---|---| |**Opcode decoding and translation** <br> `src/graphics/shader/recompiler/frontend/decode/ShaderDecoder.h`, `src/graphics/shader/recompiler/frontend/decode/ScalarAluOps.cpp`, `src/graphics/shader/recompiler/frontend/translate/Scalar.cpp`, `tests/shaderCfgTests.cpp`|Adds `Opcode::S_ASHR_I64`, maps opcode `0x23`, emits 64-bit arithmetic right-shift IR, and validates decoding and lowering.| <!-- change_assessment_start --> **Priority:** ⬇️ Low **Estimated code review effort:** 2 (Simple) | ~10 minutes <!-- change_assessment_commit:"ae252875e5b96ed9b8e95277b3e88d097cb79d77" --> **Change:** Feature <!-- change_assessment_end --> ### Sequence Diagram(s) ```mermaid sequenceDiagram participant ShaderDecoder participant Translator participant IR ShaderDecoder->>ShaderDecoder: Decode s_ashr_i64 ShaderDecoder->>Translator: Dispatch S_ASHR_I64 Translator->>IR: Emit ShiftRightArithmeticI64 ``` **Suggested reviewers:** `nmzik` </details> <!-- walkthrough_end --> <!-- final_review_risk_start --> **Merge Risk:** _⚪ Minimal_ · up to `ae252` <!-- final_review_risk_coverage:{"sourceCommitId":"ae252875e5b96ed9b8e95277b3e88d097cb79d77","coveredCommitId":"ae252875e5b96ed9b8e95277b3e88d097cb79d77","kind":"reviewed"} --> The decoder, lowering, and regression coverage are aligned, with no remaining concrete merge risk identified. <!-- final_review_risk_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary>🚥 Pre-merge checks | ✅ 4 | ❌ 1</summary> ### ❌ Failed checks (1 warning) | Check name | Status | Explanation | Resolution | | :----------------: | :--------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ⚠️ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. (1 skipped: 1 … | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary>✅ Passed checks (4 passed)</summary> | Check name | Status | Explanation | | :------------------------: | :------- | :----------------------------------------------------------------------------------------------------------- | | Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. | | Title check | ✅ Passed | The title clearly and concisely identifies the main change: support for the `S_ASHR_I64` shader instruction. | | 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. | </details> <details> <summary>Full details: Docstring Coverage</summary> **Explanation** Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. (1 skipped: 1 too large.) </details> </details> <!-- pre_merge_checks_walkthrough_end --> - [ ] <!-- {"checkboxId":"585bb3f6-faf5-4dbf-96d2-74e382adf19a"} --> Fix all pre-merge checks with AI <!-- finishing_touch_checkbox_start --> <details> <summary>✨ Finishing Touches</summary> <details> <summary>🧪 Generate unit tests (beta)</summary> - [ ] <!-- {"checkboxId": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Create PR with unit tests </details> </details> <!-- finishing_touch_checkbox_end --> <!-- tips_start --> --- <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
This discussion has been locked. Commenting is limited to contributors.
No description provided.