RISC-V round_away () handling of non canonical rounding modes
Vineet Gupta
vineetg@rivosinc.com
Thu Jan 16 19:41:07 GMT 2025
On 1/16/25 11:14, Joseph Myers wrote:
> The simple thing to do is to change sysdeps/riscv/rvf/get-rounding-mode.h
> so it only returns a supported value (so making code using
> get_rounding_mode treat FE_TONEARESTFROMZERO the same as FE_TONEAREST,
> effectively). That doesn't give you actual support for this rounding
> mode, but should at least avoid aborts if it's set, in the absence of the
> larger changes discussed above to implement full FE_TONEARESTFROMZERO
> support.
The simple approach feels simpler ;-)
We can certainly fudge get_round_mode() to return FE_TONEARESTFROMZERO as
FE_TONEAREST.
But is that correct semantically as in the machine itself is in a different
rounding mode than what glibc thinks it in and could compute values numerically
differently than is expected.
I wonder if gcc should even be generating insns with such rounding mode for the
general (not explicit) cases.
Looking there.
-Vineet
More information about the Libc-alpha
mailing list