Skip to content

Conversation

@lntue
Copy link
Contributor

@lntue lntue commented Jul 21, 2025

No description provided.

@lntue lntue requested a review from vonosmas July 21, 2025 04:00
@llvmbot llvmbot added libc bazel "Peripheral" support tier build system: utils/bazel labels Jul 21, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 21, 2025

@llvm/pr-subscribers-libc

Author: None (lntue)

Changes

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

4 Files Affected:

  • (modified) utils/bazel/llvm-project-overlay/libc/BUILD.bazel (+8)
  • (modified) utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl (+2)
  • (modified) utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel (+7)
  • (modified) utils/bazel/llvm-project-overlay/libc/test/src/math/smoke/BUILD.bazel (+5)
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 337423cfb96cb..56a3474692720 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -3471,6 +3471,14 @@ libc_math_function(
     ],
 )
 
+libc_math_function(
+    name = "hypotf16",
+    additional_deps = [
+        ":__support_fputil_multiply_add",
+        ":__support_fputil_sqrt",
+    ],
+)
+
 libc_math_function(name = "ilogb")
 
 libc_math_function(name = "ilogbf")
diff --git a/utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl b/utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl
index e123e4d32b785..45bf723bc5c91 100644
--- a/utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl
+++ b/utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl
@@ -17,6 +17,8 @@ def libc_common_copts():
         "-I" + libc_include_path,
         "-I" + paths.join(libc_include_path, "include"),
         "-DLIBC_NAMESPACE=" + LIBC_NAMESPACE,
+        # For complex floating point literals.
+        "-fext-numeric-literals",
     ]
 
 def libc_release_copts():
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel
index d20922df1b8b5..7f119e3e9b637 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel
@@ -286,6 +286,13 @@ math_mpfr_test(
     ],
 )
 
+math_mpfr_test(
+    name = "hypotf16",
+    hdrs = [
+        "HypotTest.h",
+    ],
+)
+
 math_mpfr_test(
     name = "llrint",
     hdrs = ["RoundToIntegerTest.h"],
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 4df1c4508d764..6d9d1d6a33255 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
@@ -898,6 +898,11 @@ math_test(
     hdrs = ["HypotTest.h"],
 )
 
+math_test(
+    name = "hypotf16",
+    hdrs = ["HypotTest.h"],
+)
+
 math_test(
     name = "ilogb",
     hdrs = ["ILogbTest.h"],

@lntue lntue requested a review from michaelrj-google July 21, 2025 13:08
"-I" + paths.join(libc_include_path, "include"),
"-DLIBC_NAMESPACE=" + LIBC_NAMESPACE,
# For complex floating point literals.
"-fext-numeric-literals",
Copy link
Contributor

Choose a reason for hiding this comment

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

Where are those used? I'm somewhat surprised hypotf16 is the first use we discover (i.e. the first Bazel target where we need it).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually I should move this flag to libc_test definition. It is also presented in our cmake test compile options. I wonder how can we build our current complex tests? When I tried with bazel test @llvm-project//libc/..., complex tests are failed to build due to -fi complex literals.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe because some of the bots don't have MPC installed and/or using the compiler for which the special flag is not needed? In one of the downstream deployments we have libc/test/src/complex tests running successfully.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, this option is present in libc/cmake/modules/LLVMLibCCompileOptionRules.cmake (but only for GNU compiler), so maybe we just don't need a special flag when we build with Clang?

@lntue lntue merged commit e1aed19 into llvm:main Jul 21, 2025
9 checks passed
@lntue lntue deleted the hypotf16 branch July 21, 2025 20:14
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Jul 28, 2025
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.

3 participants