Page MenuHomeFreeBSD

libc: Provide sub fp(s|g)etmask() implementations for RISC-V
ClosedPublic

Authored by kp on Jul 20 2020, 5:48 AM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 23 2023, 1:16 AM
Unknown Object (File)
Dec 3 2023, 6:10 PM
Unknown Object (File)
Dec 3 2023, 6:10 PM
Unknown Object (File)
Dec 3 2023, 6:10 PM
Unknown Object (File)
Dec 3 2023, 12:34 PM
Unknown Object (File)
Nov 11 2023, 5:20 PM
Unknown Object (File)
Nov 5 2023, 5:13 AM
Unknown Object (File)
Nov 5 2023, 3:40 AM
Subscribers

Details

Summary

RISC-V doesn't support floating-point exceptions.

RISC-V Instruction Set Manual: Volume I: User-Level ISA, 11.2
Floating-Point Control and Status Register: "As allowed by the standard,
we do not support traps on floating-point exceptions in the base ISA,
but instead require explicit checks of the flags in software. We
considered adding branches controlled directly by the contents of the
floating-point accrued exception flags, but ultimately chose to omit
these instructions to keep the ISA simple."

We still need these functions, because some applications (notably Perl)
call them, but we cannot provide a meaningful implementation.

Sponsored by: Axiado

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kp requested review of this revision.Jul 20 2020, 5:48 AM
kp created this revision.
kp retitled this revision from libc: Provide sub fp(s|g)etmask() implementations for RISC-V to WIP: libc: Provide sub fp(s|g)etmask() implementations for RISC-V.Jul 20 2020, 5:48 AM
kp set the repository for this revision to rS FreeBSD src repository - subversion.

I've provided this as a point of discussion more than as a finished solution. I'm not sure if there's a better way to do this.

FWIW Perl's usage of these functions is pretty simple, they have a single line

#define PERL_FPU_INIT (void)fpsetmask(0)

which I guess is used to ensure that floating point exceptions won't trap. Looks like we've got that covered.

Myself I can't image how to implement these as anything other than stubs. Our implementation of feholdexcept, which is similar to fpsetmask, is a stub.

kp retitled this revision from WIP: libc: Provide sub fp(s|g)etmask() implementations for RISC-V to libc: Provide sub fp(s|g)etmask() implementations for RISC-V.Jul 22 2020, 6:20 PM
kp added a subscriber: jrtc27.

Yeah, I don't see better options either. If there are no objections I'm going to commit this in a few days.

This revision was not accepted when it landed; it landed in state Needs Review.Aug 3 2020, 12:48 PM
This revision was automatically updated to reflect the committed changes.