feat(libc): implement __powidf2 for Cyberpunk imports #4378

Closed
MarcZX10 wants to merge 1 commit from upstream-pr/4378 into main
MarcZX10 commented 2026-10-12 08:17:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T08:17:33Z.


What

Completes #3161. Current main already has abs; this change adds the missing __powidf2 integer-power helper as the SDK's Clang compiler-rt implementation and removes the stale H+8UBOwfScI placeholder, which has the same NID. The exponent magnitude is handled as unsigned, including INT_MIN. The existing float helper is unchanged. TechnicalDebt records the assumed compiler-rt behavior and its underflow difference from pow.

The implementation is carried from screamm’s ready branch, with the original author preserved.

Tested

  • Linux, GCC 12.2, Release, BUILD_TESTING=ON: configured successfully.
  • Built guest_math_tests; ctest -R '^guest_math$': 1/1 passed.
  • python3 tools/nid_names.py --nid 'H+8UBOwfScI' --json identifies __powidf2 as already implemented.
  • python3 tools/check_conventions.py --base upstream/main: passed.
  • git diff --check: passed.
  • Windows and macOS: not tested locally.

Checklist

  • Based on current main; no other open PR implements this function
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes; carried from the original implementation with authorship preserved
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4826733941 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4378). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T08:17:33Z. --- ### What Completes #3161. Current `main` already has `abs`; this change adds the missing `__powidf2` integer-power helper as the SDK's Clang compiler-rt implementation and removes the stale `H+8UBOwfScI` placeholder, which has the same NID. The exponent magnitude is handled as unsigned, including `INT_MIN`. The existing float helper is unchanged. TechnicalDebt records the assumed compiler-rt behavior and its underflow difference from `pow`. The implementation is carried from screamm’s ready branch, with the original author preserved. ### Tested - Linux, GCC 12.2, Release, `BUILD_TESTING=ON`: configured successfully. - Built `guest_math_tests`; `ctest -R '^guest_math$'`: 1/1 passed. - `python3 tools/nid_names.py --nid 'H+8UBOwfScI' --json` identifies `__powidf2` as already implemented. - `python3 tools/check_conventions.py --base upstream/main`: passed. - `git diff --check`: passed. - Windows and macOS: not tested locally. ### Checklist - [x] Based on current `main`; no other open PR implements this function - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes; carried from the original implementation with authorship preserved
github-actions[bot] commented 2026-10-12 08:28:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T08:28:22Z.


Progress report (1acfa7f → f9fe59f)

📈 System libraries: 86.39% (+0.03%, +1 implemented, -1 removed functions)

✅ 1 implemented
Library Name
libc __powidf2_nid_postfix
🗑️ 1 removed
Library Name
libc libcCyberUnknown08
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6120581278 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4378#issuecomment-6120581278). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-12T08:28:22Z. --- <!-- progress-report --> ### Progress report (1acfa7f → f9fe59f) 📈 **System libraries**: 86.39% (+0.03%, +1 implemented, -1 removed functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libc | `__powidf2_nid_postfix` | </details> <details> <summary>🗑️ 1 removed</summary> | Library | Name | | - | - | | libc | `libcCyberUnknown08` | </details>
github-actions[bot] commented 2026-10-12 08:37:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T08:37:02Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#2465 __powidf2_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6120705633 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4378#issuecomment-6120705633). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-12T08:37:02Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #2465 | | `__powidf2_nid_postfix` | |
xXPBSXx commented 2026-10-12 11:22:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T11:22:32Z.


Windows test: head 41b598a8a merged onto current main 3d8ffeb27 (clean merge, no conflicts). Windows 10, MinGW GCC (WinLibs), Ninja Release, -j4: full build 0 errors; ctest (guest_math): 1/1 passed; python tools/check_conventions.py --base upstream/main passed. I did not run the new tests against main without the change.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6123262363 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4378#issuecomment-6123262363). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-12T11:22:32Z. --- Windows test: head `41b598a8a` merged onto current `main` `3d8ffeb27` (clean merge, no conflicts). Windows 10, MinGW GCC (WinLibs), Ninja Release, `-j4`: full build 0 errors; ctest (guest_math): 1/1 passed; `python tools/check_conventions.py --base upstream/main` passed. I did not run the new tests against `main` without the change. AI-assisted (Claude Code).
blawesom commented 2026-10-12 14:02:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-12T14:02:01Z.


Rebase handoff — rebased onto current main, authorship unchanged (only a TechnicalDebt.md union conflict; both entries kept).

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV):

  • builds; tools/check_conventions.py --base origin/main passes
  • full suite: 954/954 passed

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/4378
git checkout <your branch>
git merge --ff-only FETCH_HEAD
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6125841934 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4378#issuecomment-6125841934). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-12T14:02:01Z. --- **Rebase handoff** — rebased onto current `main`, authorship unchanged (only a `TechnicalDebt.md` union conflict; both entries kept). Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`, AMD RX 9070 XT / RADV): - builds; `tools/check_conventions.py --base origin/main` passes - **full suite: 954/954 passed** **To pick it up:** ``` git fetch https://github.com/blawesom/AnyPS5 rebase/4378 git checkout <your branch> git merge --ff-only FETCH_HEAD ```
oneandonlydean commented 2026-10-13 00:21:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T00:21:44Z.


Closing: no title is shown calling __powidf2 (H+8UBOwfScI), which is why #4229 was closed shortly before this was opened, and #2465 is open for the same export. Reopen with the title ID and the line where it throws on main.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6135191776 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4378#issuecomment-6135191776). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T00:21:44Z. --- Closing: no title is shown calling `__powidf2` (`H+8UBOwfScI`), which is why #4229 was closed shortly before this was opened, and #2465 is open for the same export. Reopen with the title ID and the line where it throws on main.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
boykopovar/AnyPS5!4378
No description provided.