From 647337f97039cac35594ea1502e007d8406a2c99 Mon Sep 17 00:00:00 2001 From: Tue Ly Date: Mon, 21 Jul 2025 03:53:50 +0000 Subject: [PATCH 1/2] [libc][bazel] Add hypotf16 bazel targets. --- utils/bazel/llvm-project-overlay/libc/BUILD.bazel | 8 ++++++++ .../bazel/llvm-project-overlay/libc/libc_build_rules.bzl | 2 ++ .../llvm-project-overlay/libc/test/src/math/BUILD.bazel | 7 +++++++ .../libc/test/src/math/smoke/BUILD.bazel | 5 +++++ 4 files changed, 22 insertions(+) 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"], From 1af8cc55e1e53975c57dfe8a1ba5878d7f0da229 Mon Sep 17 00:00:00 2001 From: Tue Ly Date: Mon, 21 Jul 2025 19:55:25 +0000 Subject: [PATCH 2/2] Move -fext-numeric-literals to libc_test_rules.bzl. --- utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl | 2 -- utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) 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 45bf723bc5c91..e123e4d32b785 100644 --- a/utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl +++ b/utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl @@ -17,8 +17,6 @@ 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/libc_test_rules.bzl b/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl index 41a706d2d92fb..a7acd6159afac 100644 --- a/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl +++ b/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl @@ -62,7 +62,8 @@ def libc_test( name = name, local_defines = local_defines + LIBC_CONFIGURE_OPTIONS, deps = deps, - copts = copts + libc_common_copts(), + # For complex floating point literals. + copts = copts + libc_common_copts() + ["-fext-numeric-literals"], linkstatic = 1, **kwargs )