Skip to content
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

Avoid undefined behavior in FMA. #286

Merged
merged 1 commit into from
Jan 9, 2024
Merged

Conversation

hvdijk
Copy link
Collaborator

@hvdijk hvdijk commented Jan 9, 2024

Overview

Avoid undefined behavior in FMA.

Reason for change

If the result is zero, the result is not denormal, so we do not need to follow the denormal special case logic. The check
rounding_mask & ansAsUint would always be zero, so it would never do anything, but the calculation of rounding_mask might have had undefined behavior due to an out-of-range exponent.

Description of change

Describe the intended behaviour your changes are meant to introduce to the
project and explain how they resolve the problem stated above. Detail any
relevant changes that may affect other users of the project, such as
compilation options, runtime flags, expected inputs and outputs, API entry
points, etc.

If you have added new testing, provide details on what tests you have added
and what the purpose of them is.

Anything else we should know?

If there's any other relevant information we should know that may help us in
understanding and verifying your patch, please include it here.

Checklist

  • Read and follow the project Code of Conduct.
  • Make sure the project builds successfully with your changes.
  • Run relevant testing locally to avoid regressions.
  • Run clang-format-16 (the most
    recent version available through pip) on all modified code.

If the result is zero, the result is not denormal, so we do not need to
follow the denormal special case logic. The check
rounding_mask & ansAsUint would always be zero, so it would never do
anything, but the calculation of rounding_mask might have had undefined
behavior due to an out-of-range exponent.
@hvdijk hvdijk merged commit 400c4cb into uxlfoundation:main Jan 9, 2024
3 checks passed
@hvdijk hvdijk deleted the avoid-fma-ub branch January 9, 2024 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants