Skip to content

[compiler-rt] Don't raise Inexact exception in C FP add implementation #111211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

keith-packard
Copy link
Contributor

@keith-packard keith-packard commented Oct 4, 2024

It would be lovely if the soft float implementation were extended to fully support all IEEE exceptions and rounding modes. However, at present, there is only a single place where one exception might be raised: the C version of addition raises Inexact when the result differs from the precise value.

This affects targets which have hardware support for some formats and rely on software for other formats; those will expose an implementation of __fe_raise_inexact() that modifies the FPU status register.

Removing the Inexact exception generation from the C version of FP addition makes the implementation consistent across all operations and formats on all targets. In addition, it makes the implementation match the semantics of libgcc on 32-bit arm.

Copy link

github-actions bot commented Oct 4, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

It would be lovely if the soft float implementation were extended to
fully support all IEEE exceptions and rounding modes. However, at
present, there is only a single place where one exception might be
raised: the C version of addition raises Inexact when the result
differs from the precise value.

This affects targets which have hardware support for some formats and
rely on software for other formats; those will expose an
implementation of __fe_raise_inexact() that modifies the FPU status
register.

Removing the Inexact exception generation from the C version of FP
addition makes the implementation consistent across all operations and
formats on all targets. In addition, it makes the implementation match
the semantics of libgcc.

Signed-off-by: Keith Packard <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants