Skip to content

Conversation

vonosmas
Copy link
Contributor

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.

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.
@llvmbot llvmbot added libc bazel "Peripheral" support tier build system: utils/bazel labels Sep 18, 2025
@llvmbot
Copy link
Member

llvmbot commented Sep 18, 2025

@llvm/pr-subscribers-libc

Author: Alexey Samsonov (vonosmas)

Changes

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 --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(

@vonosmas vonosmas merged commit b6e440b into llvm:main Sep 18, 2025
13 checks passed
@vonosmas vonosmas deleted the libc-bazel-fma branch September 18, 2025 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bazel "Peripheral" support tier build system: utils/bazel libc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants