[PR #3482] [MERGED] constant_propagation_pass: Handle a few more bitwise instructions. #3504

Closed
opened 2026-02-27 22:03:56 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/3482
Author: @squidbus
Created: 8/30/2025
Status: Merged
Merged: 8/30/2025
Merged by: @squidbus

Base: mainHead: bitwise-const-prop


📝 Commits (1)

  • 8e6a682 constant_propagation_pass: Handle a few more bitwise instructions.

📊 Changes

1 file changed (+18 additions, -0 deletions)

View changed files

📝 src/shader_recompiler/ir/passes/constant_propagation_pass.cpp (+18 -0)

📄 Description

Fold the following bitwise instructions when operands are immediates:

  • BitwiseNot32
  • BitReverse32
  • BitCount32
  • BitCount64

Fixes assertion in My First Gran Turismo® (CUSA49696) due to sharp being constructed using bit reverse with a constant. With constant propagation turning it into an immediate beforehand, this is handled properly.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/shadps4-emu/shadPS4/pull/3482 **Author:** [@squidbus](https://github.com/squidbus) **Created:** 8/30/2025 **Status:** ✅ Merged **Merged:** 8/30/2025 **Merged by:** [@squidbus](https://github.com/squidbus) **Base:** `main` ← **Head:** `bitwise-const-prop` --- ### 📝 Commits (1) - [`8e6a682`](https://github.com/shadps4-emu/shadPS4/commit/8e6a68299143814b7c53d5c365a6b3d6c005bf7f) constant_propagation_pass: Handle a few more bitwise instructions. ### 📊 Changes **1 file changed** (+18 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/shader_recompiler/ir/passes/constant_propagation_pass.cpp` (+18 -0) </details> ### 📄 Description Fold the following bitwise instructions when operands are immediates: * `BitwiseNot32` * `BitReverse32` * `BitCount32` * `BitCount64` Fixes assertion in My First Gran Turismo® (CUSA49696) due to sharp being constructed using bit reverse with a constant. With constant propagation turning it into an immediate beforehand, this is handled properly. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 22:03:56 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shadPS4#3504
No description provided.