[libc-commits] [libc] [llvm] [libc][math] Update test/src/math/smoke/FmaTest.h to not rely on compiler runtime. (PR #159503)

via libc-commits libc-commits at lists.llvm.org
Wed Sep 17 21:23:18 PDT 2025


https://github.com/lntue created https://github.com/llvm/llvm-project/pull/159503

None

>From b853a8492ea8f365c8ddc8db54f03cb4b777b761 Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue.h at gmail.com>
Date: Thu, 18 Sep 2025 04:20:40 +0000
Subject: [PATCH] [libc][math] Update test/src/math/smoke/FmaTest.h to not rely
 on compiler runtime.

---
 libc/test/src/math/smoke/FmaTest.h            |  2 +-
 .../libc/test/src/math/smoke/BUILD.bazel      | 38 +++++++++----------
 2 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/libc/test/src/math/smoke/FmaTest.h b/libc/test/src/math/smoke/FmaTest.h
index 5d344d9e7ebe7..c2d47a979e335 100644
--- a/libc/test/src/math/smoke/FmaTest.h
+++ b/libc/test/src/math/smoke/FmaTest.h
@@ -88,7 +88,7 @@ class FmaTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest {
     // Test overflow.
     OutType z = out.max_normal;
     InType in_z = LIBC_NAMESPACE::fputil::cast<InType>(out.max_normal);
-    EXPECT_FP_EQ_ALL_ROUNDING(OutType(0.75) * z,
+    EXPECT_FP_EQ_ALL_ROUNDING(func(InType(-0.25), in_z, in_z),
                               func(InType(1.75), in_z, -in_z));
 
     // Exact cancellation.
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/math/smoke/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/math/smoke/BUILD.bazel
index 2bffcdea58478..7f3722c0df661 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/math/smoke/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/math/smoke/BUILD.bazel
@@ -204,21 +204,20 @@ math_test(
     hdrs = ["FmaTest.h"],
 )
 
-# TODO: Reenable these tests once they pass at Google.
-# math_test(
-#     name = "f16fma",
-#     hdrs = ["FmaTest.h"],
-# )
-#
-# math_test(
-#     name = "f16fmaf",
-#     hdrs = ["FmaTest.h"],
-# )
-#
-# math_test(
-#     name = "f16fmal",
-#     hdrs = ["FmaTest.h"],
-# )
+math_test(
+    name = "f16fma",
+    hdrs = ["FmaTest.h"],
+)
+
+math_test(
+    name = "f16fmaf",
+    hdrs = ["FmaTest.h"],
+)
+
+math_test(
+    name = "f16fmal",
+    hdrs = ["FmaTest.h"],
+)
 
 math_test(
     name = "dmull",
@@ -477,11 +476,10 @@ math_test(
 
 # TODO: Add fma, fmaf, fmal, fmaf128 tests.
 
-# TODO: Reenable this test once it passes at Google.
-# math_test(
-#     name = "fmaf16",
-#     hdrs = ["FmaTest.h"],
-# )
+math_test(
+    name = "fmaf16",
+    hdrs = ["FmaTest.h"],
+)
 
 math_test(
     name = "fmax",



More information about the libc-commits mailing list