Repository navigation
feat(libSceLibcInternal): implement the _Pow family for Dinkumware's pow - #21722
Conversation
PrivacyOnion
left a comment
There was a problem hiding this comment.
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 1ba49db5ae:
- Conventions:
tools/check_conventions.pypassed;git diff --checkclean. - Build:
guest_libc_internal_scaled_pow_testsbuilt cleanly. - CTest (
guest_libc_internal_scaled_pow):1/1 Test #4065: guest_libc_internal_scaled_pow ... Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 - Negative control: with
core/libs/prx/libSceLibcInternal/Export.cpp,core/libs/prx/libSceLibcInternal/include/MathInternals.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass. - Code reading:
- Verified in
core/libs/prx/libSceLibcInternal/ScaledPow.cppandcore/libs/prx/libSceLibcInternal/include/MathInternals.hppthat_Pow_nid_postfix,_FPow_nid_postfix, and_LPow_nid_postfixuseAPS5_VABI, match Dinkumware's(T x, T y, short* exponent)signatures, and have their old parameterless stubs removed fromcore/libs/prx/libSceLibcInternal/Export.cpp. - Verified in
core/libs/prx/libSceLibcInternal/ScaledPow.cppthat a non-nullexponentpointer triggersNotImplemented_nid_no_patchwithout dereferencing or mutating*exponent, while anullptrexponentdelegates directly topow_nid_postfix,powf_nid_postfix, andpowl_nid_postfix. - Verified that
docs/dev/debt/changes/feat-libsce-libcinternal-pow.mdproperly documents the unmeasured console behavior, the non-null exponent gap, and the msun rounding difference underlibSceLibcInternal(## add Functional). - Verified in
core/libs/tests/GuestLibcInternalScaledPow.cppandcore/libs/prx/libSceLibcInternal/CMakeLists.txtthatguest_libc_internal_scaled_pow_teststests finite, zero, negative, overflowing, infinite, and NaN inputs (checking both value equality andstd::signbit) for nullexponentand verifies that non-nullexponentthrowsstd::runtime_errorwithout modifyingexponent. - Checked cross-platform LP64/LLP64 portability and CMake test configuration (
configure_windows_unwindandWIN32PATHmodification forlibSceLibcInternal).
- Verified in
Looks Good To Me
|
The implementation is fine for the case it covers: with a null exponent pointer Please drop those four lines and keep the null-exponent checks, which compare real results. |
|
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.
|
|
Thanks for the review! Done: I dropped the assertions on the unimplemented non-null exponent path and kept the null-pointer checks against |
What
Implements
_Pow,_FPowand_LPowin libSceLibcInternal (newScaledPow.cpp), replacing the parameterless stubs. Only the argument Dinkumware's ownpowpasses is implemented; any other argument still throws throughNotImplemented_nid_no_patch. Because of that,tools/progress.pystill counts all three as pending._Pow(x, y, short *pex)(and the float and long double forms) comes from the declaration in Dinkumware V6.50's xxpow.h.pow(x, y)isreturn _Pow(x, y, 0);(xxpow.h). So a nullpexreturns libc'spow,powforpowl. A non-nullpexthrows: no caller there shows what the module writes through it or how it scales the result. No Dinkumware implementation is ported or used.pow/powf/powl, not Dinkumware's code, so last bits can differ._Logpoly,_FLogpolyand_LLogpolystay stubbed. Their only callers are inside Dinkumware's own_Powand log code, so nothing public pins down their argument or result. To implement them honestly, someone needs a firmware measurement: the return value for a fewwvalues in roughly [-0.2, 0.2].Tested
Linux x86-64 (Debian, GCC 14.2.0), Release,
BUILD_TESTING=ON, rebased on currentmain. No title tested.guest_libc_internal_scaled_powpasses. It checks:pow/powf/powlbit for bit on 16 pairs, including signed zeros, NaN, infinities, overflow and underflow_Pow(2, 10, nullptr) == 1024ctest -R libc_internal: 64/64 pass.tools/check_conventions.py --base origin/mainpasses.tools/pr_overlap.py --namesfinds no open PR for any of the six functions.--branchreports no shared exports or conflicting lines.main, so they could not be compared automatically. I compared their hunks by hand: none touches these functions or the changed lines. test(agc): keep the packed image table guard programs at different addresses #21255 no longer touches these files.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)