LibC: Add fenv+rounding support for RISC-V (and test fenv in the first place)
Because the new tests failed on x86 extended floating point (a truly cursed float format), you're getting two x87 fixes for free!
LibC: Start on fenv support for RISC-V
LibC: Add some fenv tests
Turns out that fegetround() is broken on x87, so the corresponding test assertions are commented out for now.
AK: Use common ComponentType integer type for float bitfields
This allows us to easily use an appropriate integer type when performing float bitfield operations.
This change also adds a comment about the technically-incorrect 80-bit extended float mantissa field.
LibC: Prevent undefined shift in internal_to_integer
New tests will hit a dead bit count of 64, leading to an undefined shift.
LibC: Add rounding specializations for RISC-V
Whenever the floating-point values are in integer range, we can use the various FCVT functions with static rounding mode to perform fast rounding. I took this opportunity to clean up the architecture differentiation for these functions, which allows us to use the software rounding implementation for all extreme and unimplemented cases, including AArch64.
Also adds more round & trunc tests.
LibC: Fix extended floating point software rounding
Contrary to IEEE formats, x86's 80-bit extended floats need the topmost mantissa bit to be 1 or else a special kind of NaN is produced. We fix this by reinserting the special bit if necessary.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!
This pull request has been closed because it has not had recent activity. Feel free to re-open if you wish to still contribute these changes. Thank you for your contributions!
gcc doesn't like your test file, looks like this needs a bit more than just a rebase :)
gcc doesn't like your test file, looks like this needs a bit more than just a rebase :)
Another case of not realizing that we have a blackbox function already...
Reminds me don't we implement most rounding functions already in AK/Math.h for risc V? So could we just forward to them instead?
Reminds me don't we implement most rounding functions already in AK/Math.h for risc V?
No, nothing riscv64-specific is in AK/Math.h yet?
Although I do wonder, why we don't forward the libc rounding functions to AK, like we do for other functions with MAKE_AK_BACKED? Or should they behave differently?
And those AK/Math.h versions of e.g. rint seem to be implemented differently than in LibC.
Depends on Clang 17, see the WIP commit. Drafting for now.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!
This pull request has been closed because it has not had recent activity. Feel free to re-open if you wish to still contribute these changes. Thank you for your contributions!