[PR #722] [MERGED] Set CF correctly on BLSI patch #1736

Closed
opened 2026-02-27 21:13:45 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/722
Author: @OFFTKP
Created: 9/1/2024
Status: Merged
Merged: 9/3/2024
Merged by: @raphaelthegreat

Base: mainHead: blsi


📝 Commits (2)

📊 Changes

1 file changed (+16 additions, -1 deletions)

View changed files

📝 src/core/cpu_patches.cpp (+16 -1)

📄 Description

BLSI needs to set CF if source is not zero and clear it otherwise:

temp := (-SRC) bitwiseAND (SRC);
SF := temp[OperandSize -1];
ZF := (temp = 0);
IF SRC = 0
    CF := 0;
ELSE
    CF := 1;
FI
DEST := temp;

Since unfortunately AND clears CF, we need to take the CF from NEG and apply it after the AND.
NEG sets CF like so:

IF DEST = 0
    THEN CF := 0;
    ELSE CF := 1;
FI;
DEST := [– (DEST)]

🔄 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/722 **Author:** [@OFFTKP](https://github.com/OFFTKP) **Created:** 9/1/2024 **Status:** ✅ Merged **Merged:** 9/3/2024 **Merged by:** [@raphaelthegreat](https://github.com/raphaelthegreat) **Base:** `main` ← **Head:** `blsi` --- ### 📝 Commits (2) - [`1e9ca6f`](https://github.com/shadps4-emu/shadPS4/commit/1e9ca6fb7f5732dacbec13520ce8c8e1b52776c9) Set CF correctly on BLSI patch - [`ba545cf`](https://github.com/shadps4-emu/shadPS4/commit/ba545cf83f5d1c181ed5c88314403c2bdeecf643) Remove redundant CLC ### 📊 Changes **1 file changed** (+16 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/core/cpu_patches.cpp` (+16 -1) </details> ### 📄 Description BLSI needs to set CF if source is not zero and clear it otherwise: ``` temp := (-SRC) bitwiseAND (SRC); SF := temp[OperandSize -1]; ZF := (temp = 0); IF SRC = 0 CF := 0; ELSE CF := 1; FI DEST := temp; ``` Since unfortunately AND clears CF, we need to take the CF from NEG and apply it after the AND. NEG sets CF like so: ``` IF DEST = 0 THEN CF := 0; ELSE CF := 1; FI; DEST := [– (DEST)] ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 21:13:45 +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#1736
No description provided.