feat(libc): implement x87 long-double finite classification #5599

Merged
JJenkx merged 5 commits from upstream-pr/5599 into main 2026-10-15 15:03:19 +00:00
JJenkx commented 2026-10-14 00:51:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-14T00:51:35Z.


What

Implement __isfinitel (NID 3-zCDXatSU4), imported by Astro Bot PPSA21564's bundled PSML module. Classify the x87 exponent directly: return 1 for finite values and 0 for infinities/NaNs, without narrowing to double or performing floating-point comparisons. Require the existing little-endian, 16-byte x87 long-double representation.

The signature/classification follows FreeBSD msun; console behavior is unmeasured and recorded in library debt.

Tested

  • Full standalone Linux/Windows fork CI passes head 665136f53ef5, containing main d1670009fbfd: Linux 1,037 passed / 46 skipped; Windows 714 passed / 389 skipped. Expected skips remain unvalidated.
  • Eighteen guest-ABI cases cover signed zero/subnormals, ordinary and extreme finite values, finite values beyond double's range, infinities, quiet NaNs and signaling NaNs. Existing floating-point exception flags are preserved without adding flags.
  • Ten additional Linux calls through the production patched NID use raw x87 patterns, including a signaling NaN, and preserve errno and floating-point exception flags.
  • Earlier Astro import auditing no longer reports this NID as undefined. This is import/classification coverage, not standalone title-startup or gameplay proof. Native macOS library execution has not been validated.
  • The branch merges cleanly with main ce5c8395333; full CI remains tied to its recorded source/base. Conventions and whitespace checks pass.

Checklist

  • Based on main; current mergeability and tested revisions recorded above
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • No silent stubs added
  • No notes, investigation files or images added to the repository
  • No new third-party code
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: PPSA21564 #357 (PSML finite-classification import)
  • GPUs tested: n/a; libc classification
  • AI-assisted: yes

Current review refresh: head 2f9d04fb77ffe4880e56e3548d78443c1395ad2b includes upstream main a5f493f90dca348a65561aed4bb325a629d1b668. Conflicts are resolved and current conventions pass. Earlier full-build results describe the earlier head; fresh full Linux/Windows checks for this head are pending.

Verified current full CI: run 38505264035 passes topic 2f9d04fb77ffe4880e56e3548d78443c1395ad2b merged into base a5f493f90dca348a65561aed4bb325a629d1b668. Linux 1059 passed/46 expected skips; Windows 730 passed/397 expected skips. Skipped cases remain unvalidated. The tested source tree matches this published topic head.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4851389173 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5599). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-14T00:51:35Z. --- ### What Implement `__isfinitel` (NID `3-zCDXatSU4`), imported by Astro Bot PPSA21564's bundled PSML module. Classify the x87 exponent directly: return 1 for finite values and 0 for infinities/NaNs, without narrowing to double or performing floating-point comparisons. Require the existing little-endian, 16-byte x87 long-double representation. The signature/classification follows [FreeBSD msun](https://github.com/freebsd/freebsd-src/blob/main/lib/msun/src/s_isfinite.c); console behavior is unmeasured and recorded in library debt. ### Tested - [Full standalone Linux/Windows fork CI](https://github.com/JJenkx/AnyPS5/actions/runs/38486846204) passes head `665136f53ef5`, containing main `d1670009fbfd`: Linux 1,037 passed / 46 skipped; Windows 714 passed / 389 skipped. Expected skips remain unvalidated. - Eighteen guest-ABI cases cover signed zero/subnormals, ordinary and extreme finite values, finite values beyond double's range, infinities, quiet NaNs and signaling NaNs. Existing floating-point exception flags are preserved without adding flags. - Ten additional Linux calls through the production patched NID use raw x87 patterns, including a signaling NaN, and preserve errno and floating-point exception flags. - Earlier Astro import auditing no longer reports this NID as undefined. This is import/classification coverage, not standalone title-startup or gameplay proof. Native macOS library execution has not been validated. - The branch merges cleanly with main `ce5c8395333`; full CI remains tied to its recorded source/base. Conventions and whitespace checks pass. ### Checklist - [x] Based on main; current mergeability and tested revisions recorded above - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] No silent stubs added - [x] No notes, investigation files or images added to the repository - [x] No new third-party code - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: PPSA21564 #357 (PSML finite-classification import) - [x] GPUs tested: n/a; libc classification - [x] AI-assisted: yes Current review refresh: head `2f9d04fb77ffe4880e56e3548d78443c1395ad2b` includes upstream main `a5f493f90dca348a65561aed4bb325a629d1b668`. Conflicts are resolved and current conventions pass. Earlier full-build results describe the earlier head; fresh full Linux/Windows checks for this head are pending. Verified current full CI: [run 38505264035](https://github.com/JJenkx/AnyPS5/actions/runs/38505264035) passes topic `2f9d04fb77ffe4880e56e3548d78443c1395ad2b` merged into base `a5f493f90dca348a65561aed4bb325a629d1b668`. Linux 1059 passed/46 expected skips; Windows 730 passed/397 expected skips. Skipped cases remain unvalidated. The tested source tree matches this published topic head.
github-actions[bot] commented 2026-10-14 00:52:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T00:52:17Z.


Progress report (a5f493f → 2f9d04f)

➖ System libraries: 88.19% (+0.0%, +1 implemented functions)

✅ 1 implemented
Library Name
libc __isfinitel_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6158399966 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5599#issuecomment-6158399966). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-14T00:52:17Z. --- <!-- progress-report --> ### Progress report (a5f493f → 2f9d04f) ➖ **System libraries**: 88.19% (+0.0%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libc | `__isfinitel_nid_postfix` | </details>
adriadam10 commented 2026-10-15 11:41:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T11:41:55Z.


Checked __isfinitel against FreeBSD msun s_isfinite.c (exp != 32767): same classification. Build and ctest pass on main + PR (guest_math included), and the new test fails to link without the change. Debt line is under Functional. Merging once the full Build is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6191214191 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5599#issuecomment-6191214191). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-15T11:41:55Z. --- Checked `__isfinitel` against FreeBSD msun `s_isfinite.c` (`exp != 32767`): same classification. Build and ctest pass on main + PR (`guest_math` included), and the new test fails to link without the change. Debt line is under Functional. Merging once the full Build is green.
github-actions[bot] commented 2026-10-15 12:08:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:08:08Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 3965 docs/dev/debt/libc.md
PR 5303 docs/dev/debt/libc.md
PR 5835 docs/dev/debt/libc.md
PR 6044 core/libs/tests/GuestMath.cpp
PR 6107 docs/dev/debt/libc.md
PR 6222 docs/dev/debt/libc.md
PR 6226 docs/dev/debt/libc.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6191677764 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5599#issuecomment-6191677764). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T12:08:08Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 3965](https://www.github.com/boykopovar/AnyPS5/pull/3965) | `docs/dev/debt/libc.md` | | [PR 5303](https://www.github.com/boykopovar/AnyPS5/pull/5303) | `docs/dev/debt/libc.md` | | [PR 5835](https://www.github.com/boykopovar/AnyPS5/pull/5835) | `docs/dev/debt/libc.md` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestMath.cpp` | | [PR 6107](https://www.github.com/boykopovar/AnyPS5/pull/6107) | `docs/dev/debt/libc.md` | | [PR 6222](https://www.github.com/boykopovar/AnyPS5/pull/6222) | `docs/dev/debt/libc.md` | | [PR 6226](https://www.github.com/boykopovar/AnyPS5/pull/6226) | `docs/dev/debt/libc.md` |
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!5599
No description provided.