Skip to content

[libc][math][c23] fixing dfmal for rv32 #101763

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 1 commit into from
Aug 3, 2024

Conversation

aaryanshukla
Copy link
Contributor

No description provided.

@llvmbot llvmbot added the libc label Aug 2, 2024
@llvmbot
Copy link
Member

llvmbot commented Aug 2, 2024

@llvm/pr-subscribers-libc

Author: None (aaryanshukla)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/101763.diff

1 Files Affected:

  • (modified) libc/test/src/math/smoke/FmaTest.h (+5-3)
diff --git a/libc/test/src/math/smoke/FmaTest.h b/libc/test/src/math/smoke/FmaTest.h
index f942de37654dd..bf6d06d698fde 100644
--- a/libc/test/src/math/smoke/FmaTest.h
+++ b/libc/test/src/math/smoke/FmaTest.h
@@ -67,12 +67,14 @@ class FmaTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest {
                          out.min_normal));
 
     if constexpr (sizeof(OutType) < sizeof(InType)) {
+      InFPBits tmp = InFPBits::one();
+      tmp.set_biased_exponent(InFPBits::EXP_BIAS - InFPBits::FRACTION_LEN - 1);
+      InType reciprocal_value = tmp.get_val();
+
       InType v = InFPBits(static_cast<InStorageType>(IN_MIN_NORMAL_U +
                                                      InStorageType(1)))
                      .get_val();
-      EXPECT_FP_EQ(
-          out.min_normal,
-          func(InType(1) / InType(IN_MIN_NORMAL_U << 1), v, out.min_normal));
+      EXPECT_FP_EQ(out.min_normal, func(reciprocal_value, v, out.min_normal));
     }
 
     // Test overflow.

@aaryanshukla
Copy link
Contributor Author

@mikhailramalho let me know if this passes on your build

Copy link
Member

@mikhailramalho mikhailramalho left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!

@mikhailramalho
Copy link
Member

BTW, you can probably enable it in arm32 too

@aaryanshukla aaryanshukla merged commit cad8352 into llvm:main Aug 3, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants