-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[libc][bazel] Add hypotf16 bazel targets. #149761
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
Conversation
|
@llvm/pr-subscribers-libc Author: None (lntue) ChangesFull diff: https://github.com/llvm/llvm-project/pull/149761.diff 4 Files Affected:
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"],
|
| "-I" + paths.join(libc_include_path, "include"), | ||
| "-DLIBC_NAMESPACE=" + LIBC_NAMESPACE, | ||
| # For complex floating point literals. | ||
| "-fext-numeric-literals", |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
No description provided.