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

Fix MathUtil.Denormals with clang 15/16 #11485

Merged
merged 2 commits into from
Apr 17, 2023
Merged

Fix MathUtil.Denormals with clang 15/16 #11485

merged 2 commits into from
Apr 17, 2023

Conversation

daschuer
Copy link
Member

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

With -ffastmath clang format applies the flushing to zero already at the pre-processor level. This change makes sure the target does the division.
@daschuer daschuer added this to the 2.3.5 milestone Apr 17, 2023
@@ -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;
Copy link
Contributor

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.

Copy link
Member

@Swiftb0y Swiftb0y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

Copy link
Member

@Swiftb0y Swiftb0y left a 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.

Comment on lines 67 to 69
// 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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.

@daschuer daschuer force-pushed the denormals_test_fix branch from cd64da9 to c9342ec Compare April 17, 2023 16:46
@daschuer
Copy link
Member Author

Done

Copy link
Member

@Swiftb0y Swiftb0y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@Swiftb0y Swiftb0y merged commit 0c4e1e3 into 2.3 Apr 17, 2023
@daschuer daschuer deleted the denormals_test_fix branch June 12, 2023 05:16
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.

3 participants