docs(debt): cut the long-double Dinkumware entry to _LLog with the bundled libc.prx code #11217

Merged
AlexFigas merged 1 commit from upstream-pr/11217 into main 2026-10-27 06:58:44 +00:00
AlexFigas commented 2026-10-25 21:59:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AlexFigas on 2026-10-25T21:59:38Z.


What

The debt entry for _LDivide, _LRecip and _LLog says their exact console results, signaling-NaN behavior and floating-point exceptions are not verified. For the first two, the libc.prx that PPSA21564 bundles (sce_module/libc.prx, the library's own code) settles this. Both are one x87 division, the same instructions this libc compiles to:

Function That libc.prx This libc (libc.prx built here)
_LDivide(x, y) 0x813b0: fld xword ptr [rsp+0x18]; fld xword ptr [rsp+8]; fdivrp st(1); ret fldt 0x8(%rsp); fldt 0x18(%rsp); fdivrp; ret
_LRecip(x) 0x813c0: fld xword ptr [rsp+8]; fld1; fdivrp st(1); ret fldt 0x8(%rsp); fld1; fdivp; ret

Both versions run the same fdiv on the guest thread's x87 control word, so results, NaN handling and exception flags agree. The entry is cut to _LLog, whose code (0x3fd50) classifies its argument and is not compared here.

Possible follow-up: the _Divide, _FDivide, _Recip and _FRecip entry can go the same way. That libc.prx computes them as vdivsd, vdivss, 1.0 / x and 1.0f / x (0x80ab0, 0x81140, 0x80ac0, 0x81150), as this libc does (divsd, divss). I left it for later because #10345 rewrites the line next to it.

Tested

Documentation only. I disassembled the functions above in the relinked libc.prx from PPSA21564 and in libc.prx built here (GCC 13.3, Release).

  • python3 tools/check_conventions.py --base origin/main passes.
  • python3 tools/pr_overlap.py --branch docs/libc-dinkumware-division-evidence finds no overlap.

Checklist

  • Based on current main; no other open PR implements the same functions
  • 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 under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5009132053 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11217). Originally posted by [AlexFigas](https://github.com/AlexFigas) on 2026-10-25T21:59:38Z. --- ### What The debt entry for `_LDivide`, `_LRecip` and `_LLog` says their exact console results, signaling-NaN behavior and floating-point exceptions are not verified. For the first two, the `libc.prx` that PPSA21564 bundles (`sce_module/libc.prx`, the library's own code) settles this. Both are one x87 division, the same instructions this libc compiles to: | Function | That `libc.prx` | This libc (`libc.prx` built here) | |---|---|---| | `_LDivide(x, y)` | 0x813b0: `fld xword ptr [rsp+0x18]; fld xword ptr [rsp+8]; fdivrp st(1); ret` | `fldt 0x8(%rsp); fldt 0x18(%rsp); fdivrp; ret` | | `_LRecip(x)` | 0x813c0: `fld xword ptr [rsp+8]; fld1; fdivrp st(1); ret` | `fldt 0x8(%rsp); fld1; fdivp; ret` | Both versions run the same `fdiv` on the guest thread's x87 control word, so results, NaN handling and exception flags agree. The entry is cut to `_LLog`, whose code (0x3fd50) classifies its argument and is not compared here. Possible follow-up: the `_Divide`, `_FDivide`, `_Recip` and `_FRecip` entry can go the same way. That `libc.prx` computes them as `vdivsd`, `vdivss`, `1.0 / x` and `1.0f / x` (0x80ab0, 0x81140, 0x80ac0, 0x81150), as this libc does (`divsd`, `divss`). I left it for later because #10345 rewrites the line next to it. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Documentation only. I disassembled the functions above in the relinked `libc.prx` from PPSA21564 and in `libc.prx` built here (GCC 13.3, Release). - `python3 tools/check_conventions.py --base origin/main` passes. - `python3 tools/pr_overlap.py --branch docs/libc-dinkumware-division-evidence` finds no overlap. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-25 22:09:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T22:09:51Z.

Review: APPROVED


Reviewed exact head eb943993a73394b85adae79053956e1d849dc9cd. The debt change keeps _LLog unresolved while removing only _LDivide and _LRecip. I checked the reported x87 sequence against the implementations (x / y and 1.0L / x) and verified the GNU AT&T fdivp spelling in the table is not directly comparable to the bundled binary's Intel-syntax fdivrp st(1): assembling the corresponding AT&T sequence confirms the stack operation implements the same reciprocal. The division sequences likewise use opposite load orders, so their reverse divide operations produce the same quotient.

git diff --check and current-main conventions pass. The hosted eligibility, conventions, intake and labels checks pass; all build jobs are skipped for this documentation-only change. The disassemblies were produced by the author from the bundled title library and the locally built library; I did not independently access that title binary. No issue found in the documentation scope.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5645590050 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11217#pullrequestreview-5645590050). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T22:09:51Z. **Review:** APPROVED --- Reviewed exact head `eb943993a73394b85adae79053956e1d849dc9cd`. The debt change keeps `_LLog` unresolved while removing only `_LDivide` and `_LRecip`. I checked the reported x87 sequence against the implementations (`x / y` and `1.0L / x`) and verified the GNU AT&T `fdivp` spelling in the table is not directly comparable to the bundled binary's Intel-syntax `fdivrp st(1)`: assembling the corresponding AT&T sequence confirms the stack operation implements the same reciprocal. The division sequences likewise use opposite load orders, so their reverse divide operations produce the same quotient. `git diff --check` and current-main conventions pass. The hosted eligibility, conventions, intake and labels checks pass; all build jobs are skipped for this documentation-only change. The disassemblies were produced by the author from the bundled title library and the locally built library; I did not independently access that title binary. No issue found in the documentation scope.
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!11217
No description provided.