[llvm] [libc][bazel] Add BUILD rules for fma and fmaf functions. (PR #159502)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 17 21:18:10 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: Alexey Samsonov (vonosmas)
<details>
<summary>Changes</summary>
This change adds the capability to build fma/fmaf with Bazel (fmal, fmaf128 variants are not implemented yet), and run smoke tests.
BUILD rules for regular MPFR-based tests will be added later, since they require support for building rand/srand as well, which is missing in Bazel for now.
---
Full diff: https://github.com/llvm/llvm-project/pull/159502.diff
2 Files Affected:
- (modified) utils/bazel/llvm-project-overlay/libc/BUILD.bazel (+13-1)
- (modified) utils/bazel/llvm-project-overlay/libc/test/src/math/smoke/BUILD.bazel (+9-1)
``````````diff
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index c491eb11a4601..6850b9c786a23 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -3834,7 +3834,19 @@ libc_math_function(name = "floorf128")
libc_math_function(name = "floorf16")
-# TODO: Add fma, fmaf, fmal, fmaf128 functions.
+libc_math_function(
+ name = "fma",
+ additional_deps = [
+ ":__support_fputil_fma",
+ ],
+)
+
+libc_math_function(
+ name = "fmaf",
+ additional_deps = [
+ ":__support_fputil_fma",
+ ],
+)
libc_math_function(
name = "fmaf16",
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..b213c0f53b694 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
@@ -475,7 +475,15 @@ math_test(
hdrs = ["FloorTest.h"],
)
-# TODO: Add fma, fmaf, fmal, fmaf128 tests.
+math_test(
+ name = "fma",
+ hdrs = ["FmaTest.h"],
+)
+
+math_test(
+ name = "fmaf",
+ hdrs = ["FmaTest.h"],
+)
# TODO: Reenable this test once it passes at Google.
# math_test(
``````````
</details>
https://github.com/llvm/llvm-project/pull/159502
More information about the llvm-commits
mailing list