aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorMuhammad Bassiouni <60100307+bassiounix@users.noreply.github.com>2025-10-05 06:31:39 +0300
committerGitHub <noreply@github.com>2025-10-05 06:31:39 +0300
commit3e78c313bcfa54f8d1f1bdf221611d461e56111c (patch)
treedad870efb231e0231057825d981dfdb0a7d9c375 /utils
parent8181c3deae482769937bdcee68f381df4141eb24 (diff)
downloadllvm-3e78c313bcfa54f8d1f1bdf221611d461e56111c.tar.gz
llvm-3e78c313bcfa54f8d1f1bdf221611d461e56111c.tar.bz2
llvm-3e78c313bcfa54f8d1f1bdf221611d461e56111c.zip
[libc][math] Refactor exp2 implementation to header-only in src/__support/math folder. (#161297)
Part of #147386 in preparation for: https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
Diffstat (limited to 'utils')
-rw-r--r--utils/bazel/llvm-project-overlay/libc/BUILD.bazel85
1 files changed, 46 insertions, 39 deletions
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 026664bd019f..e91e7c8aa7c8 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -2157,24 +2157,13 @@ libc_function(
########################### math support library ###############################
libc_support_library(
- name = "common_constants",
- srcs = ["src/math/generic/common_constants.cpp"],
- hdrs = ["src/math/generic/common_constants.h"],
- deps = [
- ":__support_math_acosh_float_constants",
- ":__support_math_exp_constants",
- ":__support_number_pair",
- ],
-)
-
-libc_support_library(
name = "log_range_reduction",
hdrs = ["src/math/generic/log_range_reduction.h"],
deps = [
":__support_common",
":__support_fputil_dyadic_float",
+ ":__support_math_common_constants",
":__support_uint128",
- ":common_constants",
],
)
@@ -2189,8 +2178,8 @@ libc_support_library(
":__support_fputil_polyeval",
":__support_fputil_rounding_mode",
":__support_macros_optimization",
+ ":__support_math_common_constants",
":__support_math_exp10f_utils",
- ":common_constants",
],
)
@@ -2558,6 +2547,16 @@ libc_support_library(
)
libc_support_library(
+ name = "__support_math_common_constants",
+ hdrs = ["src/__support/math/common_constants.h"],
+ deps = [
+ ":__support_math_acosh_float_constants",
+ ":__support_math_exp_constants",
+ ":__support_number_pair",
+ ],
+)
+
+libc_support_library(
name = "__support_math_cos",
hdrs = ["src/__support/math/cos.h"],
deps = [
@@ -2632,8 +2631,8 @@ libc_support_library(
":__support_fputil_polyeval",
":__support_fputil_rounding_mode",
":__support_macros_optimization",
+ ":__support_math_common_constants",
":__support_sincosf_utils",
- ":common_constants",
],
)
@@ -2879,6 +2878,24 @@ libc_support_library(
)
libc_support_library(
+ name = "__support_math_exp2",
+ hdrs = ["src/__support/math/exp2.h"],
+ deps = [
+ ":__support_fputil_double_double",
+ ":__support_fputil_dyadic_float",
+ ":__support_fputil_multiply_add",
+ ":__support_fputil_nearest_integer",
+ ":__support_fputil_polyeval",
+ ":__support_fputil_rounding_mode",
+ ":__support_fputil_triple_double",
+ ":__support_integer_literals",
+ ":__support_macros_optimization",
+ ":__support_math_common_constants",
+ ":__support_math_exp_utils",
+ ],
+)
+
+libc_support_library(
name = "__support_math_exp10",
hdrs = ["src/__support/math/exp10.h"],
deps = [
@@ -3652,17 +3669,7 @@ libc_math_function(
libc_math_function(
name = "exp2",
additional_deps = [
- ":__support_fputil_double_double",
- ":__support_fputil_dyadic_float",
- ":__support_fputil_multiply_add",
- ":__support_fputil_nearest_integer",
- ":__support_fputil_polyeval",
- ":__support_fputil_rounding_mode",
- ":__support_fputil_triple_double",
- ":__support_integer_literals",
- ":__support_macros_optimization",
- ":__support_math_exp_utils",
- ":common_constants",
+ ":__support_math_exp2",
],
)
@@ -3706,7 +3713,7 @@ libc_math_function(
":__support_fputil_triple_double",
":__support_integer_literals",
":__support_macros_optimization",
- ":common_constants",
+ ":__support_math_common_constants",
],
)
@@ -3720,7 +3727,7 @@ libc_math_function(
":__support_fputil_rounding_mode",
":__support_macros_optimization",
":__support_macros_properties_cpu_features",
- ":common_constants",
+ ":__support_math_common_constants",
],
)
@@ -4233,7 +4240,7 @@ libc_math_function(
":__support_integer_literals",
":__support_macros_optimization",
":__support_macros_properties_cpu_features",
- ":common_constants",
+ ":__support_math_common_constants",
":log_range_reduction",
],
)
@@ -4246,7 +4253,7 @@ libc_math_function(
":__support_fputil_polyeval",
":__support_macros_optimization",
":__support_macros_properties_cpu_features",
- ":common_constants",
+ ":__support_math_common_constants",
],
)
@@ -4268,7 +4275,7 @@ libc_math_function(
":__support_integer_literals",
":__support_macros_optimization",
":__support_macros_properties_cpu_features",
- ":common_constants",
+ ":__support_math_common_constants",
":log_range_reduction",
],
)
@@ -4281,7 +4288,7 @@ libc_math_function(
":__support_fputil_polyeval",
":__support_macros_optimization",
":__support_macros_properties_cpu_features",
- ":common_constants",
+ ":__support_math_common_constants",
],
)
@@ -4303,7 +4310,7 @@ libc_math_function(
":__support_integer_literals",
":__support_macros_optimization",
":__support_macros_properties_cpu_features",
- ":common_constants",
+ ":__support_math_common_constants",
],
)
@@ -4315,7 +4322,7 @@ libc_math_function(
":__support_fputil_polyeval",
":__support_macros_optimization",
":__support_macros_properties_cpu_features",
- ":common_constants",
+ ":__support_math_common_constants",
],
)
@@ -4330,7 +4337,7 @@ libc_math_function(
":__support_integer_literals",
":__support_macros_optimization",
":__support_macros_properties_cpu_features",
- ":common_constants",
+ ":__support_math_common_constants",
":log_range_reduction",
],
)
@@ -4342,7 +4349,7 @@ libc_math_function(
":__support_fputil_multiply_add",
":__support_fputil_polyeval",
":__support_macros_optimization",
- ":common_constants",
+ ":__support_math_common_constants",
],
)
@@ -4488,7 +4495,7 @@ libc_math_function(
":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
":__support_fputil_sqrt",
- ":common_constants",
+ ":__support_math_common_constants",
],
)
@@ -4503,7 +4510,7 @@ libc_math_function(
":__support_fputil_triple_double",
":__support_macros_optimization",
":__support_math_exp10f",
- ":common_constants",
+ ":__support_math_common_constants",
":exp2f_impl",
],
)
@@ -4664,7 +4671,7 @@ libc_math_function(
":__support_fputil_rounding_mode",
":__support_macros_optimization",
":__support_math_sinhfcoshf_utils",
- ":common_constants",
+ ":__support_math_common_constants",
],
)
@@ -4771,7 +4778,7 @@ libc_math_function(
":__support_macros_optimization",
":__support_macros_properties_cpu_features",
":__support_math_exp10f_utils",
- ":common_constants",
+ ":__support_math_common_constants",
],
)