libm: Import secondary math library implementation - #507
ayoopierre wants to merge 8 commits into
Conversation
| * | ||
| * %LICENSE% | ||
| */ | ||
|
|
There was a problem hiding this comment.
[clang-format-pr] reported by reviewdog 🐶
suggested fix
|
|
||
| # Notes | ||
| 1. This is a temporary state, moving math library to be separate to libphoenix | ||
| 2. Some hardware instrinsics for math functions are still not implemented |
There was a problem hiding this comment.
[codespell] reported by reviewdog 🐶
instrinsics ==> intrinsics
| init->i.mantisa |= (0x1ull << 51); | ||
| } | ||
|
|
||
| /* Reciprocal sqare root iters (avoiding division): */ |
There was a problem hiding this comment.
[codespell] reported by reviewdog 🐶
sqare ==> square
There was a problem hiding this comment.
Code Review
This pull request refactors the math library by moving it from libphoenix to a standalone libm directory, introducing architecture-specific hardware-accelerated implementations alongside a software-based fallback. The review identified several critical issues, including a logic error in sinhf, a function name typo in truncf, a C99 linkage issue with inline functions, a syntax error in nanf, and potential build failures in the Makefile. Additionally, minor typos in the documentation were addressed.
aeed5b9 to
c948336
Compare
oI0ck
left a comment
There was a problem hiding this comment.
Please apply the suggested codespell changes
10d5b21 to
55e5cb1
Compare
55e5cb1 to
167cc91
Compare
There was a problem hiding this comment.
Minor nitpicks. Also please address all typos (those revealed by gemini, in commit messages, etc.), change PR's name to something meaningful, and rerun CI.
Please make it clear in PR's description that you import an external math library (libmcs) as a submodule. ("Adding a new math library implementation" looks a bit too vague and may be misinterpreted.)
167cc91 to
33d8f4b
Compare
Darchiv
left a comment
There was a problem hiding this comment.
Not all nitpicks were addressed (typos) but LGTM nonetheless.
Please rerun CI by rebase + force push in order to run cpptest (recently enabled by default on stm32n6)
33d8f4b to
8647e8f
Compare
|
|
| LIBM_USE_HW ?= y | ||
|
|
||
| # Set options for denormals on the FPU | ||
| ifeq ($(LIBM_LIBMCS_DAZ), y) |
There was a problem hiding this comment.
README.md says it's applicable only for libmcs. Guard it by LIBM_USE_LIBMCS?
There was a problem hiding this comment.
Is it LIBM_LIBMCS_DAZ or LIBMCS_FPU_DAZ?
There was a problem hiding this comment.
@ayoopierre provide Your response here so we can sloe this
There was a problem hiding this comment.
The LIBM_LIBMCS_DAZ is a build system level flag, while internally macro used in libmcs code is LIBMCS_FPU_DAZ. Wanted to keep all math library configuration flags with LIBM prefix.
There was a problem hiding this comment.
LIBM_LIBMCS_DAZ seems to be dead variable.
There was a problem hiding this comment.
I guess it is not required to be here. It is used in in top makefile for feature config. I can delete it but it provides default configuration in one place and clearly shows what configuration is possible.
455ff6d to
698f617
Compare
YT: RTOS-1132
59e720b to
f13ac41
Compare
YT: RTOS-1132
YT: RTOS-1132
Add secondary math libary implementation
Description
Import secondary math library implementation, with selection which version to build (external libmcs implementation/libphoenix implementation) and selection for usage of hw intrinsics for math operations.
Motivation and Context
Libmcs provides complete C99 math library implementation.
Types of changes
How Has This Been Tested?
Checklist:
Special treatment