Skip to content

[libc] Fix asin_test smoke test for DAZ modes due to mis-optimization on newer clang. #141996

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

Merged
merged 2 commits into from
May 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions libc/test/src/math/smoke/asin_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,26 @@ TEST_F(LlvmLibcAsinTest, SpecialNumbers) {

using namespace LIBC_NAMESPACE::testing;

// With FTZ/DAZ flags are set, when the inputs are denormal, the output bit
// pattern might not be exactly 0, but they should all be equal to 0 as floating
// points.

TEST_F(LlvmLibcAsinTest, FTZMode) {
ModifyMXCSR mxcsr(FTZ);

EXPECT_FP_EQ(zero, LIBC_NAMESPACE::asin(min_denormal));
EXPECT_TRUE(zero == LIBC_NAMESPACE::asin(min_denormal));
}

TEST_F(LlvmLibcAsinTest, DAZMode) {
ModifyMXCSR mxcsr(DAZ);

EXPECT_FP_EQ(zero, LIBC_NAMESPACE::asin(min_denormal));
EXPECT_TRUE(zero == LIBC_NAMESPACE::asin(min_denormal));
}

TEST_F(LlvmLibcAsinTest, FTZDAZMode) {
ModifyMXCSR mxcsr(FTZ | DAZ);

EXPECT_FP_EQ(zero, LIBC_NAMESPACE::asin(min_denormal));
EXPECT_TRUE(zero == LIBC_NAMESPACE::asin(min_denormal));
}

#endif
Loading