-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix MathUtil.Denormals with clang 15/16 #11485
Conversation
With -ffastmath clang format applies the flushing to zero already at the pre-processor level. This change makes sure the target does the division.
@@ -64,19 +64,23 @@ TEST_F(MathUtilTest, Denormal) { | |||
_MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_OFF); | |||
_MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_OFF); | |||
|
|||
volatile float fDenormal = std::numeric_limits<float>::min() / 2.0f; | |||
volatile float fDenormal = std::numeric_limits<float>::min(); | |||
fDenormal /= 2.0f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Please add a comment why the operations are written in this style including the volatile
keyword.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the typo and then amend and force push so it doesn't stay in the git history.
src/test/mathutiltest.cpp
Outdated
// Note: The volatile keyword makes sure that the devision is executed on the target | ||
// and not by the pre-processor. In case of clang >= 15 the pre-processor flushes to | ||
// zero with -ffast-math enabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Note: The volatile keyword makes sure that the devision is executed on the target | |
// and not by the pre-processor. In case of clang >= 15 the pre-processor flushes to | |
// zero with -ffast-math enabled. | |
// Note: The volatile keyword makes sure that the division is executed on the target | |
// and not by the pre-processor. In case of clang >= 15 the pre-processor flushes to | |
// zero with -ffast-math enabled. |
cd64da9
to
c9342ec
Compare
Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
With -ffastmath clang format applies the flushing to zero already at the pre-processor level. This change makes sure the target does the division.
Fixes: #11484